method
build_host_url
v8.1.1 -
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 203
def build_host_url(host, port, protocol, options, path)
if match = host.match(HOST_REGEXP)
protocol_from_host = match[1] if protocol.nil?
host = match[2]
port = match[3] unless options.key? :port
end
protocol = protocol_from_host || normalize_protocol(protocol).dup
host = normalize_host(host, options)
port = normalize_port(port, protocol)
result = protocol
if options[:user] && options[:password]
result << "#{Rack::Utils.escape(options[:user])}:#{Rack::Utils.escape(options[:password])}@"
end
result << host
result << ":" << port.to_s if port
result.concat path
end