Author:   Wolfgang <[email protected]>
Date:     Mon Mar 18 22:30:41 2013 +0100
Committer:   Wolfgang <[email protected]>
Commit-Date: Mon Mar 18 22:30:41 2013 +0100

add option "http_proxy_auth" to enable proxy authentication

---

 docs/de_DE/geomap.html                      |    3 ++-
 docs/en_US/geomap.html                      |    3 ++-
 etc/nagvis.ini.php-sample                   |    2 ++
 share/server/core/classes/GlobalMainCfg.php |    5 +++++
 share/server/core/sources/geomap.php        |    4 ++++
 5 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/docs/de_DE/geomap.html b/docs/de_DE/geomap.html
index e9a16ec..87818cd 100644
--- a/docs/de_DE/geomap.html
+++ b/docs/de_DE/geomap.html
@@ -20,7 +20,8 @@
         NagVis benutzt eine simple HTTP-basierte API, um das Map-Image und die 
Koordinaten dieses Images zu erhalten.</p>
         <p>In den meisten F&auml;llen hat der NagVis-Host keinen direkten 
Internet-Zugriff. Sie k&ouml;nnen die <code>http_proxy</code>
         Option im <code>[global]</code>-Abschnitt Ihrer 
NagVis-Hauptkonfigurationsdatei (nagvis.ini.php) verwenden, um NagVis 
anzuweisen,
-        einen Proxy f&uuml;r solche Anfragen zu benutzen.</p>
+        einen Proxy f&uuml;r solche Anfragen zu benutzen. Die meisten Proxies 
erfordern eine Authentifizierung, um den Zugang zum
+        Internet zu kontrollieren. Mit der Option <code>http_proxy_auth</code> 
k&ouml;nnen die Zugangsdaten gesetzt werden.</p>
         
         <h2>Der erste Aufruf</h2>
         <p>NagVis wird mit einer Demo-Geomap namens &quot;demo-geomap&quot; 
ausgeliefert. Wenn Ihr NagVis korrekt konfiguriert ist,
diff --git a/docs/en_US/geomap.html b/docs/en_US/geomap.html
index 70590cf..09800c0 100644
--- a/docs/en_US/geomap.html
+++ b/docs/en_US/geomap.html
@@ -20,7 +20,8 @@
         via port 80. NagVis uses a simple HTTP based API to get the map image 
and the coordinates of that image.</p>
         <p>In most cases the NagVis host does not have direct internet access. 
You can configure the <code>http_proxy</code>
         option in the <code>[global]</code> section of your NagVis main 
configuration to tell NagVis to use
-         a proxy such requests.</p>
+        a proxy such requests. Most proxies require an authentication to 
control access to the internet.
+        Please use the option <code>http_proxy_auth</code> to set the 
credentials.</p>
         
         <h2>The first call</h2>
         <p>NagVis comes with a demo geomap called "demo-geomap". If your 
NagVis is configured correctly
diff --git a/etc/nagvis.ini.php-sample b/etc/nagvis.ini.php-sample
index c61c235..63ad970 100644
--- a/etc/nagvis.ini.php-sample
+++ b/etc/nagvis.ini.php-sample
@@ -64,6 +64,8 @@
 ; The proxy url to be used in NagVis can be configured here. One possible value
 ; is "tcp://127.0.0.1:8080".
 ;http_proxy=""
+; Most proxies require authentication to access the internet.
+;http_proxy_auth="user:password"
 ; Set the timeout (in seconds) for outbound HTTP requests (for example geomap 
requests)
 ;http_timeout=10
 ;
diff --git a/share/server/core/classes/GlobalMainCfg.php 
b/share/server/core/classes/GlobalMainCfg.php
index 1e809db..bef1340 100644
--- a/share/server/core/classes/GlobalMainCfg.php
+++ b/share/server/core/classes/GlobalMainCfg.php
@@ -131,6 +131,11 @@ class GlobalMainCfg {
                     'default' => null,
                     'match'   => MATCH_STRING_URL,
                 ),
+                'http_proxy_auth' => array(
+                    'must'    => 0,
+                    'default' => null,
+                    'match'   => MATCH_STRING_NO_SPACE,
+                ),
                 'http_timeout' => array(
                     'must'    => 1,
                     'default' => 10,
diff --git a/share/server/core/sources/geomap.php 
b/share/server/core/sources/geomap.php
index cc28746..aca9bc5 100644
--- a/share/server/core/sources/geomap.php
+++ b/share/server/core/sources/geomap.php
@@ -106,6 +106,10 @@ function geomap_get_contents($url) {
             $opts['http']['proxy'] = $proxy;
             $opts['http']['request_fulluri'] = true;
         }
+        $proxy_auth = cfg('global', 'http_proxy_auth');
+        if($proxy_auth !== null) {
+            $opts['http']['header'] = 'Proxy-Authorization: Basic ' . 
base64_encode("$proxy_auth");
+        }
         
         $context = stream_context_create($opts);
 


------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins

Reply via email to