1
0
Fork 0
mirror of https://github.com/GeoffreyFrogeye/phroxyp.git synced 2024-05-02 19:16:44 +00: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 (isset($_POST['payload'])) {
$postData = stripslashes($_POST['payload']);
$reqHeds .= "Content-Length: ".strlen($postData)."\r\n";
$reqHeds .= "Connection: Close\r\n";
$reqHeds .= "\r\n" . $postData;
} else {
$postinfo = '';
$postData = '';
foreach ($_POST as $key => $value) {
$postinfo .= $key . '=' . urlencode($value) . '&';
$postData .= $key . '=' . urlencode($value) . '&';
}
$postinfo = rtrim($postinfo, '&');
$reqHeds .= "\r\n" . $postinfo;
$postData = rtrim($postData, '&');
}
$reqHeds .= "Content-Length: ".strlen($postData)."\r\n";
$reqHeds .= "Connection: Close\r\n";
$reqHeds .= "\r\n" . $postData;
} else {
$reqHeds .= "Connection: Close\r\n\r\n";
}
$fp = fsockopen($serv, $port, $errno, $errstr, 30);
if (!$fp) { // TODO ErrorCode, ErrorDocument
echo "Couldn't connect to server\n<br/>$errstr ($errno)<br />\n";