From 61ca4039e76b42cc27a3be3dfa693e5459f057a8 Mon Sep 17 00:00:00 2001 From: Geoffrey Frogeye Date: Thu, 9 Apr 2015 22:45:08 +0200 Subject: [PATCH] Fixed long POST By using the same techique used with payload, i.e. forcing "Connection: Close" --- proxy.php | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/proxy.php b/proxy.php index b16cf02..1a330c5 100755 --- a/proxy.php +++ b/proxy.php @@ -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
$errstr ($errno)
\n";