[xiph-commits] r14854 - branches/dir.xiph.org/cgi-bin

balbinus at svn.xiph.org balbinus at svn.xiph.org
Sat May 10 11:32:20 PDT 2008


Author: balbinus
Date: 2008-05-10 11:32:19 -0700 (Sat, 10 May 2008)
New Revision: 14854

Modified:
   branches/dir.xiph.org/cgi-bin/yp.php
Log:
Detect if the remote client is behind a proxy (basic detection), and log first missing arg.

Modified: branches/dir.xiph.org/cgi-bin/yp.php
===================================================================
--- branches/dir.xiph.org/cgi-bin/yp.php	2008-05-10 18:20:49 UTC (rev 14853)
+++ branches/dir.xiph.org/cgi-bin/yp.php	2008-05-10 18:32:19 UTC (rev 14854)
@@ -48,12 +48,14 @@
 		    {
 		        if (!array_key_exists($a, $_REQUEST) || empty($_REQUEST[$a]))
 		        {
-			        throw new ServerRefusedAPIException('Not enough arguments.', SERVER_REFUSED_MISSING_ARG);
+			        throw new ServerRefusedAPIException('Not enough arguments.', SERVER_REFUSED_MISSING_ARG, $a);
 		        }
 		    }
 		    // Remote IP
-		    $ip = array_key_exists('REMOTE_ADDR', $_SERVER)
-		            ? $_SERVER['REMOTE_ADDR'] : null;
+                    $ip = array_key_exists('HTTP_X_FORWARDED_FOR', $_SERVER)
+			   ? $_SERVER['HTTP_X_FORWARDED_FOR']
+                           : array_key_exists('REMOTE_ADDR', $_SERVER)
+		              ? $_SERVER['REMOTE_ADDR'] : null;
 		    // Stream name
 		    $stream_name = clean_string($_REQUEST['sn']);
 		    // Media type



More information about the commits mailing list