aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/application/middleware
diff options
context:
space:
mode:
authorAndrew White <andyw@pixeltrix.co.uk>2013-09-30 12:39:10 +0100
committerAndrew White <andyw@pixeltrix.co.uk>2013-09-30 12:39:10 +0100
commitdeb91862b93176efd2dc58f81574326256791b92 (patch)
tree1acb3e7156810022fec72715c6393e058cea8671 /railties/test/application/middleware
parent93899335aece402f21fb4663e86d680a5b8e2fec (diff)
parentccd6f8b931efa7b3eb191a62522fbfc89389b091 (diff)
downloadrails-deb91862b93176efd2dc58f81574326256791b92.tar.gz
rails-deb91862b93176efd2dc58f81574326256791b92.tar.bz2
rails-deb91862b93176efd2dc58f81574326256791b92.zip
Merge branch 'fix-ip-spoof-errors' of https://github.com/tamird/rails into tamird-fix-ip-spoof-errors
Diffstat (limited to 'railties/test/application/middleware')
-rw-r--r--railties/test/application/middleware/remote_ip_test.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/railties/test/application/middleware/remote_ip_test.rb b/railties/test/application/middleware/remote_ip_test.rb
index 91c5807379..946b82eeb3 100644
--- a/railties/test/application/middleware/remote_ip_test.rb
+++ b/railties/test/application/middleware/remote_ip_test.rb
@@ -33,6 +33,16 @@ module ApplicationTests
end
end
+ test "works with both headers individually" do
+ make_basic_app
+ assert_nothing_raised(ActionDispatch::RemoteIp::IpSpoofAttackError) do
+ assert_equal "1.1.1.1", remote_ip("HTTP_X_FORWARDED_FOR" => "1.1.1.1")
+ end
+ assert_nothing_raised(ActionDispatch::RemoteIp::IpSpoofAttackError) do
+ assert_equal "1.1.1.2", remote_ip("HTTP_CLIENT_IP" => "1.1.1.2")
+ end
+ end
+
test "can disable IP spoofing check" do
make_basic_app do |app|
app.config.action_dispatch.ip_spoofing_check = false