diff options
author | Guilherme Cavalcanti <guiocavalcanti@gmail.com> | 2014-05-09 15:52:10 -0300 |
---|---|---|
committer | Andrew White <andyw@pixeltrix.co.uk> | 2014-05-11 12:59:37 +0100 |
commit | be93d94ef28421a2dbcd6ed870b454433a5a0a72 (patch) | |
tree | 145c7211fe35e5cb305b6013733495322bebdb86 | |
parent | adcba34c57adba61bfaf45296a6dc707c8338b99 (diff) | |
download | rails-be93d94ef28421a2dbcd6ed870b454433a5a0a72.tar.gz rails-be93d94ef28421a2dbcd6ed870b454433a5a0a72.tar.bz2 rails-be93d94ef28421a2dbcd6ed870b454433a5a0a72.zip |
ActionDispatch::Http::URL.normalize_port should not strip port for protocol relative URL.
-rw-r--r-- | actionpack/lib/action_dispatch/http/url.rb | 2 | ||||
-rw-r--r-- | actionpack/test/controller/url_for_test.rb | 12 |
2 files changed, 12 insertions, 2 deletions
diff --git a/actionpack/lib/action_dispatch/http/url.rb b/actionpack/lib/action_dispatch/http/url.rb index 278f534380..77ea0cf658 100644 --- a/actionpack/lib/action_dispatch/http/url.rb +++ b/actionpack/lib/action_dispatch/http/url.rb @@ -135,8 +135,6 @@ module ActionDispatch return nil if options[:port].nil? || options[:port] == false case options[:protocol] - when "//" - nil when "https://" options[:port].to_i == 443 ? nil : options[:port] else diff --git a/actionpack/test/controller/url_for_test.rb b/actionpack/test/controller/url_for_test.rb index a8035e5bd7..0c6df16325 100644 --- a/actionpack/test/controller/url_for_test.rb +++ b/actionpack/test/controller/url_for_test.rb @@ -169,6 +169,18 @@ module AbstractController ) end + def test_without_protocol_and_with_port + add_host! + add_port! + + assert_equal('//www.basecamphq.com:3000/c/a/i', + W.new.url_for(:controller => 'c', :action => 'a', :id => 'i', :protocol => '//') + ) + assert_equal('//www.basecamphq.com:3000/c/a/i', + W.new.url_for(:controller => 'c', :action => 'a', :id => 'i', :protocol => false) + ) + end + def test_trailing_slash add_host! options = {:controller => 'foo', :trailing_slash => true, :action => 'bar', :id => '33'} |