Skip to content

Commit

Permalink
http: clean up HttpParser correctly
Browse files Browse the repository at this point in the history
remove reference to kOnMessageBegin from HttpParser to avoid leaking Server instances in FreeList
  • Loading branch information
sokra committed Jul 8, 2021
1 parent 4de6f20 commit 7ad5787
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/_http_common.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ let debug = require('internal/util/debuglog').debuglog('http', (fn) => {

const kIncomingMessage = Symbol('IncomingMessage');
const kRequestTimeout = Symbol('RequestTimeout');
const kOnMessageBegin = HTTPParser.kOnMessageBegin | 0;
const kOnHeaders = HTTPParser.kOnHeaders | 0;
const kOnHeadersComplete = HTTPParser.kOnHeadersComplete | 0;
const kOnBody = HTTPParser.kOnBody | 0;
Expand Down Expand Up @@ -239,6 +240,7 @@ function cleanParser(parser) {
parser.incoming = null;
parser.outgoing = null;
parser.maxHeaderPairs = MAX_HEADER_PAIRS;
parser[kOnMessageBegin] = null;
parser[kOnExecute] = null;
parser[kOnTimeout] = null;
parser._consumed = false;
Expand Down

0 comments on commit 7ad5787

Please sign in to comment.