method
update_uri
v2_2_9 -
Show latest stable
- Class:
Net::HTTPGenericRequest
update_uri(addr, port, ssl)public
No documentation available.
# File lib/net/http/generic_request.rb, line 130
def update_uri(addr, port, ssl) # :nodoc: internal use only
# reflect the connection and @path to @uri
return unless @uri
if ssl
scheme = 'https'.freeze
klass = URI::HTTPS
else
scheme = 'http'.freeze
klass = URI::HTTP
end
if host = self['host']
host.sub!(/:.*/, ''.freeze)
elsif host = @uri.host
else
host = addr
end
# convert the class of the URI
if @uri.is_a?(klass)
@uri.host = host
@uri.port = port
else
@uri = klass.new(
scheme, @uri.userinfo,
host, port, nil,
@uri.path, nil, @uri.query, nil)
end
end