mirror of
https://github.com/GeoffreyFrogeye/phroxyp.git
synced 2024-11-20 19:26:03 +01:00
Merge branch 'ciHooks'
This commit is contained in:
commit
63db7c2b16
|
@ -1,3 +1,3 @@
|
||||||
FallbackResource /index.php
|
FallbackResource /index.php
|
||||||
ErrorDocument 404 /index.php
|
ErrorDocument 404 /index.php
|
||||||
RemoveHandler .php
|
RemoveHandler .php
|
||||||
|
|
25
index.php
25
index.php
|
@ -45,18 +45,25 @@ $reqHeds .= "Host: $serv:$port\r\n";
|
||||||
// Converting client request headers to server request headers
|
// Converting client request headers to server request headers
|
||||||
$reqsHedsC = getallheaders();
|
$reqsHedsC = getallheaders();
|
||||||
foreach ($reqsHedsC as $name => $content) {
|
foreach ($reqsHedsC as $name => $content) {
|
||||||
if ($name != 'Host') {
|
if ($name != 'Host' && $name != 'Connection') {
|
||||||
$reqHeds .= "$name: $content\r\n";
|
$reqHeds .= "$name: $content\r\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($metd == 'POST') { // TODO Waaaay too long
|
if ($metd == 'POST') { // TODO Waaaay too long
|
||||||
$postinfo = '';
|
if (isset($_POST['payload'])) {
|
||||||
foreach ($_POST as $key => $value) {
|
$postData = stripslashes($_POST['payload']);
|
||||||
$postinfo .= $key . '=' . urlencode($value) . '&';
|
$reqHeds .= "Content-Length: ".strlen($postData)."\r\n";
|
||||||
|
$reqHeds .= "Connection: Close\r\n";
|
||||||
|
$reqHeds .= "\r\n" . $postData;
|
||||||
|
} else {
|
||||||
|
$postinfo = '';
|
||||||
|
foreach ($_POST as $key => $value) {
|
||||||
|
$postinfo .= $key . '=' . urlencode($value) . '&';
|
||||||
|
}
|
||||||
|
$postinfo = rtrim($postinfo, '&');
|
||||||
|
$reqHeds .= "\r\n" . $postinfo;
|
||||||
}
|
}
|
||||||
$postinfo = rtrim($postinfo, '&');
|
|
||||||
$reqHeds .= "\r\n" . $postinfo;
|
|
||||||
} else {
|
} else {
|
||||||
$reqHeds .= "Connection: Close\r\n\r\n";
|
$reqHeds .= "Connection: Close\r\n\r\n";
|
||||||
}
|
}
|
||||||
|
@ -69,13 +76,12 @@ if (!$fp) {
|
||||||
// Sending request
|
// Sending request
|
||||||
fwrite($fp, $reqHeds);
|
fwrite($fp, $reqHeds);
|
||||||
$resBuf = '';
|
$resBuf = '';
|
||||||
while (!feof($fp)) {
|
while ($get = fgets($fp, 128)) {
|
||||||
// Getting response
|
// Getting response
|
||||||
if ($resBuf === True) { // If headers sent
|
if ($resBuf === True) { // If headers sent
|
||||||
$get = fgets($fp, 128);
|
|
||||||
echo $get;
|
echo $get;
|
||||||
} else {
|
} else {
|
||||||
$resBuf .= fgets($fp, 128);
|
$resBuf .= $get;
|
||||||
if ($sepPos = strrpos($resBuf, "\r\n\r\n")) { // Headers have been retrieved
|
if ($sepPos = strrpos($resBuf, "\r\n\r\n")) { // Headers have been retrieved
|
||||||
$resHeds = explode("\r\n", substr($resBuf, 0, $sepPos));
|
$resHeds = explode("\r\n", substr($resBuf, 0, $sepPos));
|
||||||
foreach ($resHeds as $resHed) { // Setting headers
|
foreach ($resHeds as $resHed) { // Setting headers
|
||||||
|
@ -91,5 +97,4 @@ if (!$fp) {
|
||||||
}
|
}
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Reference in a new issue