# File lib/ftw/request.rb, line 99
  def use_uri(uri)
    # Convert URI objects to Addressable::URI
    case uri
      when URI, String
        uri = Addressable::URI.parse(uri.to_s)
    end

    # TODO(sissel): Use uri.password and uri.user to set Authorization basic
    # stuff.
    if uri.password || uri.user
      encoded = Base64.strict_encode64("#{uri.user}:#{uri.password}")
      @headers.set("Authorization", "Basic #{encoded}")
    end
    # uri.password
    # uri.user
    @request_uri = uri.path
    # Include the query string, too.
    @request_uri += "?#{uri.query}" if !uri.query.nil?

    @headers.set("Host", uri.host)
    @protocol = uri.scheme
    if uri.port.nil?
      # default to port 80
      uri.port = { "http" => 80, "https" => 443 }.fetch(uri.scheme, 80)
    end
    @port = uri.port
    
    # TODO(sissel): support authentication
  end