about summary refs log tree commit homepage
path: root/lib/unicorn/http_request.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/unicorn/http_request.rb')
-rw-r--r--lib/unicorn/http_request.rb3
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/unicorn/http_request.rb b/lib/unicorn/http_request.rb
index 4355ad7..7519170 100644
--- a/lib/unicorn/http_request.rb
+++ b/lib/unicorn/http_request.rb
@@ -18,7 +18,6 @@ class Unicorn::HttpRequest
   }
 
   NULL_IO = StringIO.new("")
-  LOCALHOST = '127.0.0.1'
 
   # :stopdoc:
   # A frozen format for this is about 15% faster
@@ -62,7 +61,7 @@ class Unicorn::HttpRequest
     #  identify the client for the immediate request to the server;
     #  that client may be a proxy, gateway, or other intermediary
     #  acting on behalf of the actual source client."
-    @env[REMOTE_ADDR] = TCPSocket === socket ? socket.peeraddr[-1] : LOCALHOST
+    @env[REMOTE_ADDR] = socket.kgio_addr
 
     # short circuit the common case with small GET requests first
     if @parser.headers(@env, socket.readpartial(16384, @buf)).nil?