Commit 5ce4eed5 authored by Fedor Indutny's avatar Fedor Indutny Committed by Timothy J Fontaine
Browse files

http: fix parser double-free in _http_client.js

HTTP Parser instance was freed twice, leading to the reusal of it
in several different requests simultaneously.

The flow:

`socketCloseListener` is firing, which calls `socket.read()` to flush
any queued data, `socket.buffer` has data which emits and fires
`socketOnData` in sync, this triggers a parser error which frees the
parser, `socketCloseListener` resumes execution only to have the wrong
parser associated with the socket.

The fix is to only cache the parser after the flushing from the socket,
and to assert in `socketOnData` that `socket === parser.socket`

fix #6451
parent c749a841
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment