mirror of
https://github.com/gnh1201/caterpillar.git
synced 2025-09-08 10:51:14 +00:00
Update index.php
This commit is contained in:
parent
7619ebbcaf
commit
05bc9ba978
12
index.php
12
index.php
|
@ -60,9 +60,9 @@ function parse_headers($str) { // Parses HTTP headers into an array
|
||||||
// stateless mode
|
// stateless mode
|
||||||
function relay_request($params) {
|
function relay_request($params) {
|
||||||
$buffer_size = $params['buffer_size'];
|
$buffer_size = $params['buffer_size'];
|
||||||
$data = base64_decode($params['data']);
|
$request_data = base64_decode($params['request_data']);
|
||||||
$rawdata_length = intval($params['data_length']);
|
$request_header = parse_headers($request_data);
|
||||||
$headers = parse_headers($data);
|
$request_length = intval($params['request_length']);
|
||||||
$client_address = $params['client_address'];
|
$client_address = $params['client_address'];
|
||||||
$client_port = intval($params['client_port']);
|
$client_port = intval($params['client_port']);
|
||||||
$client_encoding = $params['client_encoding'];
|
$client_encoding = $params['client_encoding'];
|
||||||
|
@ -76,9 +76,9 @@ function relay_request($params) {
|
||||||
$remote_address = "tls://" . $remote_address;
|
$remote_address = "tls://" . $remote_address;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($relay_headers['@method'][0]) {
|
switch ($request_header['@method'][0]) {
|
||||||
case "CONNECT":
|
case "CONNECT":
|
||||||
echo sprintf("%s 200 Connection Established\r\n\r\n", $relay_headers['@method'][2]);
|
echo sprintf("%s 200 Connection Established\r\n\r\n", $request_header['@method'][2]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -91,7 +91,7 @@ function relay_request($params) {
|
||||||
);
|
);
|
||||||
echo "HTTP/1.1 400 Bad Request\r\n\r\n" . jsonrpc2_error_encode($error);
|
echo "HTTP/1.1 400 Bad Request\r\n\r\n" . jsonrpc2_error_encode($error);
|
||||||
} else {
|
} else {
|
||||||
fwrite($fp, $data);
|
fwrite($fp, $request_data);
|
||||||
|
|
||||||
$buf = null;
|
$buf = null;
|
||||||
while (!feof($fp) && $buf !== false) {
|
while (!feof($fp) && $buf !== false) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user