diff options
author | Anna Henningsen <anna@addaleax.net> | 2018-11-30 07:39:02 +0100 |
---|---|---|
committer | Daniel Bevenius <daniel.bevenius@gmail.com> | 2018-12-06 05:21:36 +0100 |
commit | aa943d098e0299ea87485a607353d152f5ea5012 (patch) | |
tree | b3f2cd52efc4568d5f7deb6ca99684e2f5d22a62 /test/sequential | |
parent | 7bcbf044ddc864be9d6c711a75f3a33b6a3c652e (diff) | |
download | android-node-v8-aa943d098e0299ea87485a607353d152f5ea5012.tar.gz android-node-v8-aa943d098e0299ea87485a607353d152f5ea5012.tar.bz2 android-node-v8-aa943d098e0299ea87485a607353d152f5ea5012.zip |
http: make parser choice a runtime flag
Add a `--http-parser=llhttp` vs `--http-parser=traditional`
command line switch, to make testing and comparing the new
llhttp-based implementation easier.
PR-URL: https://github.com/nodejs/node/pull/24739
Refs: https://github.com/nodejs/node/issues/24730
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Matheus Marchini <mat@mmarchini.me>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com>
Diffstat (limited to 'test/sequential')
-rw-r--r-- | test/sequential/test-async-wrap-getasyncid.js | 2 | ||||
-rw-r--r-- | test/sequential/test-http-max-http-headers.js | 8 | ||||
-rw-r--r-- | test/sequential/test-http-regr-gh-2928.js | 3 |
3 files changed, 7 insertions, 6 deletions
diff --git a/test/sequential/test-async-wrap-getasyncid.js b/test/sequential/test-async-wrap-getasyncid.js index 16868de558..2ad602e482 100644 --- a/test/sequential/test-async-wrap-getasyncid.js +++ b/test/sequential/test-async-wrap-getasyncid.js @@ -148,7 +148,7 @@ if (common.hasCrypto) { // eslint-disable-line node-core/crypto-check { - const { HTTPParser } = internalBinding('http_parser'); + const { HTTPParser } = require('_http_common'); testInitialized(new HTTPParser(HTTPParser.REQUEST), 'HTTPParser'); } diff --git a/test/sequential/test-http-max-http-headers.js b/test/sequential/test-http-max-http-headers.js index fad7f7d1d6..1dece8beed 100644 --- a/test/sequential/test-http-max-http-headers.js +++ b/test/sequential/test-http-max-http-headers.js @@ -1,11 +1,13 @@ +// Flags: --expose-internals 'use strict'; - -const assert = require('assert'); const common = require('../common'); +const assert = require('assert'); const http = require('http'); const net = require('net'); const MAX = 8 * 1024; // 8KB +const { getOptionValue } = require('internal/options'); + // Verify that we cannot receive more than 8KB of headers. function once(cb) { @@ -27,7 +29,7 @@ function finished(client, callback) { function fillHeaders(headers, currentSize, valid = false) { // llhttp counts actual header name/value sizes, excluding the whitespace and // stripped chars. - if (process.versions.hasOwnProperty('llhttp')) { + if (getOptionValue('--http-parser') === 'llhttp') { // OK, Content-Length, 0, X-CRASH, aaa... headers += 'a'.repeat(MAX - currentSize); } else { diff --git a/test/sequential/test-http-regr-gh-2928.js b/test/sequential/test-http-regr-gh-2928.js index 3794eddaa0..aa2e2bc9ac 100644 --- a/test/sequential/test-http-regr-gh-2928.js +++ b/test/sequential/test-http-regr-gh-2928.js @@ -6,9 +6,8 @@ const common = require('../common'); const assert = require('assert'); const httpCommon = require('_http_common'); -const { internalBinding } = require('internal/test/binding'); const is_reused_symbol = require('internal/freelist').symbols.is_reused_symbol; -const { HTTPParser } = internalBinding('http_parser'); +const { HTTPParser } = require('_http_common'); const net = require('net'); const COUNT = httpCommon.parsers.max + 1; |