diff options
author | Greg Sterndale <gsterndale@gmail.com> | 2011-08-22 10:20:35 -0400 |
---|---|---|
committer | Greg Sterndale <gsterndale@gmail.com> | 2012-02-07 11:21:32 -0500 |
commit | dd09811fa6214a130fdc2de1d4c00b4337cb15f9 (patch) | |
tree | 6a888e513fa491b7076ea53c0f66662e8e617496 /actionpack/lib/action_dispatch/middleware | |
parent | ed9aeec92d60c2b62f3cef6b02112ad4401a0bcc (diff) | |
download | rails-dd09811fa6214a130fdc2de1d4c00b4337cb15f9.tar.gz rails-dd09811fa6214a130fdc2de1d4c00b4337cb15f9.tar.bz2 rails-dd09811fa6214a130fdc2de1d4c00b4337cb15f9.zip |
Trusted proxies is replaced with a Regexp or appended to with a String
Diffstat (limited to 'actionpack/lib/action_dispatch/middleware')
-rw-r--r-- | actionpack/lib/action_dispatch/middleware/remote_ip.rb | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/actionpack/lib/action_dispatch/middleware/remote_ip.rb b/actionpack/lib/action_dispatch/middleware/remote_ip.rb index 030ccb2017..70dc2ff531 100644 --- a/actionpack/lib/action_dispatch/middleware/remote_ip.rb +++ b/actionpack/lib/action_dispatch/middleware/remote_ip.rb @@ -18,11 +18,13 @@ module ActionDispatch def initialize(app, check_ip_spoofing = true, custom_proxies = nil) @app = app @check_ip = check_ip_spoofing - if custom_proxies - custom_regexp = Regexp.new(custom_proxies) - @proxies = Regexp.union(TRUSTED_PROXIES, custom_regexp) + @proxies = case custom_proxies + when Regexp + custom_proxies + when nil + TRUSTED_PROXIES else - @proxies = TRUSTED_PROXIES + Regexp.union(TRUSTED_PROXIES, custom_proxies) end end |