diff --git a/lib/_http_common.js b/lib/_http_common.js index 7eb37511bd12c7..ab075dc817ed6f 100644 --- a/lib/_http_common.js +++ b/lib/_http_common.js @@ -191,8 +191,6 @@ function freeParser(parser, req, socket) { if (parser._consumed) parser.unconsume(); parser._consumed = false; - if (parser.socket) - parser.socket.parser = null; parser.socket = null; parser.incoming = null; parser.outgoing = null; diff --git a/lib/_http_server.js b/lib/_http_server.js index 1d6cada3270c01..bf228de643422e 100644 --- a/lib/_http_server.js +++ b/lib/_http_server.js @@ -522,7 +522,7 @@ function onParserExecuteCommon(server, socket, parser, state, ret, d) { socket.removeListener('error', socketOnError); unconsume(parser, socket); parser.finish(); - freeParser(parser, req, null); + freeParser(parser, req, socket); parser = null; var eventName = req.method === 'CONNECT' ? 'connect' : 'upgrade';