1
0
Fork 0
mirror of https://github.com/GeoffreyFrogeye/phroxyp.git synced 2024-05-21 00:16:22 +02:00

Fixed long POST

By using the same techique used with payload, i.e.
forcing "Connection: Close"
This commit is contained in:
Geoffrey Frogeye 2015-04-09 22:45:08 +02:00
parent 64b2a4e09d
commit 61ca4039e7

View file

@ -50,22 +50,20 @@ class Proxy {
if ($metd == 'POST') { // TODO Other with data methods if ($metd == 'POST') { // TODO Other with data methods
if (isset($_POST['payload'])) { if (isset($_POST['payload'])) {
$postData = stripslashes($_POST['payload']); $postData = stripslashes($_POST['payload']);
$reqHeds .= "Content-Length: ".strlen($postData)."\r\n";
$reqHeds .= "Connection: Close\r\n";
$reqHeds .= "\r\n" . $postData;
} else { } else {
$postinfo = ''; $postData = '';
foreach ($_POST as $key => $value) { foreach ($_POST as $key => $value) {
$postinfo .= $key . '=' . urlencode($value) . '&'; $postData .= $key . '=' . urlencode($value) . '&';
} }
$postinfo = rtrim($postinfo, '&'); $postData = rtrim($postData, '&');
$reqHeds .= "\r\n" . $postinfo;
} }
$reqHeds .= "Content-Length: ".strlen($postData)."\r\n";
$reqHeds .= "Connection: Close\r\n";
$reqHeds .= "\r\n" . $postData;
} else { } else {
$reqHeds .= "Connection: Close\r\n\r\n"; $reqHeds .= "Connection: Close\r\n\r\n";
} }
$fp = fsockopen($serv, $port, $errno, $errstr, 30); $fp = fsockopen($serv, $port, $errno, $errstr, 30);
if (!$fp) { // TODO ErrorCode, ErrorDocument if (!$fp) { // TODO ErrorCode, ErrorDocument
echo "Couldn't connect to server\n<br/>$errstr ($errno)<br />\n"; echo "Couldn't connect to server\n<br/>$errstr ($errno)<br />\n";