aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/middleware/remote_ip.rb
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2015-06-03 14:00:34 +0800
committerAaron Patterson <aaron.patterson@gmail.com>2015-06-03 14:01:11 +0800
commit6c4416183454cc75ee4dbed107fe7370c69fc37d (patch)
tree6106dcbe6f3c5dc9c192ed74eb7470abd608b3b1 /actionpack/lib/action_dispatch/middleware/remote_ip.rb
parent814a994e1bfbb1a3a9cc94103e665ea90fafe792 (diff)
downloadrails-6c4416183454cc75ee4dbed107fe7370c69fc37d.tar.gz
rails-6c4416183454cc75ee4dbed107fe7370c69fc37d.tar.bz2
rails-6c4416183454cc75ee4dbed107fe7370c69fc37d.zip
pass check_ip and proxies to GetIp constructor
The `GetIp` class doesn't need to keep a reference to the middleware, so there is no reason to pass the middleware instance to the `GetIp` class
Diffstat (limited to 'actionpack/lib/action_dispatch/middleware/remote_ip.rb')
-rw-r--r--actionpack/lib/action_dispatch/middleware/remote_ip.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/actionpack/lib/action_dispatch/middleware/remote_ip.rb b/actionpack/lib/action_dispatch/middleware/remote_ip.rb
index 7c4236518d..9f894e2ec6 100644
--- a/actionpack/lib/action_dispatch/middleware/remote_ip.rb
+++ b/actionpack/lib/action_dispatch/middleware/remote_ip.rb
@@ -74,7 +74,7 @@ module ActionDispatch
# requests. For those requests that do need to know the IP, the
# GetIp#calculate_ip method will calculate the memoized client IP address.
def call(env)
- env["action_dispatch.remote_ip"] = GetIp.new(env, self)
+ env["action_dispatch.remote_ip"] = GetIp.new(env, check_ip, proxies)
@app.call(env)
end
@@ -82,10 +82,10 @@ module ActionDispatch
# into an actual IP address. If the ActionDispatch::Request#remote_ip method
# is called, this class will calculate the value and then memoize it.
class GetIp
- def initialize(env, middleware)
+ def initialize(env, check_ip, proxies)
@env = env
- @check_ip = middleware.check_ip
- @proxies = middleware.proxies
+ @check_ip = check_ip
+ @proxies = proxies
end
# Sort through the various IP address headers, looking for the IP most