Update index.php

This commit is contained in:
Namhyeon Go 2024-02-26 15:10:48 +09:00 committed by GitHub
parent 2f5e6b0a33
commit 62fa07baab
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -144,13 +144,16 @@ function relay_connect($params, $id = '') {
$conn = fsockopen($client_address, $client_port, $error_code, $error_message, 1);
if (!$conn) {
$error = array(
"status" => 400,
"success" => false,
"code" => $error_code,
"message" => $error_message
);
echo "HTTP/1.1 400 Bad Request\r\n\r\n" . jsonrpc2_error_encode($error);
fwrite($conn, jsonrpc2_result_encode($error) . "\r\n\r\n");
} else {
fwrite($conn, jsonrpc2_result_encode(array("success" => true)));
$result = array(
"success" => true
);
fwrite($conn, jsonrpc2_result_encode($result) . "\r\n\r\n");
read_from_remote_server($remote_address, $remote_port, $scheme, $conn, $buffer_size, $id);
fclose($conn);
}