lib/reel/connection.rb
# Read a request object from the connection
Read a request object from the connection
Read a request object from the connection
def request
      return if @request_state == :websocket
      req = Request.read(self)
      case req
      when Request
        @request_state = :body
        @keepalive = false if req[CONNECTION] == CLOSE || req.version == HTTP_VERSION_1_0
      when WebSocket
        @request_state = @response_state = :websocket
        @socket = nil
      else raise "unexpected request type: #{req.class}"
      end
      req
    rescue IOError, Errno::ECONNRESET, Errno::EPIPE
      @request_state = :closed
      @keepalive = false
      nil
    end
def request return if @request_state == :websocket req = Request . read ( self ) case req when Request @request_state = :body @keepalive = false if req [ CONNECTION ] == CLOSE || req . version == HTTP_VERSION_1_0 when WebSocket @request_state = @response_state = :websocket @socket = nil else raise "unexpected request type: #{req.class}" end req rescue IOError , Errno :: ECONNRESET , Errno :: EPIPE @request_state = :closed @keepalive = false nil end
Read a request object from the connection
Read a request object from the connection
# The client is disconnected