From d16a9e7345add3ff01eae7dd61a686c65c411d2b Mon Sep 17 00:00:00 2001 From: Matteo Collina Date: Wed, 24 Feb 2021 10:53:33 +0100 Subject: [PATCH 1/2] Remove process.binding() --- lib/node/http-parser.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node/http-parser.js b/lib/node/http-parser.js index c6d0fc88b49..f7a2a3a57c9 100644 --- a/lib/node/http-parser.js +++ b/lib/node/http-parser.js @@ -1,6 +1,6 @@ 'use strict' // TODO: This is not really allowed by Node but it works for now. -const { HTTPParser } = process.binding('http_parser') // eslint-disable-line +const { HTTPParser } = require('_http_common') module.exports = HTTPParser From 6aba64754907ce6019d4589b2fef22454bae3143 Mon Sep 17 00:00:00 2001 From: Matteo Collina Date: Wed, 24 Feb 2021 11:00:28 +0100 Subject: [PATCH 2/2] use process.binding if common does not have the HTTPParser --- lib/node/http-parser.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/node/http-parser.js b/lib/node/http-parser.js index f7a2a3a57c9..0039a55559c 100644 --- a/lib/node/http-parser.js +++ b/lib/node/http-parser.js @@ -1,6 +1,11 @@ 'use strict' // TODO: This is not really allowed by Node but it works for now. -const { HTTPParser } = require('_http_common') +const common = require('_http_common') -module.exports = HTTPParser +if (common.HTTPParser) { + module.exports = common.HTTPParser +} else { + // Node 10 + module.exports = process.binding('http_parser').HTTPParser // eslint-disable-line +}