method

update_uri

Importance_0
v2_6_3 - Show latest stable - 0 notes - Class: Net::HTTPGenericRequest
update_uri(addr, port, ssl) public

No documentation

This method has no description. You can help the Ruby community by adding new notes.

Hide source
# File lib/net/http/generic_request.rb, line 133
  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
Register or log in to add new notes.