Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

…otocol relative URL.
  • Loading branch information...
commit be93d94ef28421a2dbcd6ed870b454433a5a0a72 1 parent adcba34
@guiocavalcanti guiocavalcanti authored pixeltrix committed
View
2  actionpack/lib/action_dispatch/http/url.rb
@@ -135,8 +135,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
View
12 actionpack/test/controller/url_for_test.rb
@@ -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'}
Please sign in to comment.
Something went wrong with that request. Please try again.