fix: handle paused parser on socket end (issue #5360) by mcollina · Pull Request #5389 · nodejs/undici (original) (raw)
Remove assert(!this.paused) from Parser.finish() so that when the HTTP/1 parser is paused under backpressure (body not consumed) and the socket ends (FIN), the parser can finish gracefully instead of throwing an uncatchable AssertionError from the socket 'end' handler.
llhttp_finish() already handles paused state by returning ERROR.PAUSED, which is handled in the existing code path by setting this.paused = true and returning null.
Fixes nodejs#5360