Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PATCH] Optain REMOTE_ADDR from request-socket #112

Closed
znerol opened this issue Jun 18, 2011 · 1 comment
Closed

[PATCH] Optain REMOTE_ADDR from request-socket #112

znerol opened this issue Jun 18, 2011 · 1 comment

Comments

@znerol
Copy link

znerol commented Jun 18, 2011

diff --git a/scripts/httpserver/httpserver.php b/scripts/httpserver/httpserver.php
index a7cfb3d..3de3b6b 100755
--- a/scripts/httpserver/httpserver.php
+++ b/scripts/httpserver/httpserver.php
@@ -270,6 +270,11 @@ class HTTPServer
             'CONTENT_TYPE' => @$headers['Content-Type'],
             'CONTENT_LENGTH' => $content_length,            
         );        
+
+        // Optain REMOTE_ADDR from socket
+        if (!socket_getpeername($request->socket, $cgi_env['REMOTE_ADDR'])) {
+            $cgi_env['REMOTE_ADDR'] = '127.0.0.1';
+        }

         foreach ($headers as $name => $value)
         {        
@youngj
Copy link
Owner

youngj commented Jun 18, 2011

included your patch in 6559711, thanks!

@youngj youngj closed this as completed Jun 18, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants