From bda55f82c687920807f606a2b024f1882094ef1e Mon Sep 17 00:00:00 2001 From: Andrew Kaspick Date: Wed, 19 Nov 2008 12:55:27 -0600 Subject: allow options to be passed to email address auto generation Signed-off-by: Michael Koziarski [#1418 state:committed] --- actionpack/test/template/text_helper_test.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'actionpack/test') diff --git a/actionpack/test/template/text_helper_test.rb b/actionpack/test/template/text_helper_test.rb index 3e7a8f3e44..a6200fbdd7 100644 --- a/actionpack/test/template/text_helper_test.rb +++ b/actionpack/test/template/text_helper_test.rb @@ -262,6 +262,11 @@ class TextHelperTest < ActionView::TestCase email2_result = %{#{email2_raw}} assert_equal email2_result, auto_link(email2_raw) + email3_raw = '+david@loudthinking.com' + email3_result = %{#{email3_raw}} + assert_equal email3_result, auto_link(email3_raw, :all, :encode => :hex) + assert_equal email3_result, auto_link(email3_raw, :email_addresses, :encode => :hex) + link2_raw = 'www.rubyonrails.com' link2_result = generate_result(link2_raw, "http://#{link2_raw}") assert_equal %(Go to #{link2_result}), auto_link("Go to #{link2_raw}", :urls) @@ -362,7 +367,7 @@ class TextHelperTest < ActionView::TestCase end def test_auto_link_with_options_hash - assert_dom_equal 'Welcome to my new blog at http://www.myblog.com/. Please e-mail me at me@email.com.', + assert_dom_equal 'Welcome to my new blog at http://www.myblog.com/. Please e-mail me at me@email.com.', auto_link("Welcome to my new blog at http://www.myblog.com/. Please e-mail me at me@email.com.", :link => :all, :html => { :class => "menu", :target => "_blank" }) end -- cgit v1.2.3 From 0a4a5f3129a137fc357e8444a08b135f0ad4fbe8 Mon Sep 17 00:00:00 2001 From: Darren Boyd Date: Sat, 22 Nov 2008 10:04:30 -0800 Subject: Making the IP Spoofing check in AbstractRequest#remote_ip configurable. Certain groups of web proxies do not set these values properly. Notably, proxies for cell phones, which often do not set the remote IP information correctly (not surprisingly, since the clients do not have an IP address). Allowing this to be configurable makes it possible for developers to choose to ignore this simple spoofing check, when a significant amount of their traffic would result in false positives anyway. Signed-off-by: Michael Koziarski [#1200 state:committed] --- actionpack/test/controller/request_test.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'actionpack/test') diff --git a/actionpack/test/controller/request_test.rb b/actionpack/test/controller/request_test.rb index 316a203e97..ba4a6da39b 100644 --- a/actionpack/test/controller/request_test.rb +++ b/actionpack/test/controller/request_test.rb @@ -66,6 +66,15 @@ class RequestTest < ActiveSupport::TestCase assert_match /HTTP_X_FORWARDED_FOR="9.9.9.9, 3.4.5.6, 10.0.0.1, 172.31.4.4"/, e.message assert_match /HTTP_CLIENT_IP="8.8.8.8"/, e.message + # turn IP Spoofing detection off. + # This is useful for sites that are aimed at non-IP clients. The typical + # example is WAP. Since the cellular network is not IP based, it's a + # leap of faith to assume that their proxies are ever going to set the + # HTTP_CLIENT_IP/HTTP_X_FORWARDED_FOR headers properly. + ActionController::Base.ip_spoofing_check = false + assert_equal('8.8.8.8', @request.remote_ip(true)) + ActionController::Base.ip_spoofing_check = true + @request.env['HTTP_X_FORWARDED_FOR'] = '8.8.8.8, 9.9.9.9' assert_equal '8.8.8.8', @request.remote_ip(true) -- cgit v1.2.3