aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/http/request.rb
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2011-11-15 22:47:18 +0000
committerJon Leighton <j@jonathanleighton.com>2011-11-15 22:47:18 +0000
commit8d1a2b3ecde5a8745b3eaab4763a71d80ca3441f (patch)
tree662be22f6fe091499390b3ea9e0b0fda3a9f715c /actionpack/lib/action_dispatch/http/request.rb
parent6491aadc525b8703708e0fd0fbf05bd436a47801 (diff)
downloadrails-8d1a2b3ecde5a8745b3eaab4763a71d80ca3441f.tar.gz
rails-8d1a2b3ecde5a8745b3eaab4763a71d80ca3441f.tar.bz2
rails-8d1a2b3ecde5a8745b3eaab4763a71d80ca3441f.zip
Revert "Merge pull request #3640 from indirect/remote_ip"
This reverts commit 6491aadc525b8703708e0fd0fbf05bd436a47801, reversing changes made to 83bf0b626cf2134260903e57d74f67de57384073. See https://github.com/rails/rails/pull/3640#issuecomment-2752761 for explanation.
Diffstat (limited to 'actionpack/lib/action_dispatch/http/request.rb')
-rw-r--r--actionpack/lib/action_dispatch/http/request.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/actionpack/lib/action_dispatch/http/request.rb b/actionpack/lib/action_dispatch/http/request.rb
index 0e8bd0bd6d..b10f6b48c7 100644
--- a/actionpack/lib/action_dispatch/http/request.rb
+++ b/actionpack/lib/action_dispatch/http/request.rb
@@ -155,9 +155,10 @@ module ActionDispatch
@ip ||= super
end
- # Originating IP address from the RemoteIp middleware.
+ # Originating IP address, usually set by the RemoteIp middleware.
def remote_ip
- @remote_ip ||= @env["action_dispatch.remote_ip"]
+ # Coerce the remote_ip object into a string, because to_s could return nil
+ @remote_ip ||= @env["action_dispatch.remote_ip"].to_s || ip
end
# Returns the unique request id, which is based off either the X-Request-Id header that can