X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/c1f65ba7cf2fd60e533af5f0e8f488ee1a1f0f0d..ff36d7d8df16d1a1d94656bda7b8b7d4b9422a3a:/lib/init-cmd.php?ds=inline diff --git a/lib/init-cmd.php b/lib/init-cmd.php index e5a650fc..50c709c9 100644 --- a/lib/init-cmd.php +++ b/lib/init-cmd.php @@ -1,31 +1,28 @@ array( - 'proxy' => $proxy, - 'request_fulluri' => true, - 'header' => $aHeaders - ), - 'https' => array( - 'proxy' => $proxy, - 'request_fulluri' => true, - 'header' => $aHeaders - ) - ); - stream_context_set_default($aContext); - } +// handle http proxy when using file_get_contents +if (CONST_HTTP_Proxy) { + $proxy = 'tcp://' . CONST_HTTP_Proxy_Host . ':' . CONST_HTTP_Proxy_Port; + $aHeaders = array(); + if (CONST_HTTP_Proxy_Login != null && CONST_HTTP_Proxy_Login != '' && CONST_HTTP_Proxy_Password != null && CONST_HTTP_Proxy_Password != '') { + $auth = base64_encode(CONST_HTTP_Proxy_Login . ':' . CONST_HTTP_Proxy_Password); + $aHeaders = array("Proxy-Authorization: Basic $auth"); + } + $aContext = array( + 'http' => array( + 'proxy' => $proxy, + 'request_fulluri' => true, + 'header' => $aHeaders + ), + 'https' => array( + 'proxy' => $proxy, + 'request_fulluri' => true, + 'header' => $aHeaders + ) + ); + stream_context_set_default($aContext); +}