Update proxytest.php

This commit is contained in:
Namhyeon Go 2022-10-06 11:05:59 +09:00 committed by GitHub
parent a3ef0fe6c9
commit 58562c835e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,16 +8,15 @@ ini_set("default_socket_timeout", 1); // must be. because of `feof()` works
$data = json_decode(file_get_contents('php://input'), true); $data = json_decode(file_get_contents('php://input'), true);
$buffer_size = $data['chunksize']; $buffer_size = $data['chunksize'];
$out = base64_decode($data['data']);
$port = intval($data['port']); $port = intval($data['port']);
$hostname = $data['server']; $scheme = $data['scheme'];
// TODO: HTTPS support
/*
if ($port == 443) {
$hostname = "ssl://" . $hostname;
}
*/
$hostname = $data['server'];
if ($scheme == "https") {
$hostname = sprintf("tls://%s:%s", $hostname, $port);
}
$fp = fsockopen($hostname, $port, $errno, $errstr, 1); $fp = fsockopen($hostname, $port, $errno, $errstr, 1);
if (!$fp) { if (!$fp) {