igrigorik / em-http-request

Asynchronous HTTP Client (EventMachine + Ruby)
1.22k stars 220 forks source link

Also stop the HTTP parser in addition to resetting it. #356

Closed jackorp closed 8 months ago

jackorp commented 11 months ago

The behavior was depending on an exception raised later after resetting the parser and then this resulting in parser not calling any further callback. With http_parser.rb >= 0.6.1 this is no longer true.

Stopping the parser at this point seems correct as it also stops firing additional callbacks from being called.

This solution seems to be OK for http_parser.rb 0.6.0 and 0.8.0 (and I'd guess versions in between) as no new test fails with this fix.

Fixes failure in test suite:

Failure/Error: if !client.continue?
     NoMethodError:
       undefined method `continue?' for nil:NilClass

From `EventMachine::HttpRequest should close connection on invalid HTTP response'.

jackorp commented 8 months ago

Merged as part of https://github.com/igrigorik/em-http-request/pull/357