Permalink
Browse files

ActionDispatch::Http::URL.normalize_port should not strip port for pr…

…otocol relative URL.

(cherry picked from commit be93d94)
  • Loading branch information...
guiocavalcanti authored and pixeltrix committed May 9, 2014
1 parent 16ce285 commit fb2025350d4ba540716fb7f8690451de628e5440
Showing with 12 additions and 2 deletions.
  1. +0 −2 actionpack/lib/action_dispatch/http/url.rb
  2. +12 −0 actionpack/test/controller/url_for_test.rb
@@ -129,8 +129,6 @@ def normalize_port(options)
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
@@ -169,6 +169,18 @@ def test_without_protocol
)
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'}

0 comments on commit fb20253

Please sign in to comment.