From: Sarah Hoffmann Date: Fri, 22 May 2015 19:20:51 +0000 (+0200) Subject: Merge branch 'http_proxy' of https://github.com/simonlopez/Nominatim X-Git-Tag: v.2.5.0~47 X-Git-Url: https://git.openstreetmap.org./nominatim.git/commitdiff_plain/3e871d6ee0212f20fc3f528b3957616b72bddad2?hp=dd97528726152e8f4e47aa6433acc30e94198644 Merge branch 'http_proxy' of https://github.com/simonlopez/Nominatim --- diff --git a/lib/init-cmd.php b/lib/init-cmd.php index e6de0522..e5a650fc 100644 --- a/lib/init-cmd.php +++ b/lib/init-cmd.php @@ -6,3 +6,26 @@ require_once('init.php'); require_once('cmd.php'); + + // 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); + } diff --git a/settings/settings.php b/settings/settings.php index 1d91b61c..a1fbc9f8 100644 --- a/settings/settings.php +++ b/settings/settings.php @@ -9,6 +9,13 @@ @define('CONST_Max_Word_Frequency', '50000'); @define('CONST_Limit_Reindexing', true); + // Proxy settings + @define('CONST_HTTP_Proxy', false); + @define('CONST_HTTP_Proxy_Host', 'proxy.mydomain.com'); + @define('CONST_HTTP_Proxy_Port', '3128'); + @define('CONST_HTTP_Proxy_Login', ''); + @define('CONST_HTTP_Proxy_Password', ''); + // Software versions @define('CONST_Postgresql_Version', '9.3'); // values: 9.0, ... , 9.4 @define('CONST_Postgis_Version', '2.1'); // values: 1.5, 2.0, 2.1