File tree Expand file tree Collapse file tree 1 file changed +1
-7
lines changed
actionpack/lib/action_dispatch/middleware Expand file tree Collapse file tree 1 file changed +1
-7
lines changed Original file line number Diff line number Diff line change @@ -159,7 +159,7 @@ def calculate_ip
159
159
160
160
# If every single IP option is in the trusted list, return the IP
161
161
# that's furthest away
162
- filter_proxies ( ips + [ remote_addr ] ) . first || ips . last || remote_addr
162
+ ips . detect { | ip | @proxies . none? { | p | p === ip } } || ( @proxies . none? { | p | p === remote_addr } && remote_addr ) || ips . last || remote_addr
163
163
end
164
164
165
165
# Memoizes the value returned by #calculate_ip and returns it for
@@ -183,12 +183,6 @@ def ips_from(header) # :doc:
183
183
end
184
184
ips
185
185
end
186
-
187
- def filter_proxies ( ips ) # :doc:
188
- ips . reject do |ip |
189
- @proxies . any? { |proxy | proxy === ip }
190
- end
191
- end
192
186
end
193
187
end
194
188
end
You can’t perform that action at this time.
0 commit comments