| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 008ac37 commit 54635f5
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -75,6 +75,7 @@ const internalBindingWhitelist = new SafeSet([ | |||
| 75 | 75 | 'fs', | |
| 76 | 76 | 'fs_event_wrap', | |
| 77 | 77 | 'http_parser', | |
| 78 | + 'http_parser_llhttp', | ||
| 78 | 79 | 'icu', | |
| 79 | 80 | 'inspector', | |
| 80 | 81 | 'js_stream', | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2,7 +2,6 @@ | |||
| 2 | 2 | ||
| 3 | 3 | 'use strict'; | |
| 4 | 4 | const common = require('../common'); | |
| 5 | - const { internalBinding } = require('internal/test/binding'); | ||
| 6 | 5 | const { getOptionValue } = require('internal/options'); | |
| 7 | 6 | ||
| 8 | 7 | // Monkey patch before requiring anything | |
@@ -16,9 +15,12 @@ class DummyParser { | |||
| 16 | 15 | } | |
| 17 | 16 | DummyParser.REQUEST = Symbol(); | |
| 18 | 17 | ||
| 18 | + // Note: using process.binding instead of internalBinding because this test is | ||
| 19 | + // verifying that user applications are still able to monkey-patch the | ||
| 20 | + // http_parser module. | ||
| 19 | 21 | const binding = | |
| 20 | 22 | getOptionValue('--http-parser') === 'legacy' ? | |
| 21 | - internalBinding('http_parser') : internalBinding('http_parser_llhttp'); | ||
| 23 | + process.binding('http_parser') : process.binding('http_parser_llhttp'); | ||
| 22 | 24 | binding.HTTPParser = DummyParser; | |
| 23 | 25 | ||
| 24 | 26 | const assert = require('assert'); | |
@@ -34,7 +36,9 @@ assert.strictEqual(parser.test_type, DummyParser.REQUEST); | |||
| 34 | 36 | if (process.argv[2] !== 'child') { | |
| 35 | 37 | // Also test in a child process with IPC (specific case of https://github.com/nodejs/node/issues/23716) | |
| 36 | 38 | const child = spawn(process.execPath, [ | |
| 37 | - '--expose-internals', __filename, 'child' | ||
| 39 | + '--expose-internals', | ||
| 40 | + `--http-parser=${getOptionValue('--http-parser')}`, | ||
| 41 | + __filename, 'child' | ||
| 38 | 42 | ], { | |
| 39 | 43 | stdio: ['inherit', 'inherit', 'inherit', 'ipc'] | |
| 40 | 44 | }); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments