]> git.openstreetmap.org Git - nominatim.git/commitdiff
allow usage behind an HTTP Proxy. Fixes twain47/Nominatim#33
authorSimon Lopez <simon.lopez@worldline.com>
Tue, 19 May 2015 13:16:07 +0000 (15:16 +0200)
committerSimon Lopez <simon.lopez@worldline.com>
Thu, 21 May 2015 17:51:04 +0000 (19:51 +0200)
lib/init-cmd.php
settings/settings.php

index e6de0522146fe381770662f78fad11542442ac7b..e5a650fc1a49ebb9e01aa73dcbf187b26f7a90d1 100644 (file)
@@ -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);
+       }
index 1d91b61c1907ca56f1e47af3c47f42e0755a1fa6..a1fbc9f8e9a56684206d3470ac62561b5c4c7bac 100644 (file)
@@ -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