提交 be93d94e 编写于 作者: G Guilherme Cavalcanti 提交者: Andrew White

ActionDispatch::Http::URL.normalize_port should not strip port for protocol relative URL.

上级 adcba34c
......@@ -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
......
......@@ -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'}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册