lib/rack/handler/ftw.rb in ftw-0.0.38 vs lib/rack/handler/ftw.rb in ftw-0.0.39
- old
+ new
@@ -125,20 +125,24 @@
request = read_http_message(connection)
rescue IOError, EOFError, Errno::EPIPE, Errno::ECONNRESET, HTTP::Parser::Error
# Connection EOF'd or errored before we finished reading a full HTTP
# message, shut it down.
break
+ rescue ArgumentError
+ # Invalid http request sent
+ break
end
begin
handle_request(request, connection)
rescue => e
puts e.inspect
puts e.backtrace
raise e
end
end
- connection.disconnect("Fun")
+ ensure
+ connection.disconnect("Closing...")
end # def handle_connection
# Handle a request. This will set up the rack 'env' and invoke the
# application associated with this handler.
def handle_request(request, connection)