Skip to content

Commit

Permalink
squash! http: make parser choice a runtime flag
Browse files Browse the repository at this point in the history
traditional → legacy
  • Loading branch information
addaleax committed Dec 4, 2018
1 parent 3587d21 commit 9b48c54
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions doc/api/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,9 @@ added: REPLACEME
Chooses an HTTP parser library. Available values are:

- `llhttp` for https://llhttp.org/
- `traditional` for https://github.com/nodejs/http-parser
- `legacy` for https://github.com/nodejs/http-parser

The default is `traditional`, unless otherwise specified when building Node.js.
The default is `legacy`, unless otherwise specified when building Node.js.

### `--icu-data-dir=file`
<!-- YAML
Expand Down
2 changes: 1 addition & 1 deletion doc/node.1
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ Enable experimental worker threads using worker_threads module.
Chooses an HTTP parser library. Available values are
.Sy llhttp
or
.Sy traditional .
.Sy legacy .
.
.It Fl -force-fips
Force FIPS-compliant crypto on startup
Expand Down
2 changes: 1 addition & 1 deletion lib/_http_common.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
const { getOptionValue } = require('internal/options');

const { methods, HTTPParser } =
getOptionValue('--http-parser') === 'traditional' ?
getOptionValue('--http-parser') === 'legacy' ?
internalBinding('http_parser') : internalBinding('http_parser_llhttp');

const { FreeList } = require('internal/freelist');
Expand Down
6 changes: 3 additions & 3 deletions src/node_options.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ void EnvironmentOptions::CheckOptions(std::vector<std::string>* errors) {
errors->push_back("either --check or --eval can be used, not both");
}

if (http_parser != "traditional" && http_parser != "llhttp") {
if (http_parser != "legacy" && http_parser != "llhttp") {
errors->push_back("invalid value for --http-parser");
}

Expand Down Expand Up @@ -108,11 +108,11 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() {
kAllowedInEnvironment);
AddOption("--expose-internals", "", &EnvironmentOptions::expose_internals);
AddOption("--http-parser",
"Select which HTTP parser to use; either 'traditional' or 'llhttp' "
"Select which HTTP parser to use; either 'legacy' or 'llhttp' "
#ifdef NODE_EXPERIMENTAL_HTTP_DEFAULT
"(default: llhttp).",
#else
"(default: traditional).",
"(default: legacy).",
#endif
&EnvironmentOptions::http_parser,
kAllowedInEnvironment);
Expand Down
2 changes: 1 addition & 1 deletion src/node_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class EnvironmentOptions : public Options {
#ifdef NODE_EXPERIMENTAL_HTTP_DEFAULT
"llhttp";
#else
"traditional";
"legacy";
#endif
bool no_deprecation = false;
bool no_force_async_hooks_checks = false;
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-http-parser-lazy-loaded.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class DummyParser {
DummyParser.REQUEST = Symbol();

const binding =
getOptionValue('--http-parser') === 'traditional' ?
getOptionValue('--http-parser') === 'legacy' ?
internalBinding('http_parser') : internalBinding('http_parser_llhttp');
binding.HTTPParser = DummyParser;

Expand Down

0 comments on commit 9b48c54

Please sign in to comment.