[imp] Fix for Headers.php with multiple http proxies

Jon Knepher jbk at wild-e.com
Fri Jan 10 12:03:04 PST 2003


For CVS HEAD.  A notice and bad Received line is inserted when a message goes 
through 2 or more http proxies.  This discards the middle proxy addresses and 
uses the client's ip address.

Jon


Index: Headers.php
===================================================================
RCS file: /repository/imp/lib/Headers.php,v
retrieving revision 1.49
diff -u -r1.49 Headers.php
--- Headers.php 10 Jan 2003 06:03:39 -0000      1.49
+++ Headers.php 10 Jan 2003 20:02:35 -0000
@@ -366,7 +366,8 @@
 
         if (array_key_exists('HTTP_X_FORWARDED_FOR', $_SERVER)) {
             /* This indicates the user is connecting through a proxy. */
-            $remote_addr = $_SERVER['HTTP_X_FORWARDED_FOR'];
+            $remote_path = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
+            $remote_addr = $remote_path[0];
             $remote = gethostbyaddr($remote_addr);
         } else {
             $remote_addr = $_SERVER['REMOTE_ADDR'];


More information about the imp mailing list