From 4f07e5bdac587e7058b3793675aabe43a11fc05f Mon Sep 17 00:00:00 2001 From: "Namhyeon, Go" Date: Mon, 4 Mar 2024 16:29:48 +0900 Subject: [PATCH] Update index.php --- assets/php/index.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/assets/php/index.php b/assets/php/index.php index 864669c..50e616a 100644 --- a/assets/php/index.php +++ b/assets/php/index.php @@ -3,16 +3,19 @@ // Namhyeon Go (Catswords Research) // https://github.com/gnh1201/caterpillar // Created at: 2022-10-06 -// Updated at: 2024-02-29 +// Updated at: 2024-03-04 define("PHP_HTTPPROXY_VERSION", "0.1.5"); +define("DEFAULT_SOCKET_TIMEOUT", 1); +define("STATEFUL_SOCKET_TIMEOUT", 30); +define("MAX_EXECUTION_TIME", 0); if (strpos($_SERVER['HTTP_USER_AGENT'], "php-httpproxy/") !== 0) { exit('It works!

It works!

Download the client


php-httpproxy/' . PHP_HTTPPROXY_VERSION . ' (Server; PHP ' . phpversion() . '; Caterpillar; abuse@catswords.net)

'); } -ini_set("default_socket_timeout", 1); // must be. because of `feof()` works -ini_set("max_execution_time", 0); +ini_set("default_socket_timeout", DEFAULT_SOCKET_TIMEOUT); // must be. because of `feof()` works +ini_set("max_execution_time", MAX_EXECUTION_TIME); function jsonrpc2_encode($method, $params, $id = '') { $data = array( @@ -65,7 +68,7 @@ function read_from_remote_server($remote_address, $remote_port, $scheme, $data = $remote_address = "tls://" . $remote_address; } - $sock = fsockopen($remote_address, $remote_port, $error_code, $error_message, 1); + $sock = fsockopen($remote_address, $remote_port, $error_code, $error_message, DEFAULT_SOCKET_TIMEOUT); if (!$sock) { $error = array( "status" => 502, @@ -156,7 +159,7 @@ function relay_connect($params, $id = '') { $datetime = $params['datetime']; // format: %Y-%m-%d %H:%M:%S.%f $starttime = microtime(true); - $conn = fsockopen($client_address, $client_port, $error_code, $error_message, 1); + $conn = fsockopen($client_address, $client_port, $error_code, $error_message, STATEFUL_SOCKET_TIMEOUT); if (!$conn) { $error = array( "status" => 502,