Method: Net::HTTPGenericRequest#update_uri
- Defined in:
- lib/net/http/generic_request.rb
#update_uri(addr, port, ssl) ⇒ Object
:nodoc: internal use only
210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 |
# File 'lib/net/http/generic_request.rb', line 210 def update_uri(addr, port, ssl) # :nodoc: internal use only # reflect the connection and @path to @uri return unless @uri if ssl scheme = 'https' klass = URI::HTTPS else scheme = 'http' klass = URI::HTTP end if host = self['host'] host.sub!(/:.*/m, '') 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 |