diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2008-11-30 20:06:41 -0600 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2008-11-30 20:06:41 -0600 |
commit | 119a41e21ddfe220d1d6e92102b65141a0e2299d (patch) | |
tree | 836dd10b18b0a727d75ffd999dd8533b80716a0f /actionpack/lib/action_controller/request.rb | |
parent | 3b3c0507e2f67a0f64dc04b396c1d13411ab5890 (diff) | |
parent | eb5e6fe713756b36ee6df9b04f28cfb8bae60dbc (diff) | |
download | rails-119a41e21ddfe220d1d6e92102b65141a0e2299d.tar.gz rails-119a41e21ddfe220d1d6e92102b65141a0e2299d.tar.bz2 rails-119a41e21ddfe220d1d6e92102b65141a0e2299d.zip |
Merge branch 'master' of git@github.com:rails/rails
Diffstat (limited to 'actionpack/lib/action_controller/request.rb')
-rwxr-xr-x | actionpack/lib/action_controller/request.rb | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/actionpack/lib/action_controller/request.rb b/actionpack/lib/action_controller/request.rb index c079895683..baa955cb04 100755 --- a/actionpack/lib/action_controller/request.rb +++ b/actionpack/lib/action_controller/request.rb @@ -209,7 +209,7 @@ module ActionController # 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} @@ -369,11 +369,9 @@ EOM # Returns the interpreted \path to requested resource after all the installation # directory of this application was taken into account. def path - path = (uri = request_uri) ? uri.split('?').first.to_s : '' - - # Cut off the path to the installation directory if given - path.sub!(%r/^#{ActionController::Base.relative_url_root}/, '') - path || '' + path = request_uri.to_s[/\A[^\?]*/] + path.sub!(/\A#{ActionController::Base.relative_url_root}/, '') + path end memoize :path |