diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2007-05-28 00:10:13 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2007-05-28 00:10:13 +0000 |
commit | e5b3d4b3b53178fda008fc8638f52a526e717984 (patch) | |
tree | 067ad94f1026ceb90b4c8814c39a874eecc7d412 /actionpack/lib/action_controller | |
parent | 0aed1d629e82de743416a60461d52dace24bd4c4 (diff) | |
download | rails-e5b3d4b3b53178fda008fc8638f52a526e717984.tar.gz rails-e5b3d4b3b53178fda008fc8638f52a526e717984.tar.bz2 rails-e5b3d4b3b53178fda008fc8638f52a526e717984.zip |
request.remote_ip understands X-Forwarded-For addresses with nonstandard whitespace. Closes #7386.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6877 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_controller')
-rwxr-xr-x | actionpack/lib/action_controller/request.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/actionpack/lib/action_controller/request.rb b/actionpack/lib/action_controller/request.rb index caab289acd..2f0e86d2a2 100755 --- a/actionpack/lib/action_controller/request.rb +++ b/actionpack/lib/action_controller/request.rb @@ -112,7 +112,7 @@ module ActionController if @env.include? 'HTTP_X_FORWARDED_FOR' then remote_ips = @env['HTTP_X_FORWARDED_FOR'].split(',').reject do |ip| - ip =~ /^unknown$|^(10|172\.(1[6-9]|2[0-9]|30|31)|192\.168)\./i + ip.strip =~ /^unknown$|^(10|172\.(1[6-9]|2[0-9]|30|31)|192\.168)\./i end return remote_ips.first.strip unless remote_ips.empty? |