diff --git a/lib/deceiver.js b/lib/deceiver.js index 7d3b27f..a249571 100644 --- a/lib/deceiver.js +++ b/lib/deceiver.js @@ -21,14 +21,20 @@ var kOnHeadersComplete var kOnMessageComplete var kOnBody if (mode === 'normal' || mode === 'modern') { - HTTPParser = process.binding('http_parser').HTTPParser - methods = HTTPParser.methods + HTTPParser = require('_http_common').HTTPParser + methods = require('_http_common').methods - // v6 - if (!methods) { + // <= v11 + if (!HTTPParser) { + HTTPParser = process.binding('http_parser').HTTPParser methods = process.binding('http_parser').methods } + // <= v5 + if (!methods) { + methods = HTTPParser.methods + } + reverseMethods = {} methods.forEach(function (method, index) {