lib/httpclient/session.rb
# Send a request to the server
Send a request to the server
Send a request to the server
def query(req)
      connect if @state == :INIT
      req.header.request_absolute_uri = !@proxy.nil? and !https?(@dest)
      begin
        Timeout.timeout(@send_timeout, SendTimeoutError) do
          set_header(req)
          req.dump(@socket)
          @socket.flush unless @socket_sync
        end
      rescue Errno::ECONNABORTED, Errno::ECONNRESET, Errno::EPIPE, IOError
        close
        raise KeepAliveDisconnected.new(self)
      rescue HTTPClient::TimeoutError
        close
        raise
      rescue
        close
        if SSLEnabled and $!.is_a?(OpenSSL::SSL::SSLError)
          raise KeepAliveDisconnected.new(self)
        else
          raise
        end
      end
      @state = :META if @state == :WAIT
      @next_connection = nil
      @requests.push(req)
      @last_used = Time.now
    end
def query ( req ) connect if @state == :INIT req . header . request_absolute_uri = ! @proxy . nil? and ! https? ( @dest ) begin Timeout . timeout ( @send_timeout , SendTimeoutError ) do set_header ( req ) req . dump ( @socket ) @socket . flush unless @socket_sync end rescue Errno :: ECONNABORTED , Errno :: ECONNRESET , Errno :: EPIPE , IOError close raise KeepAliveDisconnected . new ( self ) rescue HTTPClient :: TimeoutError close raise rescue close if SSLEnabled and $! . is_a? ( OpenSSL :: SSL :: SSLError ) raise KeepAliveDisconnected . new ( self ) else raise end end @state = :META if @state == :WAIT @next_connection = nil @requests . push ( req ) @last_used = Time . now end
Send a request to the server
Send a request to the server
# Use absolute URI (not absolute path) iif via proxy AND not HTTPS. # flush the IO stream as IO::sync mode is false # JRuby can raise IOError instead of ECONNRESET for now
req
<not_specific>