1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

only pull :protocol from the options hash once

This commit is contained in:
Aaron Patterson 2014-06-11 11:42:49 -07:00
parent aaaff369da
commit ec1caddb7f

View file

@ -73,13 +73,14 @@ module ActionDispatch
end end
def build_host_url(options) def build_host_url(options)
protocol = options[:protocol]
if match = options[:host].match(HOST_REGEXP) if match = options[:host].match(HOST_REGEXP)
options[:protocol] ||= match[1] unless options[:protocol] == false protocol ||= match[1] unless protocol == false
options[:host] = match[2] options[:host] = match[2]
options[:port] = match[3] unless options.key?(:port) options[:port] = match[3] unless options.key?(:port)
end end
protocol = normalize_protocol options[:protocol] protocol = normalize_protocol protocol
options[:host] = normalize_host(options) options[:host] = normalize_host(options)
result = protocol.dup result = protocol.dup