lib/reel/connection.rb in reel-0.5.0 vs lib/reel/connection.rb in reel-0.6.0.pre1

- old
+ new

@@ -54,11 +54,11 @@ def request raise StateError, "already processing a request" if current_request req = @parser.current_request @request_fsm.transition :headers - @keepalive = false if req[CONNECTION] == CLOSE || req.version == HTTP_VERSION_1_0 + @keepalive = false if req.nil? || req[CONNECTION] == CLOSE || req.version == HTTP_VERSION_1_0 @current_request = req req rescue IOError, Errno::ECONNRESET, Errno::EPIPE @request_fsm.transition :closed @@ -118,13 +118,15 @@ else @current_request = nil @parser.reset @request_fsm.transition :closed end - rescue IOError, Errno::ECONNRESET, Errno::EPIPE, RequestError + rescue IOError, SystemCallError, RequestError # The client disconnected early, or there is no request @keepalive = false @request_fsm.transition :closed + @parser.reset + @current_request = nil end # Close the connection def close raise StateError, "socket has been hijacked from this connection" unless @socket