method
build_host_url
v7.0.0 -
Show latest stable
- Class:
ActionDispatch::Http::URL
build_host_url(host, port, protocol, options, path)private
No documentation available.
# File actionpack/lib/action_dispatch/http/url.rb, line 105
def build_host_url(host, port, protocol, options, path)
if match = host.match(HOST_REGEXP)
protocol ||= match[1] unless protocol == false
host = match[2]
port = match[3] unless options.key? :port
end
protocol = normalize_protocol protocol
host = normalize_host(host, options)
result = protocol.dup
if options[:user] && options[:password]
result << "#{Rack::Utils.escape(options[:user])}:#{Rack::Utils.escape(options[:password])}@"
end
result << host
normalize_port(port, protocol) { |normalized_port|
result << ":#{normalized_port}"
}
result.concat path
end