From: Janusz Dobrowolski Date: Fri, 22 May 2015 11:47:17 +0000 (+0200) Subject: Fixed delays during access to external urls (e.g. exchange rate services). X-Git-Tag: v2.4.2~19^2~163 X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=commitdiff_plain;h=8a263f8617589d9a38f12ea55a6055a707ab217e;p=fa-stable.git Fixed delays during access to external urls (e.g. exchange rate services). --- diff --git a/includes/remote_url.inc b/includes/remote_url.inc index 4cb88e12..5c6790ae 100644 --- a/includes/remote_url.inc +++ b/includes/remote_url.inc @@ -57,20 +57,12 @@ function url_get_contents($url, $timeout=10) "Accept: */*\r\n" . "Accept-Language: en-us,en;q=0.5\r\n" . "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\r\n" . - "Keep-Alive: 300\r\n" . - "Connection: keep-alive\r\n" . + "Connection: close\r\n" . "Referer: http://$host\r\n\r\n"); // retrieve the response from the remote server - $unblocked=0; - while ($line = fread($fp, 4096)) { - $response .= $line; - if (strpos($host,'localhost') !== false && !$unblocked++) - stream_set_blocking($fp, 0); // just after connection switch to nonblocking mode - usleep(10); - } - fclose( $fp ); + $response = stream_get_contents($fp); if (!strpos($response, "200 OK\r\n")) return null;