From d98c5a9e39c312424fa2586d1fe846f2999d49f5 Mon Sep 17 00:00:00 2001 From: Jacek Kowalski <Jacek@jacekk.info> Date: Wed, 28 Jul 2021 21:51:50 +0000 Subject: [PATCH] Set explicit 5s connect timeout in proxy script --- proxy_common.php | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/proxy_common.php b/proxy_common.php index cbc5350..0b06acb 100644 --- a/proxy_common.php +++ b/proxy_common.php @@ -107,8 +107,9 @@ $parameters[$name] = $_GET[$name]; } +ini_set('default_socket_timeout', 5); $result = @file_get_contents($base_proxy . $path . '?' . http_build_query($parameters)); -if(!$result OR $http_response_header[0] != 'HTTP/1.1 200 OK') { +if(!$result OR substr($http_response_header[0], 0, 13) != 'HTTP/1.1 200 ') { header('HTTP/1.1 503 Service Unavailable'); if(isset($http_response_header[0])) { die($http_response_header[0]); -- Gitblit v1.9.1