Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Simplify REMOTE_ADDR parsing

  • Loading branch information...
commit 4fabc9b2f376c47d4381572167956063b3c8c418 1 parent 93456a2
@jeremy jeremy authored
Showing with 1 addition and 1 deletion.
  1. +1 −1  actionpack/lib/action_controller/request.rb
View
2  actionpack/lib/action_controller/request.rb
@@ -209,7 +209,7 @@ def xml_http_request?
# delimited list in the case of multiple chained proxies; the last
# address which is not trusted is the originating IP.
def remote_ip
- remote_addr_list = @env['REMOTE_ADDR'] && @env['REMOTE_ADDR'].split(',').collect(&:strip)
+ remote_addr_list = @env['REMOTE_ADDR'] && @env['REMOTE_ADDR'].scan(/[^,\s]+/)
unless remote_addr_list.blank?
not_trusted_addrs = remote_addr_list.reject {|addr| addr =~ TRUSTED_PROXIES}

0 comments on commit 4fabc9b

Please sign in to comment.
Something went wrong with that request. Please try again.