-11.1.0
+11.2.0
+11.1.0
11.0.0
@@ -129,10 +125,9 @@ release.
### Notes
-* Release streams marked with `LTS` are currently covered by the
- [Node.js Long Term Support plan](/~https://github.com/nodejs/Release).
-* Release versions displayed in **bold** text represent the most
- recent actively supported release.
+* The [Node.js Long Term Support plan](/~https://github.com/nodejs/Release) covers
+ LTS releases.
+* Release versions in **bold** text are the most recent supported releases.
----
----
diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md
index 5a935352a1f9f0..4c211405596cb4 100644
--- a/CODE_OF_CONDUCT.md
+++ b/CODE_OF_CONDUCT.md
@@ -1,8 +1,4 @@
# Code of Conduct
-The Node.js Code of Conduct document has moved to
-/~https://github.com/nodejs/admin/blob/master/CODE_OF_CONDUCT.md. Please update
-links to this document accordingly.
-
-The Node.js Moderation policy can be found at
-/~https://github.com/nodejs/admin/blob/master/Moderation-Policy.md
+* [Node.js Code of Conduct](/~https://github.com/nodejs/admin/blob/master/CODE_OF_CONDUCT.md)
+* [Node.js Moderation Policy](/~https://github.com/nodejs/admin/blob/master/Moderation-Policy.md)
diff --git a/COLLABORATOR_GUIDE.md b/COLLABORATOR_GUIDE.md
index 7cfc6388c549b5..ec3b0a8bf503fb 100644
--- a/COLLABORATOR_GUIDE.md
+++ b/COLLABORATOR_GUIDE.md
@@ -3,7 +3,6 @@
## Contents
* [Issues and Pull Requests](#issues-and-pull-requests)
- - [Managing Issues and Pull Requests](#managing-issues-and-pull-requests)
- [Welcoming First-Time Contributors](#welcoming-first-time-contributors)
- [Closing Issues and Pull Requests](#closing-issues-and-pull-requests)
- [Author ready pull requests](#author-ready-pull-requests)
@@ -28,7 +27,7 @@
- [Using `git-node`](#using-git-node)
- [Technical HOWTO](#technical-howto)
- [Troubleshooting](#troubleshooting)
- - [I Just Made a Mistake](#i-just-made-a-mistake)
+ - [I Made a Mistake](#i-made-a-mistake)
- [Long Term Support](#long-term-support)
- [What is LTS?](#what-is-lts)
- [How does LTS work?](#how-does-lts-work)
@@ -38,24 +37,16 @@
- [How is an LTS release cut?](#how-is-an-lts-release-cut)
* [Who to CC in the issue tracker](#who-to-cc-in-the-issue-tracker)
-This document contains information for Collaborators of the Node.js
-project regarding managing the project's code, documentation, and issue tracker.
-
-Collaborators should be familiar with the guidelines for new
-contributors in [CONTRIBUTING.md](./CONTRIBUTING.md) and also
-understand the project governance model as outlined in
-[GOVERNANCE.md](./GOVERNANCE.md).
+This document explains how Collaborators manage the Node.js project.
+Collaborators should understand the
+[guidelines for new contributors](CONTRIBUTING.md) and the
+[project governance model](GOVERNANCE.md).
## Issues and Pull Requests
-### Managing Issues and Pull Requests
-
-Collaborators should take full responsibility for managing issues and pull
-requests they feel qualified to handle. Make sure this is done while being
-mindful of these guidelines, the opinions of other Collaborators, and guidance
-of the [TSC][]. They may also notify other qualified parties for more input on
-an issue or a pull request.
-See [Who to CC in the issue tracker](#who-to-cc-in-the-issue-tracker).
+Mind these guidelines, the opinions of other Collaborators, and guidance of the
+[TSC][]. Notify other qualified parties for more input on an issue or a pull
+request. See [Who to CC in the issue tracker](#who-to-cc-in-the-issue-tracker).
### Welcoming First-Time Contributors
@@ -497,7 +488,7 @@ This should be done where a pull request:
Assign the `tsc-review` label or @-mention the
`@nodejs/tsc` GitHub team if you want to elevate an issue to the [TSC][].
-Do not use the GitHub UI on the right hand side to assign to
+Do not use the GitHub UI on the right-hand side to assign to
`@nodejs/tsc` or request a review from `@nodejs/tsc`.
The TSC should serve as the final arbiter where required.
@@ -528,7 +519,7 @@ The TSC should serve as the final arbiter where required.
you are unsure exactly how to format the commit messages, use the commit log
as a reference. See [this commit][commit-example] as an example.
-For PRs from first time contributors, be [welcoming](#welcoming-first-time-contributors).
+For PRs from first-time contributors, be [welcoming](#welcoming-first-time-contributors).
Also, verify that their git settings are to their liking.
All commits should be self-contained, meaning every commit should pass all
@@ -747,7 +738,7 @@ make -j4 test
git push upstream master
```
-### I Just Made a Mistake
+### I Made a Mistake
* Ping a TSC member.
* `#node-dev` on freenode
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 684277980a8ee6..1a3babf8405ea2 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -1,18 +1,5 @@
# Contributing to Node.js
-Contributions to Node.js include code, documentation, answering user questions,
-running the project's infrastructure, and advocating for all types of Node.js
-users.
-
-The Node.js project welcomes all contributions from anyone willing to work in
-good faith with other contributors and the community. No contribution is too
-small and all contributions are valued.
-
-This guide explains the process for contributing to the Node.js project's core
-`nodejs/node` GitHub Repository and describes what to expect at each step.
-
-## Contents
-
* [Code of Conduct](#code-of-conduct)
* [Issues](#issues)
* [Pull Requests](#pull-requests)
@@ -22,16 +9,12 @@ This guide explains the process for contributing to the Node.js project's core
The Node.js project has a
[Code of Conduct](/~https://github.com/nodejs/admin/blob/master/CODE_OF_CONDUCT.md)
-that *all* contributors are expected to follow. This code describes the
-*minimum* behavior expectations for all contributors.
+to which all contributors must adhere.
See [details on our policy on Code of Conduct](./doc/guides/contributing/coc.md).
## [Issues](./doc/guides/contributing/issues.md)
-Issues in `nodejs/node` are the primary means by which bug reports and
-general discussions are made.
-
* [How to Contribute in Issues](./doc/guides/contributing/issues.md#how-to-contribute-in-issues)
* [Asking for General Help](./doc/guides/contributing/issues.md#asking-for-general-help)
* [Discussing non-technical topics](./doc/guides/contributing/issues.md#discussing-non-technical-topics)
@@ -41,14 +24,11 @@ general discussions are made.
## [Pull Requests](./doc/guides/contributing/pull-requests.md)
-Pull Requests are the way concrete changes are made to the code, documentation,
-dependencies, and tools contained in the `nodejs/node` repository.
-
* [Dependencies](./doc/guides/contributing/pull-requests.md#dependencies)
* [Setting up your local environment](./doc/guides/contributing/pull-requests.md#setting-up-your-local-environment)
* [The Process of Making Changes](./doc/guides/contributing/pull-requests.md#the-process-of-making-changes)
* [Reviewing Pull Requests](./doc/guides/contributing/pull-requests.md#reviewing-pull-requests)
-* [Additional Notes](./doc/guides/contributing/pull-requests.md#additional-notes)
+* [Notes](./doc/guides/contributing/pull-requests.md#notes)
## Developer's Certificate of Origin 1.1
diff --git a/GOVERNANCE.md b/GOVERNANCE.md
index 40ef6e7bbe5fcb..d92d3c821e85b3 100644
--- a/GOVERNANCE.md
+++ b/GOVERNANCE.md
@@ -45,7 +45,7 @@ be accepted unless:
* Discussions and/or additional changes result in no Collaborators objecting to
the change. Previously-objecting Collaborators do not necessarily have to
- sign-off on the change, but they should not be opposed to it.
+ sign off on the change, but they should not be opposed to it.
* The change is escalated to the TSC and the TSC votes to approve the change.
This should only happen if disagreements between Collaborators cannot be
resolved through discussion.
@@ -123,8 +123,8 @@ The meeting chair is responsible for ensuring that minutes are taken and that a
pull request with the minutes is submitted after the meeting.
Due to the challenges of scheduling a global meeting with participants in
-several timezones, the TSC will seek to resolve as many agenda items as possible
-outside of meetings using
+several time zones, the TSC will seek to resolve as many agenda items as
+possible outside of meetings using
[the TSC issue tracker](/~https://github.com/nodejs/TSC/issues). The process in
the issue tracker is:
@@ -196,7 +196,7 @@ completed within a month after the nomination is accepted.
## Consensus Seeking Process
-The TSC follows a [Consensus Seeking][] decision making model as described by
+The TSC follows a [Consensus Seeking][] decision-making model as described by
the [TSC Charter][].
[collaborators-discussions]: /~https://github.com/orgs/nodejs/teams/collaborators/discussions
diff --git a/LICENSE b/LICENSE
index b19517094f64db..59958b20e24a06 100644
--- a/LICENSE
+++ b/LICENSE
@@ -606,6 +606,32 @@ The externally maintained libraries used by Node.js are:
n° 289016). Three clause BSD license.
"""
+- llhttp, located at deps/llhttp, is licensed as follows:
+ """
+ This software is licensed under the MIT License.
+
+ Copyright Fedor Indutny, 2018.
+
+ Permission is hereby granted, free of charge, to any person obtaining a
+ copy of this software and associated documentation files (the
+ "Software"), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to permit
+ persons to whom the Software is furnished to do so, subject to the
+ following conditions:
+
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+ NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ USE OR OTHER DEALINGS IN THE SOFTWARE.
+ """
+
- OpenSSL, located at deps/openssl, is licensed as follows:
"""
Copyright (c) 1998-2018 The OpenSSL Project. All rights reserved.
diff --git a/Makefile b/Makefile
index 88be22fcace3ec..7c2afde30a3d28 100644
--- a/Makefile
+++ b/Makefile
@@ -205,7 +205,7 @@ coverage-build: all
if [ ! -d node_modules/nyc ]; then \
$(NODE) ./deps/npm install nyc@13 --no-save --no-package-lock; fi
if [ ! -d gcovr ]; then git clone -b 3.4 --depth=1 \
- --single-branch git://github.com/gcovr/gcovr.git; fi
+ --single-branch /~https://github.com/gcovr/gcovr.git; fi
if [ ! -d build ]; then git clone --depth=1 \
--single-branch /~https://github.com/nodejs/build.git; fi
if [ ! -f gcovr/scripts/gcovr.orig ]; then \
@@ -270,7 +270,7 @@ v8:
tools/make-v8.sh $(V8_ARCH).$(BUILDTYPE_LOWER) $(V8_BUILD_OPTIONS)
.PHONY: jstest
-jstest: build-addons build-addons-napi bench-addons-build ## Runs addon tests and JS tests
+jstest: build-addons build-addons-napi ## Runs addon tests and JS tests
$(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) \
--skip-tests=$(CI_SKIP_TESTS) \
$(CI_JS_SUITES) \
@@ -308,19 +308,19 @@ test-valgrind: all
test-check-deopts: all
$(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) --check-deopts parallel sequential
-benchmark/napi/function_call/build/Release/binding.node: all \
+benchmark/napi/function_call/build/$(BUILDTYPE)/binding.node: \
benchmark/napi/function_call/napi_binding.c \
benchmark/napi/function_call/binding.cc \
- benchmark/napi/function_call/binding.gyp
+ benchmark/napi/function_call/binding.gyp | all
$(NODE) deps/npm/node_modules/node-gyp/bin/node-gyp rebuild \
--python="$(PYTHON)" \
--directory="$(shell pwd)/benchmark/napi/function_call" \
--nodedir="$(shell pwd)"
-benchmark/napi/function_args/build/Release/binding.node: all \
+benchmark/napi/function_args/build/$(BUILDTYPE)/binding.node: \
benchmark/napi/function_args/napi_binding.c \
benchmark/napi/function_args/binding.cc \
- benchmark/napi/function_args/binding.gyp
+ benchmark/napi/function_args/binding.gyp | all
$(NODE) deps/npm/node_modules/node-gyp/bin/node-gyp rebuild \
--python="$(PYTHON)" \
--directory="$(shell pwd)/benchmark/napi/function_args" \
@@ -332,16 +332,16 @@ ifeq ($(OSTYPE),aix)
DOCBUILDSTAMP_PREREQS := $(DOCBUILDSTAMP_PREREQS) out/$(BUILDTYPE)/node.exp
endif
-node_use_openssl = $(shell $(call available-node,"-p" \
- "process.versions.openssl != undefined"))
+node_use_openssl = $(call available-node,"-p" \
+ "process.versions.openssl != undefined")
test/addons/.docbuildstamp: $(DOCBUILDSTAMP_PREREQS) tools/doc/node_modules
-ifeq ($(node_use_openssl),true)
- $(RM) -r test/addons/??_*/
- [ -x $(NODE) ] && $(NODE) $< || node $<
- touch $@
-else
- @echo "Skipping .docbuildstamp (no crypto)"
-endif
+ @if [ "$(shell $(node_use_openssl))" != "true" ]; then \
+ echo "Skipping .docbuildstamp (no crypto)"; \
+ else \
+ $(RM) -r test/addons/??_*/; \
+ [ -x $(NODE) ] && $(NODE) $< || node $< ; \
+ touch $@; \
+ fi
ADDONS_BINDING_GYPS := \
$(filter-out test/addons/??_*/binding.gyp, \
@@ -414,7 +414,7 @@ clear-stalled:
echo $${PS_OUT} | xargs kill -9; \
fi
-test-build: | all build-addons build-addons-napi bench-addons-build
+test-build: | all build-addons build-addons-napi
test-build-addons-napi: all build-addons-napi
@@ -496,7 +496,10 @@ test-debug: test-build
test-message: test-build
$(PYTHON) tools/test.py $(PARALLEL_ARGS) message
-test-simple: | cctest bench-addons-build # Depends on 'all'.
+test-wpt: all
+ $(PYTHON) tools/test.py $(PARALLEL_ARGS) wpt
+
+test-simple: | cctest # Depends on 'all'.
$(PYTHON) tools/test.py $(PARALLEL_ARGS) parallel sequential
test-pummel: all
@@ -509,6 +512,9 @@ test-node-inspect: $(NODE_EXE)
USE_EMBEDDED_NODE_INSPECT=1 $(NODE) tools/test-npm-package \
--install deps/node-inspect test
+test-benchmark: | bench-addons-build
+ $(PYTHON) tools/test.py $(PARALLEL_ARGS) benchmark
+
test-tick-processor: all
$(PYTHON) tools/test.py $(PARALLEL_ARGS) tick-processor
@@ -609,11 +615,11 @@ apidocs_json = $(addprefix out/,$(apidoc_sources:.md=.json))
apiassets = $(subst api_assets,api/assets,$(addprefix out/,$(wildcard doc/api_assets/*)))
tools/doc/node_modules: tools/doc/package.json
-ifeq ($(node_use_openssl),true)
- cd tools/doc && $(call available-node,$(run-npm-ci))
-else
- @echo "Skipping tools/doc/node_modules (no crypto)"
-endif
+ @if [ "$(shell $(node_use_openssl))" != "true" ]; then \
+ echo "Skipping tools/doc/node_modules (no crypto)"; \
+ else \
+ cd tools/doc && $(call available-node,$(run-npm-ci)) \
+ fi
.PHONY: doc-only
doc-only: tools/doc/node_modules \
@@ -1044,8 +1050,8 @@ bench: bench-addons-build
# Build required addons for benchmark before running it.
.PHONY: bench-addons-build
-bench-addons-build: benchmark/napi/function_call/build/Release/binding.node \
- benchmark/napi/function_args/build/Release/binding.node
+bench-addons-build: benchmark/napi/function_call/build/$(BUILDTYPE)/binding.node \
+ benchmark/napi/function_args/build/$(BUILDTYPE)/binding.node
.PHONY: bench-addons-clean
bench-addons-clean:
diff --git a/README.md b/README.md
index 671e5321450c7e..533b36bf8dbd58 100644
--- a/README.md
+++ b/README.md
@@ -159,43 +159,8 @@ source and a list of supported platforms.
## Security
-If you find a security vulnerability in Node.js, please report it to
-security@nodejs.org. Please withhold public disclosure until after the security
-team has addressed the vulnerability.
-
-The security team will acknowledge your email within 24 hours. You will receive
-a more detailed response within 48 hours.
-
-There are no hard and fast rules to determine if a bug is worth reporting as a
-security issue. Here are some examples of past issues and what the Security
-Response Team thinks of them. When in doubt, please do send us a report
-nonetheless.
-
-
-### Public disclosure preferred
-
-- [#14519](/~https://github.com/nodejs/node/issues/14519): _Internal domain
- function can be used to cause segfaults_. Requires the ability to execute
- arbitrary JavaScript code. That is already the highest level of privilege
- possible.
-
-### Private disclosure preferred
-
-- [CVE-2016-7099](https://nodejs.org/en/blog/vulnerability/september-2016-security-releases/):
- _Fix invalid wildcard certificate validation check_. This was a high-severity
- defect. It caused Node.js TLS clients to accept invalid wildcard certificates.
-
-- [#5507](/~https://github.com/nodejs/node/pull/5507): _Fix a defect that makes
- the CacheBleed Attack possible_. Many, though not all, OpenSSL vulnerabilities
- in the TLS/SSL protocols also affect Node.js.
-
-- [CVE-2016-2216](https://nodejs.org/en/blog/vulnerability/february-2016-security-releases/):
- _Fix defects in HTTP header parsing for requests and responses that can allow
- response splitting_. This was a remotely-exploitable defect in the Node.js
- HTTP implementation.
-
-When in doubt, please do send us a report.
-
+For information on reporting security vulnerabilities in Node.js, see
+[SECURITY.md](./SECURITY.md).
## Current Project Team Members
@@ -436,10 +401,14 @@ For information about the governance of the Node.js project, see
**Alexis Campailla** <orangemocha@nodejs.org>
* [othiym23](/~https://github.com/othiym23) -
**Forrest L Norvell** <ogd@aoaioxxysz.net> (he/him)
+* [oyyd](/~https://github.com/oyyd) -
+**Ouyang Yadong** <oyydoibh@gmail.com> (he/him)
* [pmq20](/~https://github.com/pmq20) -
**Minqi Pan** <pmq2001@gmail.com>
* [princejwesley](/~https://github.com/princejwesley) -
**Prince John Wesley** <princejohnwesley@gmail.com>
+* [psmarshall](/~https://github.com/psmarshall) -
+**Peter Marshall** <petermarshall@chromium.org> (he/him)
* [Qard](/~https://github.com/Qard) -
**Stephen Belanger** <admin@stephenbelanger.com> (he/him)
* [refack](/~https://github.com/refack) -
@@ -468,6 +437,8 @@ For information about the governance of the Node.js project, see
**Nikolai Vavilov** <vvnicholas@gmail.com>
* [shigeki](/~https://github.com/shigeki) -
**Shigeki Ohtsu** <ohtsu@ohtsu.org> (he/him)
+* [shisama](/~https://github.com/shisama) -
+**Masashi Hirano** <shisama07@gmail.com> (he/him)
* [silverwind](/~https://github.com/silverwind) -
**Roman Reiss** <me@silverwind.io>
* [srl295](/~https://github.com/srl295) -
diff --git a/SECURITY.md b/SECURITY.md
new file mode 100644
index 00000000000000..5f1e3e2cc7d563
--- /dev/null
+++ b/SECURITY.md
@@ -0,0 +1,37 @@
+# Security
+
+If you find a security vulnerability in Node.js, please report it to
+security@nodejs.org. Please withhold public disclosure until after the security
+team has addressed the vulnerability.
+
+The security team will acknowledge your email within 24 hours. You will receive
+a more detailed response within 48 hours.
+
+There are no hard and fast rules to determine if a bug is worth reporting as a
+security issue. Here are some examples of past issues and what the Security
+Response Team thinks of them. When in doubt, please do send us a report
+nonetheless.
+
+## Public disclosure preferred
+
+- [#14519](/~https://github.com/nodejs/node/issues/14519): _Internal domain
+ function can be used to cause segfaults_. Requires the ability to execute
+ arbitrary JavaScript code. That is already the highest level of privilege
+ possible.
+
+## Private disclosure preferred
+
+- [CVE-2016-7099](https://nodejs.org/en/blog/vulnerability/september-2016-security-releases/):
+ _Fix invalid wildcard certificate validation check_. This was a high-severity
+ defect. It caused Node.js TLS clients to accept invalid wildcard certificates.
+
+- [#5507](/~https://github.com/nodejs/node/pull/5507): _Fix a defect that makes
+ the CacheBleed Attack possible_. Many, though not all, OpenSSL vulnerabilities
+ in the TLS/SSL protocols also affect Node.js.
+
+- [CVE-2016-2216](https://nodejs.org/en/blog/vulnerability/february-2016-security-releases/):
+ _Fix defects in HTTP header parsing for requests and responses that can allow
+ response splitting_. This was a remotely-exploitable defect in the Node.js
+ HTTP implementation.
+
+When in doubt, please do send us a report.
diff --git a/benchmark/_http-benchmarkers.js b/benchmark/_http-benchmarkers.js
index baa50f72cde906..f66c36ab1d3d19 100644
--- a/benchmark/_http-benchmarkers.js
+++ b/benchmark/_http-benchmarkers.js
@@ -35,7 +35,7 @@ class AutocannonBenchmarker {
let result;
try {
result = JSON.parse(output);
- } catch (err) {
+ } catch {
return undefined;
}
if (!result || !result.requests || !result.requests.average) {
@@ -106,7 +106,7 @@ class TestDoubleBenchmarker {
let result;
try {
result = JSON.parse(output);
- } catch (err) {
+ } catch {
return undefined;
}
return result.throughput;
diff --git a/benchmark/child_process/child-process-exec-stdout.js b/benchmark/child_process/child-process-exec-stdout.js
index a891026b86971f..88c02533f605c2 100644
--- a/benchmark/child_process/child-process-exec-stdout.js
+++ b/benchmark/child_process/child-process-exec-stdout.js
@@ -30,7 +30,7 @@ function childProcessExecStdout({ dur, len }) {
// Sometimes there's a yes.exe process left hanging around on Windows.
try {
execSync(`taskkill /f /t /pid ${child.pid}`);
- } catch (_) {
+ } catch {
// this is a best effort kill. stderr is piped to parent for tracing.
}
} else {
diff --git a/benchmark/common.js b/benchmark/common.js
index 79aef5a55f9bcd..c76831b573dde6 100644
--- a/benchmark/common.js
+++ b/benchmark/common.js
@@ -3,6 +3,8 @@
const child_process = require('child_process');
const http_benchmarkers = require('./_http-benchmarkers.js');
+exports.buildType = process.features.debug ? 'Debug' : 'Release';
+
exports.createBenchmark = function(fn, configs, options) {
return new Benchmark(fn, configs, options);
};
diff --git a/benchmark/fixtures/require-cachable.js b/benchmark/fixtures/require-cachable.js
new file mode 100644
index 00000000000000..f651728dc78f35
--- /dev/null
+++ b/benchmark/fixtures/require-cachable.js
@@ -0,0 +1,13 @@
+'use strict';
+
+const list = require('internal/bootstrap/cache');
+const {
+ isMainThread
+} = require('worker_threads');
+
+for (const key of list.cachableBuiltins) {
+ if (!isMainThread && key === 'trace_events') {
+ continue;
+ }
+ require(key);
+}
diff --git a/benchmark/fs/bench-readdir.js b/benchmark/fs/bench-readdir.js
index a3e19e242dadbe..0d8ed04856515f 100644
--- a/benchmark/fs/bench-readdir.js
+++ b/benchmark/fs/bench-readdir.js
@@ -5,16 +5,19 @@ const fs = require('fs');
const path = require('path');
const bench = common.createBenchmark(main, {
- n: [1e4],
+ n: [10],
+ dir: [ 'lib', 'test/parallel'],
+ withFileTypes: ['true', 'false']
});
-
-function main({ n }) {
+function main({ n, dir, withFileTypes }) {
+ withFileTypes = withFileTypes === 'true';
+ const fullPath = path.resolve(__dirname, '../../', dir);
bench.start();
(function r(cntr) {
if (cntr-- <= 0)
return bench.end(n);
- fs.readdir(path.resolve(__dirname, '../../lib/'), function() {
+ fs.readdir(fullPath, { withFileTypes }, function() {
r(cntr);
});
}(n));
diff --git a/benchmark/fs/bench-readdirSync.js b/benchmark/fs/bench-readdirSync.js
index ef3327163e8c22..5d0e97399a33ff 100644
--- a/benchmark/fs/bench-readdirSync.js
+++ b/benchmark/fs/bench-readdirSync.js
@@ -5,14 +5,18 @@ const fs = require('fs');
const path = require('path');
const bench = common.createBenchmark(main, {
- n: [1e4],
+ n: [10],
+ dir: [ 'lib', 'test/parallel'],
+ withFileTypes: ['true', 'false']
});
-function main({ n }) {
+function main({ n, dir, withFileTypes }) {
+ withFileTypes = withFileTypes === 'true';
+ const fullPath = path.resolve(__dirname, '../../', dir);
bench.start();
for (var i = 0; i < n; i++) {
- fs.readdirSync(path.resolve(__dirname, '../../lib/'));
+ fs.readdirSync(fullPath, { withFileTypes });
}
bench.end(n);
}
diff --git a/benchmark/fs/read-stream-throughput.js b/benchmark/fs/read-stream-throughput.js
index 3af80132725ec0..7f290a310b592c 100644
--- a/benchmark/fs/read-stream-throughput.js
+++ b/benchmark/fs/read-stream-throughput.js
@@ -55,7 +55,7 @@ function runTest() {
});
rs.on('end', function() {
- try { fs.unlinkSync(filename); } catch (e) {}
+ try { fs.unlinkSync(filename); } catch {}
// MB/sec
bench.end(bytes / (1024 * 1024));
});
@@ -74,7 +74,7 @@ function makeFile() {
buf.fill('x');
}
- try { fs.unlinkSync(filename); } catch (e) {}
+ try { fs.unlinkSync(filename); } catch {}
var w = 1024;
const ws = fs.createWriteStream(filename);
ws.on('close', runTest);
diff --git a/benchmark/fs/readfile-partitioned.js b/benchmark/fs/readfile-partitioned.js
index be3b7fd057bbe0..6e355c158da850 100644
--- a/benchmark/fs/readfile-partitioned.js
+++ b/benchmark/fs/readfile-partitioned.js
@@ -24,7 +24,7 @@ const bench = common.createBenchmark(main, {
function main(conf) {
const len = +conf.len;
- try { fs.unlinkSync(filename); } catch (e) {}
+ try { fs.unlinkSync(filename); } catch {}
var data = Buffer.alloc(len, 'x');
fs.writeFileSync(filename, data);
data = null;
@@ -39,7 +39,7 @@ function main(conf) {
const totalOps = reads + zips;
benchEnded = true;
bench.end(totalOps);
- try { fs.unlinkSync(filename); } catch (e) {}
+ try { fs.unlinkSync(filename); } catch {}
}, +conf.dur * 1000);
function read() {
diff --git a/benchmark/fs/readfile.js b/benchmark/fs/readfile.js
index 282b4ac7621340..36439bdf909f1d 100644
--- a/benchmark/fs/readfile.js
+++ b/benchmark/fs/readfile.js
@@ -17,7 +17,7 @@ const bench = common.createBenchmark(main, {
});
function main({ len, dur, concurrent }) {
- try { fs.unlinkSync(filename); } catch (e) {}
+ try { fs.unlinkSync(filename); } catch {}
var data = Buffer.alloc(len, 'x');
fs.writeFileSync(filename, data);
data = null;
@@ -28,7 +28,7 @@ function main({ len, dur, concurrent }) {
setTimeout(function() {
benchEnded = true;
bench.end(reads);
- try { fs.unlinkSync(filename); } catch (e) {}
+ try { fs.unlinkSync(filename); } catch {}
process.exit(0);
}, dur * 1000);
diff --git a/benchmark/fs/write-stream-throughput.js b/benchmark/fs/write-stream-throughput.js
index 60ad47bc4eabe1..baf98f849fed07 100644
--- a/benchmark/fs/write-stream-throughput.js
+++ b/benchmark/fs/write-stream-throughput.js
@@ -33,7 +33,7 @@ function main({ dur, encodingType, size }) {
throw new Error(`invalid encodingType: ${encodingType}`);
}
- try { fs.unlinkSync(filename); } catch (e) {}
+ try { fs.unlinkSync(filename); } catch {}
var started = false;
var ended = false;
@@ -45,7 +45,7 @@ function main({ dur, encodingType, size }) {
f.on('finish', function() {
ended = true;
const written = fs.statSync(filename).size / 1024;
- try { fs.unlinkSync(filename); } catch (e) {}
+ try { fs.unlinkSync(filename); } catch {}
bench.end(written / 1024);
});
diff --git a/benchmark/http2/headers.js b/benchmark/http2/headers.js
index e2fad2ea02a0ee..f18a73b95e2421 100644
--- a/benchmark/http2/headers.js
+++ b/benchmark/http2/headers.js
@@ -39,8 +39,7 @@ function main({ n, nheaders }) {
function doRequest(remaining) {
const req = client.request(headersObject);
- req.end();
- req.on('data', () => {});
+ req.resume();
req.on('end', () => {
if (remaining > 0) {
doRequest(remaining - 1);
diff --git a/benchmark/http2/respond-with-fd.js b/benchmark/http2/respond-with-fd.js
index 3415a9c69f13ec..35856490f7e4a2 100644
--- a/benchmark/http2/respond-with-fd.js
+++ b/benchmark/http2/respond-with-fd.js
@@ -7,9 +7,9 @@ const fs = require('fs');
const file = path.join(path.resolve(__dirname, '../fixtures'), 'alice.html');
const bench = common.createBenchmark(main, {
- requests: [100, 1000, 10000, 100000],
- streams: [100, 200, 1000],
- clients: [1, 2],
+ requests: [100, 1000, 5000],
+ streams: [1, 10, 20, 40, 100, 200],
+ clients: [2],
benchmarker: ['h2load']
}, { flags: ['--no-warnings'] });
diff --git a/benchmark/http2/simple.js b/benchmark/http2/simple.js
index f4598b81560230..aab7c6b609b715 100644
--- a/benchmark/http2/simple.js
+++ b/benchmark/http2/simple.js
@@ -6,9 +6,9 @@ const fs = require('fs');
const file = path.join(path.resolve(__dirname, '../fixtures'), 'alice.html');
const bench = common.createBenchmark(main, {
- requests: [100, 1000, 10000, 100000],
- streams: [100, 200, 1000],
- clients: [1, 2],
+ requests: [100, 1000, 5000],
+ streams: [1, 10, 20, 40, 100, 200],
+ clients: [2],
benchmarker: ['h2load']
}, { flags: ['--no-warnings'] });
diff --git a/benchmark/misc/punycode.js b/benchmark/misc/punycode.js
index a55660fbc07247..c9eef1f7096fac 100644
--- a/benchmark/misc/punycode.js
+++ b/benchmark/misc/punycode.js
@@ -4,7 +4,7 @@ const common = require('../common.js');
let icu;
try {
icu = common.binding('icu');
-} catch (err) {}
+} catch {}
const punycode = require('punycode');
const bench = common.createBenchmark(main, {
diff --git a/benchmark/misc/startup.js b/benchmark/misc/startup.js
index 703146f081b3c6..1350cd291e2b18 100644
--- a/benchmark/misc/startup.js
+++ b/benchmark/misc/startup.js
@@ -1,36 +1,76 @@
'use strict';
const common = require('../common.js');
-const spawn = require('child_process').spawn;
+const { spawn } = require('child_process');
const path = require('path');
-const emptyJsFile = path.resolve(__dirname, '../../test/fixtures/semicolon.js');
-const bench = common.createBenchmark(startNode, {
- dur: [1]
+let Worker; // Lazy loaded in main
+
+const bench = common.createBenchmark(main, {
+ dur: [1],
+ script: ['benchmark/fixtures/require-cachable', 'test/fixtures/semicolon'],
+ mode: ['process', 'worker']
+}, {
+ flags: ['--expose-internals', '--experimental-worker'] // for workers
});
-function startNode({ dur }) {
- var go = true;
- var starts = 0;
+function spawnProcess(script) {
+ const cmd = process.execPath || process.argv[0];
+ const argv = ['--expose-internals', script];
+ return spawn(cmd, argv);
+}
+
+function spawnWorker(script) {
+ return new Worker(script, { stderr: true, stdout: true });
+}
+
+function start(state, script, bench, getNode) {
+ const node = getNode(script);
+ let stdout = '';
+ let stderr = '';
+
+ node.stdout.on('data', (data) => {
+ stdout += data;
+ });
+
+ node.stderr.on('data', (data) => {
+ stderr += data;
+ });
+
+ node.on('exit', (code) => {
+ if (code !== 0) {
+ console.error('------ stdout ------');
+ console.error(stdout);
+ console.error('------ stderr ------');
+ console.error(stderr);
+ throw new Error(`Error during node startup, exit code ${code}`);
+ }
+ state.throughput++;
+
+ if (state.go) {
+ start(state, script, bench, getNode);
+ } else {
+ bench.end(state.throughput);
+ }
+ });
+}
+
+function main({ dur, script, mode }) {
+ const state = {
+ go: true,
+ throughput: 0
+ };
setTimeout(function() {
- go = false;
+ state.go = false;
}, dur * 1000);
- bench.start();
- start();
-
- function start() {
- const node = spawn(process.execPath || process.argv[0], [emptyJsFile]);
- node.on('exit', function(exitCode) {
- if (exitCode !== 0) {
- throw new Error('Error during node startup');
- }
- starts++;
-
- if (go)
- start();
- else
- bench.end(starts);
- });
+ script = path.resolve(__dirname, '../../', `${script}.js`);
+ if (mode === 'worker') {
+ Worker = require('worker_threads').Worker;
+ bench.start();
+ start(state, script, bench, spawnWorker);
+ } else {
+ bench.start();
+ start(state, script, bench, spawnProcess);
}
}
diff --git a/benchmark/module/module-loader.js b/benchmark/module/module-loader.js
index c79e1a73d4f21a..e780d6376b5e8d 100644
--- a/benchmark/module/module-loader.js
+++ b/benchmark/module/module-loader.js
@@ -14,7 +14,7 @@ const bench = common.createBenchmark(main, {
function main({ n, fullPath, useCache }) {
tmpdir.refresh();
- try { fs.mkdirSync(benchmarkDirectory); } catch (e) {}
+ try { fs.mkdirSync(benchmarkDirectory); } catch {}
for (var i = 0; i <= n; i++) {
fs.mkdirSync(`${benchmarkDirectory}${i}`);
fs.writeFileSync(
diff --git a/benchmark/napi/function_args/binding.cc b/benchmark/napi/function_args/binding.cc
index d0c1a079210532..9f250aaa83db50 100644
--- a/benchmark/napi/function_args/binding.cc
+++ b/benchmark/napi/function_args/binding.cc
@@ -33,7 +33,8 @@ void CallWithArray(const FunctionCallbackInfo& args) {
uint32_t length = array->Length();
for (uint32_t i = 0; i < length; ++ i) {
Local v;
- v = array->Get(i);
+ v = array->Get(args.GetIsolate()->GetCurrentContext(),
+ i).ToLocalChecked();
}
}
}
diff --git a/benchmark/napi/function_args/index.js b/benchmark/napi/function_args/index.js
index 4beab531c17301..df567dcfcc55bc 100644
--- a/benchmark/napi/function_args/index.js
+++ b/benchmark/napi/function_args/index.js
@@ -10,15 +10,15 @@ let v8;
let napi;
try {
- v8 = require('./build/Release/binding');
-} catch (err) {
+ v8 = require(`./build/${common.buildType}/binding`);
+} catch {
console.error(`${__filename}: V8 Binding failed to load`);
process.exit(0);
}
try {
- napi = require('./build/Release/napi_binding');
-} catch (err) {
+ napi = require(`./build/${common.buildType}/napi_binding`);
+} catch {
console.error(`${__filename}: NAPI-Binding failed to load`);
process.exit(0);
}
diff --git a/benchmark/napi/function_call/index.js b/benchmark/napi/function_call/index.js
index cbc512c9729137..59063e500f7a84 100644
--- a/benchmark/napi/function_call/index.js
+++ b/benchmark/napi/function_call/index.js
@@ -12,8 +12,8 @@ const common = require('../../common.js');
// abort quietly.
try {
- var binding = require('./build/Release/binding');
-} catch (er) {
+ var binding = require(`./build/${common.buildType}/binding`);
+} catch {
console.error('misc/function_call.js Binding failed to load');
process.exit(0);
}
@@ -21,8 +21,8 @@ const cxx = binding.hello;
let napi_binding;
try {
- napi_binding = require('./build/Release/napi_binding');
-} catch (er) {
+ napi_binding = require(`./build/${common.buildType}/napi_binding`);
+} catch {
console.error('misc/function_call/index.js NAPI-Binding failed to load');
process.exit(0);
}
diff --git a/common.gypi b/common.gypi
index bacd496538a383..4b732704ba2618 100644
--- a/common.gypi
+++ b/common.gypi
@@ -28,12 +28,9 @@
'openssl_fips%': '',
- # Default to -O0 for debug builds.
- 'v8_optimized_debug%': 0,
-
# Reset this number to 0 on major V8 upgrades.
# Increment by one for each non-official patch applied to deps/v8.
- 'v8_embedder_string': '-node.7',
+ 'v8_embedder_string': '-node.11',
# Enable disassembler for `--print-code` v8 options
'v8_enable_disassembler': 1,
@@ -53,6 +50,12 @@
'icu_use_data_file_flag%': 0,
'conditions': [
+ ['target_arch=="arm64"', {
+ # Disabled pending /~https://github.com/nodejs/node/issues/23913.
+ 'openssl_no_asm%': 1,
+ }, {
+ 'openssl_no_asm%': 0,
+ }],
['GENERATOR=="ninja"', {
'obj_dir': '<(PRODUCT_DIR)/obj',
'conditions': [
diff --git a/configure.py b/configure.py
index 5bc53630f3985b..065e31fd9cac51 100755
--- a/configure.py
+++ b/configure.py
@@ -182,6 +182,11 @@
help='Use the specified path to system CA (PEM format) in addition to '
'the OpenSSL supplied CA store or compiled-in Mozilla CA copy.')
+parser.add_option('--experimental-http-parser',
+ action='store_true',
+ dest='experimental_http_parser',
+ help='use llhttp instead of http_parser')
+
shared_optgroup.add_option('--shared-http-parser',
action='store_true',
dest='shared_http_parser',
@@ -566,6 +571,12 @@
default=False,
help='get more output from this script')
+parser.add_option('--v8-non-optimized-debug',
+ action='store_true',
+ dest='v8_non_optimized_debug',
+ default=False,
+ help='compile V8 with minimal optimizations and with runtime checks')
+
# Create compile_commands.json in out/Debug and out/Release.
parser.add_option('-C',
action='store_true',
@@ -1100,6 +1111,9 @@ def configure_node(o):
else:
o['variables']['node_target_type'] = 'executable'
+ o['variables']['node_experimental_http_parser'] = \
+ b(options.experimental_http_parser)
+
def configure_library(lib, output):
shared_lib = 'shared_' + lib
output['variables']['node_' + shared_lib] = b(getattr(options, shared_lib))
@@ -1138,7 +1152,7 @@ def configure_library(lib, output):
def configure_v8(o):
o['variables']['v8_enable_gdbjit'] = 1 if options.gdb else 0
o['variables']['v8_no_strict_aliasing'] = 1 # Work around compiler bugs.
- o['variables']['v8_optimized_debug'] = 0 # Compile with -O0 in debug builds.
+ o['variables']['v8_optimized_debug'] = 0 if options.v8_non_optimized_debug else 1
o['variables']['v8_random_seed'] = 0 # Use a random seed for hash tables.
o['variables']['v8_promise_internal_field_count'] = 1 # Add internal field to promises for async hooks.
o['variables']['v8_use_snapshot'] = 'false' if options.without_snapshot else 'true'
@@ -1169,9 +1183,11 @@ def configure_openssl(o):
variables = o['variables']
variables['node_use_openssl'] = b(not options.without_ssl)
variables['node_shared_openssl'] = b(options.shared_openssl)
- variables['openssl_no_asm'] = 1 if options.openssl_no_asm else 0
variables['openssl_fips'] = ''
+ if options.openssl_no_asm:
+ variables['openssl_no_asm'] = 1
+
if options.without_ssl:
def without_ssl_error(option):
error('--without-ssl is incompatible with %s' % option)
diff --git a/deps/cares/LICENSE.md b/deps/cares/LICENSE.md
index 86b520b91d3705..ad6bb52b729ed4 100644
--- a/deps/cares/LICENSE.md
+++ b/deps/cares/LICENSE.md
@@ -1,6 +1,6 @@
# c-ares license
-Copyright (c) 2007 - 2016, Daniel Stenberg with many contributors, see AUTHORS
+Copyright (c) 2007 - 2018, Daniel Stenberg with many contributors, see AUTHORS
file.
Copyright 1998 by the Massachusetts Institute of Technology.
diff --git a/deps/cares/Makefile b/deps/cares/Makefile
deleted file mode 100644
index 069c67e542fa74..00000000000000
--- a/deps/cares/Makefile
+++ /dev/null
@@ -1,53 +0,0 @@
-# Copyright Joyent, Inc. and other Node contributors. All rights reserved.
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to
-# deal in the Software without restriction, including without limitation the
-# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-# sell copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-# IN THE SOFTWARE.
-
-SRCDIR ?= $(CURDIR)
-
-ifeq (,$(builddir_name))
-
-VPATH := $(SRCDIR)
-include $(SRCDIR)/build.mk
-
-else # Out of tree build.
-
-# Drop all built-in rules.
-.SUFFIXES:
-
-.PHONY: $(builddir_name)
-$(builddir_name): $(builddir_name)/.buildstamp
- $(MAKE) -C $@ -f $(CURDIR)/Makefile $(MAKECMDGOALS) \
- SRCDIR=$(CURDIR) builddir_name=
-
-$(builddir_name)/.buildstamp:
- mkdir -p $(dir $@)
- touch $@
-
-# Add no-op rules for Makefiles to stop make from trying to rebuild them.
-Makefile:: ;
-%.mk:: ;
-
-# Turn everything else into a no-op rule that depends on the build directory.
-%:: $(builddir_name) ;
-
-.PHONY: clean
-clean:
- $(RM) -fr $(builddir_name)
-
-endif
diff --git a/deps/cares/android-configure b/deps/cares/android-configure
deleted file mode 100755
index 5299e5c718a9bd..00000000000000
--- a/deps/cares/android-configure
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/bin/bash
-
-export TOOLCHAIN=$PWD/android-toolchain
-mkdir -p $TOOLCHAIN
-$1/build/tools/make-standalone-toolchain.sh \
- --toolchain=arm-linux-androideabi-4.7 \
- --arch=arm \
- --install-dir=$TOOLCHAIN \
- --platform=android-9
-export PATH=$TOOLCHAIN/bin:$PATH
-export AR=arm-linux-androideabi-ar
-export CC=arm-linux-androideabi-gcc
-export CXX=arm-linux-androideabi-g++
-export LINK=arm-linux-androideabi-g++
-export PLATFORM=android
-export OS=android
-
-if [ $2 -a $2 == 'gyp' ]
- then
- ./gyp_cares -DOS=android -Dtarget_arch=arm
-fi
diff --git a/deps/cares/build.mk b/deps/cares/build.mk
deleted file mode 100644
index 91af512721ce8d..00000000000000
--- a/deps/cares/build.mk
+++ /dev/null
@@ -1,147 +0,0 @@
-# Copyright Joyent, Inc. and other Node contributors. All rights reserved.
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to
-# deal in the Software without restriction, including without limitation the
-# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-# sell copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-# IN THE SOFTWARE.
-
-OS ?= $(shell sh -c 'uname -s | tr "[A-Z]" "[a-z]"')
-
-OBJS= \
- src/ares_cancel.o \
- src/ares__close_sockets.o \
- src/ares_create_query.o \
- src/ares_data.o \
- src/ares_destroy.o \
- src/ares_expand_name.o \
- src/ares_expand_string.o \
- src/ares_fds.o \
- src/ares_free_hostent.o \
- src/ares_free_string.o \
- src/ares_gethostbyaddr.o \
- src/ares_gethostbyname.o \
- src/ares__get_hostent.o \
- src/ares_getnameinfo.o \
- src/ares_getopt.o \
- src/ares_getsock.o \
- src/ares_init.o \
- src/ares_library_init.o \
- src/ares_llist.o \
- src/ares_mkquery.o \
- src/ares_nowarn.o \
- src/ares_options.o \
- src/ares_parse_aaaa_reply.o \
- src/ares_parse_a_reply.o \
- src/ares_parse_mx_reply.o \
- src/ares_parse_naptr_reply.o \
- src/ares_parse_ns_reply.o \
- src/ares_parse_ptr_reply.o \
- src/ares_parse_soa_reply.o \
- src/ares_parse_srv_reply.o \
- src/ares_parse_txt_reply.o \
- src/ares_process.o \
- src/ares_query.o \
- src/ares__read_line.o \
- src/ares_search.o \
- src/ares_send.o \
- src/ares_strcasecmp.o \
- src/ares_strdup.o \
- src/ares_strerror.o \
- src/ares_timeout.o \
- src/ares__timeval.o \
- src/ares_version.o \
- src/ares_writev.o \
- src/bitncmp.o \
- src/inet_net_pton.o \
- src/inet_ntop.o \
-
-CFLAGS += -I. -I$(SRCDIR)/include -DHAVE_CONFIG_H
-
-ARES_CONFIG_OS = $(OS)
-SOEXT = so
-
-# if on windows
-ifneq (,$(findstring mingw,$(OS)))
-ARES_CONFIG_OS = win32
-OBJS += src/windows_port.o
-OBJS += src/ares_getenv.o
-OBJS += src/ares_platform.o
-
-LDFLAGS += -lws2_32.lib -liphlpapi.lib
-else # else a posix system
-CFLAGS += -g --std=gnu89 -pedantic
-CFLAGS += -Wall -Wextra -Wno-unused-parameter
-CFLAGS += -D_LARGEFILE_SOURCE
-CFLAGS += -D_FILE_OFFSET_BITS=64
-endif
-
-ifneq (,$(findstring cygwin,$(OS)))
-ARES_CONFIG_OS = cygwin
-CFLAGS += -D_GNU_SOURCE
-endif
-
-ifeq (dragonflybsd,$(OS))
-ARES_CONFIG_OS = freebsd
-endif
-
-ifeq (darwin,$(OS))
-CFLAGS += -D_DARWIN_USE_64_BIT_INODE=1
-LDFLAGS += -dynamiclib -install_name "@rpath/libcares.dylib"
-SOEXT = dylib
-endif
-
-ifeq (linux,$(OS))
-CFLAGS += -D_GNU_SOURCE
-endif
-
-ifeq (android,$(OS))
-CFLAGS += -D_GNU_SOURCE
-endif
-
-ifeq (sunos,$(OS))
-LDFLAGS += -lsocket -lnsl
-CFLAGS += -D__EXTENSIONS__ -D_XOPEN_SOURCE=500
-endif
-
-CFLAGS += -I$(SRCDIR)/config/$(ARES_CONFIG_OS)
-
-ifneq (,$(findstring libcares.$(SOEXT),$(MAKECMDGOALS)))
-CFLAGS += -DCARES_BUILDING_LIBRARY
-else
-CFLAGS += -DCARES_STATICLIB
-endif
-
-all: libcares.a
-
-src/.buildstamp:
- mkdir -p $(dir $@)
- touch $@
-
-libcares.a: $(OBJS)
- $(AR) rcs $@ $^
-
-libcares.$(SOEXT): override CFLAGS += -fPIC
-libcares.$(SOEXT): $(OBJS:%.o=%.pic.o)
- $(CC) -shared -o $@ $^ $(LDFLAGS)
-
-src/%.o src/%.pic.o: src/%.c include/ares.h include/ares_version.h \
- include/nameser.h src/.buildstamp \
- $(SRCDIR)/config/$(ARES_CONFIG_OS)/ares_config.h
- $(CC) $(CFLAGS) -c $< -o $@
-
-.PHONY: clean
-clean:
- $(RM) -f libcares.a libcares.$(SOEXT) src/*.o src/.buildstamp
diff --git a/deps/cares/build/gcc_version.py b/deps/cares/build/gcc_version.py
deleted file mode 100644
index da019e866114b0..00000000000000
--- a/deps/cares/build/gcc_version.py
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/usr/bin/env python
-
-import os
-import re
-import subprocess
-import sys
-
-
-def DoMain(*args):
- cc = os.environ.get('CC', 'gcc')
- stdin, stderr = os.pipe()
- subprocess.call([cc, '-v'], stderr=stderr)
- output = os.read(stdin, 4096)
- match = re.search("\ngcc version (\d+\.\d+\.\d+)", output)
- if match:
- print(match.group(1))
-
-
-if __name__ == '__main__':
- DoMain(*sys.argv)
diff --git a/deps/cares/cares.gyp b/deps/cares/cares.gyp
index fce52acb31f495..be7931f7743db1 100644
--- a/deps/cares/cares.gyp
+++ b/deps/cares/cares.gyp
@@ -35,7 +35,6 @@
'include_dirs': [ 'include' ]
},
'sources': [
- 'common.gypi',
'include/ares.h',
'include/ares_rules.h',
'include/ares_version.h',
@@ -93,6 +92,7 @@
'src/ares_strdup.c',
'src/ares_strdup.h',
'src/ares_strerror.c',
+ 'src/ares_strsplit.c',
'src/ares_timeout.c',
'src/ares__timeval.c',
'src/ares_version.c',
diff --git a/deps/cares/common.gypi b/deps/cares/common.gypi
deleted file mode 100644
index 609ad62a3965d0..00000000000000
--- a/deps/cares/common.gypi
+++ /dev/null
@@ -1,172 +0,0 @@
-{
- 'variables': {
- 'visibility%': 'hidden',
- 'library%': 'static_library', # allow override to 'shared_library' for DLL/.so builds
- 'component%': 'static_library',
- 'host_arch%': '',
- 'target_arch%': ''
- },
-
- 'target_defaults': {
- 'default_configuration': 'Debug',
- 'configurations': {
-
- 'Debug': {
- 'defines': [ 'DEBUG', '_DEBUG' ],
- 'cflags': [ '-g', '-O0' ],
- 'msvs_settings': {
- 'VCCLCompilerTool': {
- 'target_conditions': [
- ['library=="static_library"', {
- 'RuntimeLibrary': 1 # static debug
- }, {
- 'RuntimeLibrary': 3 # DLL debug
- }]
- ],
- 'Optimization': 0, # /Od, no optimization
- 'MinimalRebuild': 'false',
- 'OmitFramePointers': 'false',
- 'BasicRuntimeChecks': 3 # /RTC1
- },
- 'VCLinkerTool': {
- 'LinkIncremental': 2 # enable incremental linking
- }
- },
- 'xcode_settings': {
- 'GCC_OPTIMIZATION_LEVEL': '0'
- }
- },
-
- 'Release': {
- 'defines': [ 'NDEBUG' ],
- 'cflags': [
- '-O3',
- '-fomit-frame-pointer',
- '-fdata-sections',
- '-ffunction-sections'
- ],
- 'msvs_settings': {
- 'VCCLCompilerTool': {
- 'target_conditions': [
- ['library=="static_library"', {
- 'RuntimeLibrary': 0, # static release
- }, {
- 'RuntimeLibrary': 2, # debug release
- }],
- ],
- 'Optimization': 3, # /Ox, full optimization
- 'FavorSizeOrSpeed': 1, # /Ot, favour speed over size
- 'InlineFunctionExpansion': 2, # /Ob2, inline anything eligible
- 'WholeProgramOptimization': 'true', # /GL, whole program optimization, needed for LTCG
- 'OmitFramePointers': 'true',
- 'EnableFunctionLevelLinking': 'true',
- 'EnableIntrinsicFunctions': 'true'
- },
- 'VCLibrarianTool': {
- 'AdditionalOptions': [
- '/LTCG' # link time code generation
- ]
- },
- 'VCLinkerTool': {
- 'LinkTimeCodeGeneration': 1, # link-time code generation
- 'OptimizeReferences': 2, # /OPT:REF
- 'EnableCOMDATFolding': 2, # /OPT:ICF
- 'LinkIncremental': 1 # disable incremental linking
- },
- },
- }
- },
-
- 'msvs_settings': {
- 'VCCLCompilerTool': {
- 'StringPooling': 'true', # pool string literals
- 'DebugInformationFormat': 3, # Generate a PDB
- 'WarningLevel': 3,
- 'BufferSecurityCheck': 'true',
- 'ExceptionHandling': 1, # /EHsc
- 'SuppressStartupBanner': 'true',
- 'WarnAsError': 'false',
- 'AdditionalOptions': [
- '/MP', # compile across multiple CPUs
- ],
- },
- 'VCLinkerTool': {
- 'GenerateDebugInformation': 'true',
- 'RandomizedBaseAddress': 2, # enable ASLR
- 'DataExecutionPrevention': 2, # enable DEP
- 'AllowIsolation': 'true',
- 'SuppressStartupBanner': 'true',
- 'target_conditions': [
- ['_type=="executable"', {
- 'SubSystem': 1, # console executable
- }],
- ],
- },
- },
-
- 'xcode_settings': {
- 'ALWAYS_SEARCH_USER_PATHS': 'NO',
- 'GCC_CW_ASM_SYNTAX': 'NO', # No -fasm-blocks
- 'GCC_ENABLE_CPP_EXCEPTIONS': 'NO', # -fno-exceptions
- 'GCC_ENABLE_CPP_RTTI': 'NO', # -fno-rtti
- 'GCC_ENABLE_PASCAL_STRINGS': 'NO', # No -mpascal-strings
- # GCC_INLINES_ARE_PRIVATE_EXTERN maps to -fvisibility-inlines-hidden
- 'GCC_INLINES_ARE_PRIVATE_EXTERN': 'YES',
- 'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES', # -fvisibility=hidden
- 'GCC_THREADSAFE_STATICS': 'NO', # -fno-threadsafe-statics
- 'GCC_WARN_ABOUT_MISSING_NEWLINE': 'YES', # -Wnewline-eof
- 'PREBINDING': 'NO', # No -Wl,-prebind
- 'USE_HEADERMAP': 'NO',
- 'WARNING_CFLAGS': [
- '-Wall',
- '-Wendif-labels',
- '-W',
- '-Wno-unused-parameter'
- ]
- },
-
- 'conditions': [
- ['OS == "win"', {
- 'msvs_cygwin_shell': 0, # prevent actions from trying to use cygwin
- 'defines': [
- 'WIN32',
- # we don't want VC++ warning us about how dangerous C functions are.
- '_CRT_SECURE_NO_DEPRECATE',
- # ... or that C implementations shouldn't use POSIX names
- '_CRT_NONSTDC_NO_DEPRECATE'
- ],
- }],
-
- [ 'OS in "linux freebsd openbsd solaris android aix"', {
- 'variables': {
- 'gcc_version%': ')'
- },
- 'cflags': [ '-Wall' ],
- 'cflags_cc': [ '-fno-rtti', '-fno-exceptions' ],
- 'conditions': [
- [ 'host_arch != target_arch and target_arch=="ia32"', {
- 'cflags': [ '-m32' ],
- 'ldflags': [ '-m32' ]
- }],
- [ 'OS=="linux"', {
- 'cflags': [ '-ansi' ]
- }],
- [ 'visibility=="hidden" and gcc_version >= "4.0.0"', {
- 'cflags': [ '-fvisibility=hidden' ]
- }],
- ]
- }]
- ],
-
- 'target_conditions': [
- ['_type!="static_library"', {
- 'cflags': [ '-fPIC' ],
- 'xcode_settings': {
- 'GCC_DYNAMIC_NO_PIC': 'NO', # No -mdynamic-no-pic
- # (Equivalent to -fPIC)
- 'OTHER_LDFLAGS': [ '-Wl,-search_paths_first' ]
- }
- }]
- ]
- }
-}
diff --git a/deps/cares/get_ver.awk b/deps/cares/get_ver.awk
deleted file mode 100644
index f9929b73614ba3..00000000000000
--- a/deps/cares/get_ver.awk
+++ /dev/null
@@ -1,26 +0,0 @@
-# ***************************************************************************
-# * Project: c-ares
-# *
-# ***************************************************************************
-# awk script which fetches c-ares version number and string from input
-# file and writes them to STDOUT. Here you can get an awk version for Win32:
-# http://www.gknw.net/development/prgtools/awk-20100523.zip
-#
-BEGIN {
- while ((getline < ARGV[1]) > 0) {
- sub("\r", "") # make MSYS gawk work with CRLF header input.
- if (match ($0, /^#define ARES_COPYRIGHT "[^"]+"$/))
- copyright_string = substr($0, 25, length($0)-25)
- else if (match ($0, /^#define ARES_VERSION_STR "[^"]+"$/))
- version_string = substr($3, 2, length($3)-2)
- else if (match ($0, /^#define ARES_VERSION_MAJOR [0-9]+$/))
- version_major = $3
- else if (match ($0, /^#define ARES_VERSION_MINOR [0-9]+$/))
- version_minor = $3
- else if (match ($0, /^#define ARES_VERSION_PATCH [0-9]+$/))
- version_patch = $3
- }
- print "LIBCARES_VERSION = " version_major "," version_minor "," version_patch
- print "LIBCARES_VERSION_STR = " version_string
- print "LIBCARES_COPYRIGHT_STR = " copyright_string
-}
diff --git a/deps/cares/gyp_cares b/deps/cares/gyp_cares
deleted file mode 100755
index d1f1640e015706..00000000000000
--- a/deps/cares/gyp_cares
+++ /dev/null
@@ -1,98 +0,0 @@
-#!/usr/bin/env python
-
-import glob
-import platform
-import os
-import subprocess
-import sys
-
-CC = os.environ.get('CC', 'cc')
-script_dir = os.path.dirname(__file__)
-cares_root = os.path.normpath(script_dir)
-output_dir = os.path.join(os.path.abspath(cares_root), 'out')
-
-sys.path.insert(0, os.path.join(cares_root, 'build', 'gyp', 'pylib'))
-try:
- import gyp
-except ImportError:
- print('You need to install gyp in build/gyp first. See the README.')
- sys.exit(42)
-
-
-def host_arch():
- machine = platform.machine()
- if machine == 'i386': return 'ia32'
- if machine == 'x86_64': return 'x64'
- if machine.startswith('arm'): return 'arm'
- return machine # Return as-is and hope for the best.
-
-
-def compiler_version():
- proc = subprocess.Popen(CC.split() + ['--version'], stdout=subprocess.PIPE)
- is_clang = 'clang' in proc.communicate()[0].split('\n')[0]
- proc = subprocess.Popen(CC.split() + ['-dumpversion'], stdout=subprocess.PIPE)
- version = proc.communicate()[0].split('.')
- version = map(int, version[:2])
- version = tuple(version)
- return (version, is_clang)
-
-
-def run_gyp(args):
- rc = gyp.main(args)
- if rc != 0:
- print 'Error running GYP'
- sys.exit(rc)
-
-
-if __name__ == '__main__':
- args = sys.argv[1:]
-
- # GYP bug.
- # On msvs it will crash if it gets an absolute path.
- # On Mac/make it will crash if it doesn't get an absolute path.
- if sys.platform == 'win32':
- args.append(os.path.join(cares_root, 'cares.gyp'))
- common_fn = os.path.join(cares_root, 'common.gypi')
- options_fn = os.path.join(cares_root, 'options.gypi')
- # we force vs 2010 over 2008 which would otherwise be the default for gyp
- if not os.environ.get('GYP_MSVS_VERSION'):
- os.environ['GYP_MSVS_VERSION'] = '2010'
- else:
- args.append(os.path.join(os.path.abspath(cares_root), 'cares.gyp'))
- common_fn = os.path.join(os.path.abspath(cares_root), 'common.gypi')
- options_fn = os.path.join(os.path.abspath(cares_root), 'options.gypi')
-
- if os.path.exists(common_fn):
- args.extend(['-I', common_fn])
-
- if os.path.exists(options_fn):
- args.extend(['-I', options_fn])
-
- args.append('--depth=' + cares_root)
-
- # There's a bug with windows which doesn't allow this feature.
- if sys.platform != 'win32':
- if '-f' not in args:
- args.extend('-f make'.split())
- if 'ninja' not in args:
- args.extend(['-Goutput_dir=' + output_dir])
- args.extend(['--generator-output', output_dir])
- (major, minor), is_clang = compiler_version()
- args.append('-Dgcc_version=%d' % (10 * major + minor))
- args.append('-Dclang=%d' % int(is_clang))
-
- if not any(a.startswith('-Dhost_arch=') for a in args):
- args.append('-Dhost_arch=%s' % host_arch())
-
- if not any(a.startswith('-Dtarget_arch=') for a in args):
- args.append('-Dtarget_arch=%s' % host_arch())
-
- if not any(a.startswith('-Dlibrary=') for a in args):
- args.append('-Dlibrary=static_library')
-
- if not any(a.startswith('-Dcomponent=') for a in args):
- args.append('-Dcomponent=static_library')
-
- gyp_args = list(args)
- print gyp_args
- run_gyp(gyp_args)
diff --git a/deps/cares/include/ares.h b/deps/cares/include/ares.h
index 65a82cb5b7eb47..06f60b33304b80 100644
--- a/deps/cares/include/ares.h
+++ b/deps/cares/include/ares.h
@@ -164,6 +164,7 @@ extern "C" {
#define ARES_OPT_ROTATE (1 << 14)
#define ARES_OPT_EDNSPSZ (1 << 15)
#define ARES_OPT_NOROTATE (1 << 16)
+#define ARES_OPT_RESOLVCONF (1 << 17)
/* Nameinfo flag values */
#define ARES_NI_NOFQDN (1 << 0)
@@ -270,6 +271,7 @@ struct ares_options {
struct apattern *sortlist;
int nsort;
int ednspsz;
+ char *resolvconf_path;
};
struct hostent;
diff --git a/deps/cares/include/ares_build.h b/deps/cares/include/ares_build.h
index f5535b38493fcb..5e3ba9f0d8cb0c 100644
--- a/deps/cares/include/ares_build.h
+++ b/deps/cares/include/ares_build.h
@@ -194,16 +194,14 @@
/* Data type definition of ares_ssize_t. */
#ifdef _WIN32
# ifdef _WIN64
- typedef __int64 ares_ssize_t;
+# define CARES_TYPEOF_ARES_SSIZE_T __int64
# else
- typedef long ares_ssize_t;
+# define CARES_TYPEOF_ARES_SSIZE_T long
# endif
#else
-# ifdef CARES_TYPEOF_ARES_SSIZE_T
- typedef CARES_TYPEOF_ARES_SSIZE_T ares_ssize_t;
-# else
- typedef ssize_t ares_ssize_t;
-# endif
+# define CARES_TYPEOF_ARES_SSIZE_T ssize_t
#endif
+typedef CARES_TYPEOF_ARES_SSIZE_T ares_ssize_t;
+
#endif /* __CARES_BUILD_H */
diff --git a/deps/cares/include/ares_rules.h b/deps/cares/include/ares_rules.h
index e617fdc6daaa49..cac23cf2e32db3 100644
--- a/deps/cares/include/ares_rules.h
+++ b/deps/cares/include/ares_rules.h
@@ -83,7 +83,7 @@
/*
* Verify that the size previously defined and expected for
- * ares_socklen_t is actually the the same as the one reported
+ * ares_socklen_t is actually the same as the one reported
* by sizeof() at compile time.
*/
diff --git a/deps/cares/include/ares_version.h b/deps/cares/include/ares_version.h
index 61b2b98a8d3683..3fe5b00a1171c2 100644
--- a/deps/cares/include/ares_version.h
+++ b/deps/cares/include/ares_version.h
@@ -3,15 +3,15 @@
#define ARES__VERSION_H
/* This is the global package copyright */
-#define ARES_COPYRIGHT "2004 - 2017 Daniel Stenberg, ."
+#define ARES_COPYRIGHT "2004 - 2018 Daniel Stenberg, ."
#define ARES_VERSION_MAJOR 1
-#define ARES_VERSION_MINOR 14
+#define ARES_VERSION_MINOR 15
#define ARES_VERSION_PATCH 0
#define ARES_VERSION ((ARES_VERSION_MAJOR<<16)|\
(ARES_VERSION_MINOR<<8)|\
(ARES_VERSION_PATCH))
-#define ARES_VERSION_STR "1.14.0"
+#define ARES_VERSION_STR "1.15.0"
#if (ARES_VERSION >= 0x010700)
# define CARES_HAVE_ARES_LIBRARY_INIT 1
diff --git a/deps/cares/src/RELEASE-NOTES b/deps/cares/src/RELEASE-NOTES
index 91230a325b9a73..62276fdf4e38c6 100644
--- a/deps/cares/src/RELEASE-NOTES
+++ b/deps/cares/src/RELEASE-NOTES
@@ -1,47 +1,43 @@
-c-ares version 1.14.0
+c-ares version 1.15.0
Changes:
- o android: Introduce new ares_library_init_android() call for Oreo support. [5]
+ o Add ares_init_options() configurability for path to resolv.conf file [1]
+ o Ability to exclude building of tools (adig, ahost, acountry) in CMake [3]
+ o Android: Support for domain search suffix [4]
+ o Report ARES_ENOTFOUND for .onion domain names as per RFC7686. [13]
Bug fixes:
-
- o Fix patch for CVE-2017-1000381 to not be overly aggressive. [1]
- o win32: Preserve DNS server order returned by Windows when sorting and exclude
- DNS servers in legacy subnets. [2] [4]
- o win32: Support most recent Visual Studio 2017
- o gethostbyaddr should fail with ECANCELLED not ENOTFOUND when ares_cancel
- is called. [3]
- o win32: Exclude legacy ipv6 subnets [4]
- o android: Applications compiled for Oreo can no longer use
- __system_property_get and must use Java calls to retrieve DNS servers.
- [5] [7]
- o win32: Force use of ANSI functions [6]
- o CMake minimum version is now 3.1
- o ares_gethostbyname.3: fix callback status values [8]
- o docs: Document WSAStartup requirement [9]
- o Fix a typo in init_by_resolv_conf [10]
- o Android JNI code leaks local references in some cases [11]
- o Force using the ANSI versions of WinAPI functions [12]
+ o AIX build fix for trying to include both nameser_compat.h and
+ onameser_compat.h [2]
+ o Windows: Improve DNS suffixes extracting from WinNT registry [5]
+ o Fix modern GCC warnings [6]
+ o Apply the IPv6 server blacklist to all nameserver sources, not just Windows
+ [7]
+ o Fix warnings emitted by MSVC when using -W4 [8]
+ o Prevent changing name servers while queries are outstanding [9]
+ o Harden and rationalize c-ares timeout computation [10]
+ o Distribute ares_android.h [11]
+ o ares_set_servers_csv() on failure should not leave channel in a bad state
+ [12]
+ o Add missing docs to distribution
Thanks go to these friendly people for their efforts and contributions:
-
- AC Thompson, Anna Henningsen, Antonio Tajuelo, Brad House, Brad Spencer,
- Christian Ammer, Daniel Stenberg, David Drysdale, David Hotham, Felix Yan,
- Gergely Nagy, Gregor Jasny, Jakub Hrozek, John Schember,
- Konstantinos Sofokleous, Roman Teterin, Sergey Kolomenkin, Sheel Bedi,
- (18 contributors)
+ @afalin, Andi Schnebinger, Ben Noordhuis, Brad House, Brad Spencer,
+ David Hotham, @flyingdutchman23, John Schember, Ruslan Baratov,
+ Sarat Addepalli, Tobias Nießen (11 contributors)
References to bug reports and discussions on issues:
+ [1] = /~https://github.com/c-ares/c-ares/issues/220
+ [2] = /~https://github.com/c-ares/c-ares/issues/224
+ [3] = /~https://github.com/c-ares/c-ares/issues/200
+ [4] = /~https://github.com/c-ares/c-ares/issues/207
+ [5] = /~https://github.com/c-ares/c-ares/pull/202
+ [6] = /~https://github.com/c-ares/c-ares/pull/201
+ [7] = /~https://github.com/c-ares/c-ares/pull/193
+ [8] = /~https://github.com/c-ares/c-ares/pull/192
+ [9] = /~https://github.com/c-ares/c-ares/pull/191
+ [10] = /~https://github.com/c-ares/c-ares/pull/187
+ [11] = https://c-ares.haxx.se/mail/c-ares-archive-2018-04/0000.shtml
+ [12] = https://c-ares.haxx.se/mail/c-ares-archive-2018-03/0000.shtml
+ [13] = /~https://github.com/c-ares/c-ares/issues/196
- [1] = /~https://github.com/c-ares/c-ares/commit/18ea99
- [2] = /~https://github.com/c-ares/c-ares/issues/150
- [3] = /~https://github.com/c-ares/c-ares/pull/138
- [4] = /~https://github.com/c-ares/c-ares/pull/144
- [5] = /~https://github.com/c-ares/c-ares/pull/148
- [6] = /~https://github.com/c-ares/c-ares/pull/142
- [7] = /~https://github.com/c-ares/c-ares/pull/175
- [8] = https://c-ares.haxx.se/mail/c-ares-archive-2011-06/0012.shtml
- [9] = /~https://github.com/c-ares/c-ares/pull/180
- [10] = /~https://github.com/c-ares/c-ares/pull/160
- [11] = /~https://github.com/c-ares/c-ares/pull/175
- [12] = /~https://github.com/c-ares/c-ares/pull/142
diff --git a/deps/cares/src/ares_android.c b/deps/cares/src/ares_android.c
index ab388110bdeff9..bf77131b58cf84 100644
--- a/deps/cares/src/ares_android.c
+++ b/deps/cares/src/ares_android.c
@@ -30,6 +30,8 @@ static jmethodID android_cm_active_net_mid = NULL;
static jmethodID android_cm_link_props_mid = NULL;
/* LinkProperties.getDnsServers */
static jmethodID android_lp_dns_servers_mid = NULL;
+/* LinkProperties.getDomains */
+static jmethodID android_lp_domains_mid = NULL;
/* List.size */
static jmethodID android_list_size_mid = NULL;
/* List.get */
@@ -139,6 +141,12 @@ int ares_library_init_android(jobject connectivity_manager)
if (android_lp_dns_servers_mid == NULL)
goto cleanup;
+ /* getDomains in API 21. */
+ android_lp_domains_mid = jni_get_method_id(env, obj_cls, "getDomains",
+ "()Ljava/lang/String;");
+ if (android_lp_domains_mid == NULL)
+ goto cleanup;
+
(*env)->DeleteLocalRef(env, obj_cls);
obj_cls = jni_get_class(env, "java/util/List");
if (obj_cls == NULL)
@@ -173,6 +181,7 @@ int ares_library_init_android(jobject connectivity_manager)
android_cm_active_net_mid = NULL;
android_cm_link_props_mid = NULL;
android_lp_dns_servers_mid = NULL;
+ android_lp_domains_mid = NULL;
android_list_size_mid = NULL;
android_list_get_mid = NULL;
android_ia_host_addr_mid = NULL;
@@ -213,6 +222,7 @@ void ares_library_cleanup_android(void)
android_cm_active_net_mid = NULL;
android_cm_link_props_mid = NULL;
android_lp_dns_servers_mid = NULL;
+ android_lp_domains_mid = NULL;
android_list_size_mid = NULL;
android_list_get_mid = NULL;
android_ia_host_addr_mid = NULL;
@@ -341,6 +351,95 @@ char **ares_get_android_server_list(size_t max_servers,
(*android_jvm)->DetachCurrentThread(android_jvm);
return dns_list;
}
+
+char *ares_get_android_search_domains_list(void)
+{
+ JNIEnv *env = NULL;
+ jobject active_network = NULL;
+ jobject link_properties = NULL;
+ jstring domains = NULL;
+ const char *domain;
+ int res;
+ size_t i;
+ size_t cnt = 0;
+ char *domain_list = NULL;
+ int need_detatch = 0;
+
+ if (android_jvm == NULL || android_connectivity_manager == NULL)
+ {
+ return NULL;
+ }
+
+ if (android_cm_active_net_mid == NULL || android_cm_link_props_mid == NULL ||
+ android_lp_domains_mid == NULL)
+ {
+ return NULL;
+ }
+
+ res = (*android_jvm)->GetEnv(android_jvm, (void **)&env, JNI_VERSION_1_6);
+ if (res == JNI_EDETACHED)
+ {
+ env = NULL;
+ res = (*android_jvm)->AttachCurrentThread(android_jvm, &env, NULL);
+ need_detatch = 1;
+ }
+ if (res != JNI_OK || env == NULL)
+ goto done;
+
+ /* JNI below is equivalent to this Java code.
+ import android.content.Context;
+ import android.net.ConnectivityManager;
+ import android.net.LinkProperties;
+
+ ConnectivityManager cm = (ConnectivityManager)this.getApplicationContext()
+ .getSystemService(Context.CONNECTIVITY_SERVICE);
+ Network an = cm.getActiveNetwork();
+ LinkProperties lp = cm.getLinkProperties(an);
+ String domains = lp.getDomains();
+ for (String domain: domains.split(",")) {
+ String d = domain;
+ }
+
+ Note: The JNI ConnectivityManager object and all method IDs were previously
+ initialized in ares_library_init_android.
+ */
+
+ active_network = (*env)->CallObjectMethod(env, android_connectivity_manager,
+ android_cm_active_net_mid);
+ if (active_network == NULL)
+ goto done;
+
+ link_properties =
+ (*env)->CallObjectMethod(env, android_connectivity_manager,
+ android_cm_link_props_mid, active_network);
+ if (link_properties == NULL)
+ goto done;
+
+ /* Get the domains. It is a common separated list of domains to search. */
+ domains = (*env)->CallObjectMethod(env, link_properties,
+ android_lp_domains_mid);
+ if (domains == NULL)
+ goto done;
+
+ /* Split on , */
+ domain = (*env)->GetStringUTFChars(env, domains, 0);
+ domain_list = ares_strdup(domain);
+ (*env)->ReleaseStringUTFChars(env, domains, domain);
+ (*env)->DeleteLocalRef(env, domains);
+
+done:
+ if ((*env)->ExceptionOccurred(env))
+ (*env)->ExceptionClear(env);
+
+ if (link_properties != NULL)
+ (*env)->DeleteLocalRef(env, link_properties);
+ if (active_network != NULL)
+ (*env)->DeleteLocalRef(env, active_network);
+
+ if (need_detatch)
+ (*android_jvm)->DetachCurrentThread(android_jvm);
+ return domain_list;
+}
#else
/* warning: ISO C forbids an empty translation unit */
typedef int dummy_make_iso_compilers_happy;
diff --git a/deps/cares/src/ares_android.h b/deps/cares/src/ares_android.h
index ff520f96e8eacc..93fb75f585057e 100644
--- a/deps/cares/src/ares_android.h
+++ b/deps/cares/src/ares_android.h
@@ -19,6 +19,7 @@
#if defined(ANDROID) || defined(__ANDROID__)
char **ares_get_android_server_list(size_t max_servers, size_t *num_servers);
+char *ares_get_android_search_domains_list(void);
void ares_library_cleanup_android(void);
#endif
diff --git a/deps/cares/src/ares_create_query.c b/deps/cares/src/ares_create_query.c
index 07d7570114403b..1606b1a1004706 100644
--- a/deps/cares/src/ares_create_query.c
+++ b/deps/cares/src/ares_create_query.c
@@ -94,6 +94,10 @@ int ares_create_query(const char *name, int dnsclass, int type,
size_t buflen;
unsigned char *buf;
+ /* Per RFC 7686, reject queries for ".onion" domain names with NXDOMAIN. */
+ if (ares__is_onion_domain(name))
+ return ARES_ENOTFOUND;
+
/* Set our results early, in case we bail out early with an error. */
*buflenp = 0;
*bufp = NULL;
@@ -188,7 +192,7 @@ int ares_create_query(const char *name, int dnsclass, int type,
* specified in RFC 1035 ("To simplify implementations, the total length of
* a domain name (i.e., label octets and label length octets) is restricted
* to 255 octets or less."). */
- if (buflen > (MAXCDNAME + HFIXEDSZ + QFIXEDSZ +
+ if (buflen > (size_t)(MAXCDNAME + HFIXEDSZ + QFIXEDSZ +
(max_udp_size ? EDNSFIXEDSZ : 0))) {
ares_free (buf);
return ARES_EBADNAME;
diff --git a/deps/cares/src/ares_destroy.c b/deps/cares/src/ares_destroy.c
index 8aa42236aecffe..fed2009ab324ff 100644
--- a/deps/cares/src/ares_destroy.c
+++ b/deps/cares/src/ares_destroy.c
@@ -36,6 +36,8 @@ void ares_destroy_options(struct ares_options *options)
ares_free(options->sortlist);
if(options->lookups)
ares_free(options->lookups);
+ if(options->resolvconf_path)
+ ares_free(options->resolvconf_path);
}
void ares_destroy(ares_channel channel)
@@ -44,7 +46,7 @@ void ares_destroy(ares_channel channel)
struct query *query;
struct list_node* list_head;
struct list_node* list_node;
-
+
if (!channel)
return;
@@ -85,6 +87,9 @@ void ares_destroy(ares_channel channel)
if (channel->lookups)
ares_free(channel->lookups);
+ if (channel->resolvconf_path)
+ ares_free(channel->resolvconf_path);
+
ares_free(channel);
}
diff --git a/deps/cares/src/ares_gethostbyname.c b/deps/cares/src/ares_gethostbyname.c
index 7c46d96ceaf214..8187746bb14c7f 100644
--- a/deps/cares/src/ares_gethostbyname.c
+++ b/deps/cares/src/ares_gethostbyname.c
@@ -95,6 +95,13 @@ void ares_gethostbyname(ares_channel channel, const char *name, int family,
return;
}
+ /* Per RFC 7686, reject queries for ".onion" domain names with NXDOMAIN. */
+ if (ares__is_onion_domain(name))
+ {
+ callback(arg, ARES_ENOTFOUND, 0, NULL);
+ return;
+ }
+
if (fake_hostent(name, family, callback, arg))
return;
@@ -339,6 +346,10 @@ static int file_lookup(const char *name, int family, struct hostent **host)
int status;
int error;
+ /* Per RFC 7686, reject queries for ".onion" domain names with NXDOMAIN. */
+ if (ares__is_onion_domain(name))
+ return ARES_ENOTFOUND;
+
#ifdef WIN32
char PATH_HOSTS[MAX_PATH];
win_platform platform;
diff --git a/deps/cares/src/ares_getnameinfo.c b/deps/cares/src/ares_getnameinfo.c
index c77b1f81537834..aa089417060fec 100644
--- a/deps/cares/src/ares_getnameinfo.c
+++ b/deps/cares/src/ares_getnameinfo.c
@@ -440,3 +440,14 @@ STATIC_TESTABLE char *ares_striendstr(const char *s1, const char *s2)
}
return (char *)c1_begin;
}
+
+int ares__is_onion_domain(const char *name)
+{
+ if (ares_striendstr(name, ".onion"))
+ return 1;
+
+ if (ares_striendstr(name, ".onion."))
+ return 1;
+
+ return 0;
+}
diff --git a/deps/cares/src/ares_init.c b/deps/cares/src/ares_init.c
index 90cfcabdd33a9e..c2c00d65237072 100644
--- a/deps/cares/src/ares_init.c
+++ b/deps/cares/src/ares_init.c
@@ -169,6 +169,7 @@ int ares_init_options(ares_channel *channelptr, struct ares_options *options,
channel->sock_config_cb_data = NULL;
channel->sock_funcs = NULL;
channel->sock_func_cb_data = NULL;
+ channel->resolvconf_path = NULL;
channel->last_server = 0;
channel->last_timeout_processed = (time_t)now.tv_sec;
@@ -236,16 +237,14 @@ int ares_init_options(ares_channel *channelptr, struct ares_options *options,
/* Something failed; clean up memory we may have allocated. */
if (channel->servers)
ares_free(channel->servers);
- if (channel->domains)
- {
- for (i = 0; i < channel->ndomains; i++)
- ares_free(channel->domains[i]);
- ares_free(channel->domains);
- }
+ if (channel->ndomains != -1)
+ ares_strsplit_free(channel->domains, channel->ndomains);
if (channel->sortlist)
ares_free(channel->sortlist);
if(channel->lookups)
ares_free(channel->lookups);
+ if(channel->resolvconf_path)
+ ares_free(channel->resolvconf_path);
ares_free(channel);
return status;
}
@@ -299,7 +298,7 @@ int ares_dup(ares_channel *dest, ares_channel src)
(*dest)->sock_func_cb_data = src->sock_func_cb_data;
strncpy((*dest)->local_dev_name, src->local_dev_name,
- sizeof(src->local_dev_name));
+ sizeof((*dest)->local_dev_name));
(*dest)->local_ip4 = src->local_ip4;
memcpy((*dest)->local_ip6, src->local_ip6, sizeof(src->local_ip6));
@@ -354,6 +353,9 @@ int ares_save_options(ares_channel channel, struct ares_options *options,
ARES_OPT_SORTLIST|ARES_OPT_TIMEOUTMS);
(*optmask) |= (channel->rotate ? ARES_OPT_ROTATE : ARES_OPT_NOROTATE);
+ if (channel->resolvconf_path)
+ (*optmask) |= ARES_OPT_RESOLVCONF;
+
/* Copy easy stuff */
options->flags = channel->flags;
@@ -426,6 +428,13 @@ int ares_save_options(ares_channel channel, struct ares_options *options,
}
options->nsort = channel->nsort;
+ /* copy path for resolv.conf file */
+ if (channel->resolvconf_path) {
+ options->resolvconf_path = ares_strdup(channel->resolvconf_path);
+ if (!options->resolvconf_path)
+ return ARES_ENOMEM;
+ }
+
return ARES_SUCCESS;
}
@@ -534,6 +543,14 @@ static int init_by_options(ares_channel channel,
channel->nsort = options->nsort;
}
+ /* Set path for resolv.conf file, if given. */
+ if ((optmask & ARES_OPT_RESOLVCONF) && !channel->resolvconf_path)
+ {
+ channel->resolvconf_path = ares_strdup(options->resolvconf_path);
+ if (!channel->resolvconf_path && options->resolvconf_path)
+ return ARES_ENOMEM;
+ }
+
channel->optmask = optmask;
return ARES_SUCCESS;
@@ -997,63 +1014,6 @@ static int compareAddresses(const void *arg1,
return 0;
}
-/* Validate that the ip address matches the subnet (network base and network
- * mask) specified. Addresses are specified in standard Network Byte Order as
- * 16 bytes, and the netmask is 0 to 128 (bits).
- */
-static int ares_ipv6_subnet_matches(const unsigned char netbase[16],
- unsigned char netmask,
- const unsigned char ipaddr[16])
-{
- unsigned char mask[16] = { 0 };
- unsigned char i;
-
- /* Misuse */
- if (netmask > 128)
- return 0;
-
- /* Quickly set whole bytes */
- memset(mask, 0xFF, netmask / 8);
-
- /* Set remaining bits */
- if(netmask % 8) {
- mask[netmask / 8] = (unsigned char)(0xff << (8 - (netmask % 8)));
- }
-
- for (i=0; i<16; i++) {
- if ((netbase[i] & mask[i]) != (ipaddr[i] & mask[i]))
- return 0;
- }
-
- return 1;
-}
-
-static int ares_ipv6_server_blacklisted(const unsigned char ipaddr[16])
-{
- const struct {
- const char *netbase;
- unsigned char netmask;
- } blacklist[] = {
- /* Deprecated by [RFC3879] in September 2004. Formerly a Site-Local scoped
- * address prefix. Causes known issues on Windows as these are not valid DNS
- * servers. */
- { "fec0::", 10 },
- { NULL, 0 }
- };
- size_t i;
-
- for (i=0; blacklist[i].netbase != NULL; i++) {
- unsigned char netbase[16];
-
- if (ares_inet_pton(AF_INET6, blacklist[i].netbase, netbase) != 1)
- continue;
-
- if (ares_ipv6_subnet_matches(netbase, blacklist[i].netmask, ipaddr))
- return 1;
- }
- return 0;
-}
-
/* There can be multiple routes to "the Internet". And there can be different
* DNS servers associated with each of the interfaces that offer those routes.
* We have to assume that any DNS server can serve any request. But, some DNS
@@ -1257,7 +1217,7 @@ static int get_DNS_AdaptersAddresses(char **outptr)
}
else
{
- addresses[addressesIndex].metric = -1;
+ addresses[addressesIndex].metric = (ULONG)-1;
}
/* Record insertion index to make qsort stable */
@@ -1272,20 +1232,10 @@ static int get_DNS_AdaptersAddresses(char **outptr)
}
else if (namesrvr.sa->sa_family == AF_INET6)
{
- /* Windows apparently always reports some IPv6 DNS servers that
- * prefixed with fec0:0:0:ffff. These ususally do not point to
- * working DNS servers, so we ignore them. */
- if (strncmp(addresses[addressesIndex].text, "fec0:0:0:ffff:", 14) == 0)
- continue;
if (memcmp(&namesrvr.sa6->sin6_addr, &ares_in6addr_any,
sizeof(namesrvr.sa6->sin6_addr)) == 0)
continue;
- if (ares_ipv6_server_blacklisted(
- (const unsigned char *)&namesrvr.sa6->sin6_addr)
- )
- continue;
-
/* Allocate room for another address, if necessary, else skip. */
if(addressesIndex == addressesSize) {
const size_t newSize = addressesSize + 4;
@@ -1309,7 +1259,7 @@ static int get_DNS_AdaptersAddresses(char **outptr)
}
else
{
- addresses[addressesIndex].metric = -1;
+ addresses[addressesIndex].metric = (ULONG)-1;
}
/* Record insertion index to make qsort stable */
@@ -1394,59 +1344,6 @@ static int get_DNS_Windows(char **outptr)
return get_DNS_Registry(outptr);
}
-static void replace_comma_by_space(char* str)
-{
- /* replace ',' by ' ' to coincide with resolv.conf search parameter */
- char *p;
- for (p = str; *p != '\0'; p++)
- {
- if (*p == ',')
- *p = ' ';
- }
-}
-
-/* Search if 'suffix' is containted in the 'searchlist'. Returns true if yes,
- * otherwise false. 'searchlist' is a comma separated list of domain suffixes,
- * 'suffix' is one domain suffix, 'len' is the length of 'suffix'.
- * The search ignores case. E.g.:
- * contains_suffix("abc.def,ghi.jkl", "ghi.JKL") returns true */
-static bool contains_suffix(const char* const searchlist,
- const char* const suffix, const size_t len)
-{
- const char* beg = searchlist;
- const char* end;
- if (!*suffix)
- return true;
- for (;;)
- {
- while (*beg && (ISSPACE(*beg) || (*beg == ',')))
- ++beg;
- if (!*beg)
- return false;
- end = beg;
- while (*end && !ISSPACE(*end) && (*end != ','))
- ++end;
- if (len == (end - beg) && !strnicmp(beg, suffix, len))
- return true;
- beg = end;
- }
-}
-
-/* advances list to the next suffix within a comma separated search list.
- * len is the length of the next suffix. */
-static size_t next_suffix(const char** list, const size_t advance)
-{
- const char* beg = *list + advance;
- const char* end;
- while (*beg && (ISSPACE(*beg) || (*beg == ',')))
- ++beg;
- end = beg;
- while (*end && !ISSPACE(*end) && (*end != ','))
- ++end;
- *list = beg;
- return end - beg;
-}
-
/*
* get_SuffixList_Windows()
*
@@ -1467,8 +1364,6 @@ static int get_SuffixList_Windows(char **outptr)
DWORD keyNameBuffSize;
DWORD keyIdx = 0;
char *p = NULL;
- const char *pp;
- size_t len = 0;
*outptr = NULL;
@@ -1479,11 +1374,26 @@ static int get_SuffixList_Windows(char **outptr)
if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, WIN_NS_NT_KEY, 0,
KEY_READ, &hKey) == ERROR_SUCCESS)
{
- if (get_REG_SZ(hKey, SEARCHLIST_KEY, outptr))
- replace_comma_by_space(*outptr);
+ get_REG_SZ(hKey, SEARCHLIST_KEY, outptr);
+ if (get_REG_SZ(hKey, DOMAIN_KEY, &p))
+ {
+ commajoin(outptr, p);
+ ares_free(p);
+ p = NULL;
+ }
+ RegCloseKey(hKey);
+ }
+
+ if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, WIN_NT_DNSCLIENT, 0,
+ KEY_READ, &hKey) == ERROR_SUCCESS)
+ {
+ if (get_REG_SZ(hKey, SEARCHLIST_KEY, &p))
+ {
+ commajoin(outptr, p);
+ ares_free(p);
+ p = NULL;
+ }
RegCloseKey(hKey);
- if (*outptr)
- return 1;
}
/* 2. Connection Specific Search List composed of:
@@ -1491,45 +1401,53 @@ static int get_SuffixList_Windows(char **outptr)
if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, WIN_DNSCLIENT, 0,
KEY_READ, &hKey) == ERROR_SUCCESS)
{
- get_REG_SZ(hKey, PRIMARYDNSSUFFIX_KEY, outptr);
+ if (get_REG_SZ(hKey, PRIMARYDNSSUFFIX_KEY, &p))
+ {
+ commajoin(outptr, p);
+ ares_free(p);
+ p = NULL;
+ }
RegCloseKey(hKey);
}
- if (!*outptr)
- return 0;
/* b. Interface SearchList, Domain, DhcpDomain */
- if (!RegOpenKeyExA(HKEY_LOCAL_MACHINE, WIN_NS_NT_KEY "\\" INTERFACES_KEY, 0,
+ if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, WIN_NS_NT_KEY "\\" INTERFACES_KEY, 0,
KEY_READ, &hKey) == ERROR_SUCCESS)
- return 0;
- for(;;)
{
- keyNameBuffSize = sizeof(keyName);
- if (RegEnumKeyExA(hKey, keyIdx++, keyName, &keyNameBuffSize,
- 0, NULL, NULL, NULL)
- != ERROR_SUCCESS)
- break;
- if (RegOpenKeyExA(hKey, keyName, 0, KEY_QUERY_VALUE, &hKeyEnum)
- != ERROR_SUCCESS)
- continue;
- if (get_REG_SZ(hKeyEnum, SEARCHLIST_KEY, &p) ||
- get_REG_SZ(hKeyEnum, DOMAIN_KEY, &p) ||
- get_REG_SZ(hKeyEnum, DHCPDOMAIN_KEY, &p))
+ for(;;)
{
+ keyNameBuffSize = sizeof(keyName);
+ if (RegEnumKeyExA(hKey, keyIdx++, keyName, &keyNameBuffSize,
+ 0, NULL, NULL, NULL)
+ != ERROR_SUCCESS)
+ break;
+ if (RegOpenKeyExA(hKey, keyName, 0, KEY_QUERY_VALUE, &hKeyEnum)
+ != ERROR_SUCCESS)
+ continue;
/* p can be comma separated (SearchList) */
- pp = p;
- while ((len = next_suffix(&pp, len)) != 0)
+ if (get_REG_SZ(hKeyEnum, SEARCHLIST_KEY, &p))
{
- if (!contains_suffix(*outptr, pp, len))
- commanjoin(outptr, pp, len);
+ commajoin(outptr, p);
+ ares_free(p);
+ p = NULL;
}
- ares_free(p);
- p = NULL;
+ if (get_REG_SZ(hKeyEnum, DOMAIN_KEY, &p))
+ {
+ commajoin(outptr, p);
+ ares_free(p);
+ p = NULL;
+ }
+ if (get_REG_SZ(hKeyEnum, DHCPDOMAIN_KEY, &p))
+ {
+ commajoin(outptr, p);
+ ares_free(p);
+ p = NULL;
+ }
+ RegCloseKey(hKeyEnum);
}
- RegCloseKey(hKeyEnum);
+ RegCloseKey(hKey);
}
- RegCloseKey(hKey);
- if (*outptr)
- replace_comma_by_space(*outptr);
+
return *outptr != NULL;
}
@@ -1628,6 +1546,7 @@ static int init_by_resolv_conf(ares_channel channel)
char propname[PROP_NAME_MAX];
char propvalue[PROP_VALUE_MAX]="";
char **dns_servers;
+ char *domains;
size_t num_servers;
/* Use the Android connectivity manager to get a list
@@ -1652,6 +1571,12 @@ static int init_by_resolv_conf(ares_channel channel)
}
ares_free(dns_servers);
}
+ if (channel->ndomains == -1)
+ {
+ domains = ares_get_android_search_domains_list();
+ set_search(channel, domains);
+ ares_free(domains);
+ }
# ifdef HAVE___SYSTEM_PROPERTY_GET
/* Old way using the system property still in place as
@@ -1740,6 +1665,7 @@ static int init_by_resolv_conf(ares_channel channel)
size_t linesize;
int error;
int update_domains;
+ const char *resolvconf_path;
/* Don't read resolv.conf and friends if we don't have to */
if (ARES_CONFIG_CHECK(channel))
@@ -1748,7 +1674,14 @@ static int init_by_resolv_conf(ares_channel channel)
/* Only update search domains if they're not already specified */
update_domains = (channel->ndomains == -1);
- fp = fopen(PATH_RESOLV_CONF, "r");
+ /* Support path for resolvconf filename set by ares_init_options */
+ if(channel->resolvconf_path) {
+ resolvconf_path = channel->resolvconf_path;
+ } else {
+ resolvconf_path = PATH_RESOLV_CONF;
+ }
+
+ fp = fopen(resolvconf_path, "r");
if (fp) {
while ((status = ares__read_line(fp, &line, &linesize)) == ARES_SUCCESS)
{
@@ -1759,10 +1692,10 @@ static int init_by_resolv_conf(ares_channel channel)
else if ((p = try_config(line, "search", ';')) && update_domains)
status = set_search(channel, p);
else if ((p = try_config(line, "nameserver", ';')) &&
- channel->nservers == -1)
+ channel->nservers == -1)
status = config_nameserver(&servers, &nservers, p);
else if ((p = try_config(line, "sortlist", ';')) &&
- channel->nsort == -1)
+ channel->nsort == -1)
status = config_sortlist(&sortlist, &nsort, p);
else if ((p = try_config(line, "options", ';')))
status = set_options(channel, p);
@@ -1782,7 +1715,7 @@ static int init_by_resolv_conf(ares_channel channel)
break;
default:
DEBUGF(fprintf(stderr, "fopen() failed with error: %d %s\n",
- error, strerror(error)));
+ error, strerror(error)));
DEBUGF(fprintf(stderr, "Error opening file: %s\n", PATH_RESOLV_CONF));
status = ARES_EFILE;
}
@@ -2050,6 +1983,11 @@ static int init_by_defaults(ares_channel channel)
ares_free(channel->lookups);
channel->lookups = NULL;
}
+
+ if(channel->resolvconf_path) {
+ ares_free(channel->resolvconf_path);
+ channel->resolvconf_path = NULL;
+ }
}
if(hostname)
@@ -2114,6 +2052,76 @@ static int config_lookup(ares_channel channel, const char *str,
#endif /* !WIN32 & !WATT32 & !ANDROID & !__ANDROID__ & !CARES_USE_LIBRESOLV */
#ifndef WATT32
+/* Validate that the ip address matches the subnet (network base and network
+ * mask) specified. Addresses are specified in standard Network Byte Order as
+ * 16 bytes, and the netmask is 0 to 128 (bits).
+ */
+static int ares_ipv6_subnet_matches(const unsigned char netbase[16],
+ unsigned char netmask,
+ const unsigned char ipaddr[16])
+{
+ unsigned char mask[16] = { 0 };
+ unsigned char i;
+
+ /* Misuse */
+ if (netmask > 128)
+ return 0;
+
+ /* Quickly set whole bytes */
+ memset(mask, 0xFF, netmask / 8);
+
+ /* Set remaining bits */
+ if(netmask % 8) {
+ mask[netmask / 8] = (unsigned char)(0xff << (8 - (netmask % 8)));
+ }
+
+ for (i=0; i<16; i++) {
+ if ((netbase[i] & mask[i]) != (ipaddr[i] & mask[i]))
+ return 0;
+ }
+
+ return 1;
+}
+
+/* Return true iff the IPv6 ipaddr is blacklisted. */
+static int ares_ipv6_server_blacklisted(const unsigned char ipaddr[16])
+{
+ /* A list of blacklisted IPv6 subnets. */
+ const struct {
+ const unsigned char netbase[16];
+ unsigned char netmask;
+ } blacklist[] = {
+ /* fec0::/10 was deprecated by [RFC3879] in September 2004. Formerly a
+ * Site-Local scoped address prefix. These are never valid DNS servers,
+ * but are known to be returned at least sometimes on Windows and Android.
+ */
+ {
+ {
+ 0xfe, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ },
+ 10
+ }
+ };
+ size_t i;
+
+ /* See if ipaddr matches any of the entries in the blacklist. */
+ for (i = 0; i < sizeof(blacklist) / sizeof(blacklist[0]); ++i) {
+ if (ares_ipv6_subnet_matches(
+ blacklist[i].netbase, blacklist[i].netmask, ipaddr))
+ return 1;
+ }
+ return 0;
+}
+
+/* Add the IPv4 or IPv6 nameservers in str (separated by commas) to the
+ * servers list, updating servers and nservers as required.
+ *
+ * This will silently ignore blacklisted IPv6 nameservers as detected by
+ * ares_ipv6_server_blacklisted().
+ *
+ * Returns an error code on failure, else ARES_SUCCESS.
+ */
static int config_nameserver(struct server_state **servers, int *nservers,
char *str)
{
@@ -2148,7 +2156,10 @@ static int config_nameserver(struct server_state **servers, int *nservers,
/* Convert textual address to binary format. */
if (ares_inet_pton(AF_INET, txtaddr, &host.addrV4) == 1)
host.family = AF_INET;
- else if (ares_inet_pton(AF_INET6, txtaddr, &host.addrV6) == 1)
+ else if (ares_inet_pton(AF_INET6, txtaddr, &host.addrV6) == 1
+ /* Silently skip blacklisted IPv6 servers. */
+ && !ares_ipv6_server_blacklisted(
+ (const unsigned char *)&host.addrV6))
host.family = AF_INET6;
else
continue;
@@ -2271,61 +2282,22 @@ static int config_sortlist(struct apattern **sortlist, int *nsort,
static int set_search(ares_channel channel, const char *str)
{
- int n;
- const char *p, *q;
+ size_t cnt;
if(channel->ndomains != -1) {
/* LCOV_EXCL_START: all callers check ndomains == -1 */
/* if we already have some domains present, free them first */
- for(n=0; n < channel->ndomains; n++)
- ares_free(channel->domains[n]);
- ares_free(channel->domains);
+ ares_strsplit_free(channel->domains, channel->ndomains);
channel->domains = NULL;
channel->ndomains = -1;
} /* LCOV_EXCL_STOP */
- /* Count the domains given. */
- n = 0;
- p = str;
- while (*p)
- {
- while (*p && !ISSPACE(*p))
- p++;
- while (ISSPACE(*p))
- p++;
- n++;
- }
-
- if (!n)
- {
- channel->ndomains = 0;
- return ARES_SUCCESS;
- }
-
- channel->domains = ares_malloc(n * sizeof(char *));
- if (!channel->domains)
- return ARES_ENOMEM;
-
- /* Now copy the domains. */
- n = 0;
- p = str;
- while (*p)
- {
- channel->ndomains = n;
- q = p;
- while (*q && !ISSPACE(*q))
- q++;
- channel->domains[n] = ares_malloc(q - p + 1);
- if (!channel->domains[n])
- return ARES_ENOMEM;
- memcpy(channel->domains[n], p, q - p);
- channel->domains[n][q - p] = 0;
- p = q;
- while (ISSPACE(*p))
- p++;
- n++;
- }
- channel->ndomains = n;
+ channel->domains = ares_strsplit(str, ", ", 1, &cnt);
+ channel->ndomains = (int)cnt;
+ if (channel->domains == NULL || channel->ndomains == 0) {
+ channel->domains = NULL;
+ channel->ndomains = -1;
+ }
return ARES_SUCCESS;
}
diff --git a/deps/cares/src/ares_library_init.c b/deps/cares/src/ares_library_init.c
index 88e7a537480813..67563499bec276 100644
--- a/deps/cares/src/ares_library_init.c
+++ b/deps/cares/src/ares_library_init.c
@@ -40,9 +40,19 @@ static unsigned int ares_initialized;
static int ares_init_flags;
/* library-private global vars with visibility across the whole library */
-void *(*ares_malloc)(size_t size) = malloc;
-void *(*ares_realloc)(void *ptr, size_t size) = realloc;
-void (*ares_free)(void *ptr) = free;
+#if defined(WIN32)
+/* We need indirections to handle Windows DLL rules. */
+static void *default_malloc(size_t size) { return malloc(size); }
+static void *default_realloc(void *p, size_t size) { return realloc(p, size); }
+static void default_free(void *p) { free(p); }
+#else
+# define default_malloc malloc
+# define default_realloc realloc
+# define default_free free
+#endif
+void *(*ares_malloc)(size_t size) = default_malloc;
+void *(*ares_realloc)(void *ptr, size_t size) = default_realloc;
+void (*ares_free)(void *ptr) = default_free;
#ifdef USE_WINSOCK
static HMODULE hnd_iphlpapi;
diff --git a/deps/cares/src/ares_options.c b/deps/cares/src/ares_options.c
index c3cbd1df707566..de49de4625996f 100644
--- a/deps/cares/src/ares_options.c
+++ b/deps/cares/src/ares_options.c
@@ -153,6 +153,9 @@ int ares_set_servers(ares_channel channel,
if (!channel)
return ARES_ENODATA;
+ if (!ares__is_list_empty(&channel->all_queries))
+ return ARES_ENOTIMP;
+
ares__destroy_servers_state(channel);
for (srvr = servers; srvr; srvr = srvr->next)
@@ -202,6 +205,9 @@ int ares_set_servers_ports(ares_channel channel,
if (!channel)
return ARES_ENODATA;
+ if (!ares__is_list_empty(&channel->all_queries))
+ return ARES_ENOTIMP;
+
ares__destroy_servers_state(channel);
for (srvr = servers; srvr; srvr = srvr->next)
@@ -258,8 +264,6 @@ static int set_servers_csv(ares_channel channel,
if (!channel)
return ARES_ENODATA;
- ares__destroy_servers_state(channel);
-
i = strlen(_csv);
if (i == 0)
return ARES_SUCCESS; /* blank all servers */
diff --git a/deps/cares/src/ares_parse_ptr_reply.c b/deps/cares/src/ares_parse_ptr_reply.c
index 976a5311a24d79..29e22cb17b6bd6 100644
--- a/deps/cares/src/ares_parse_ptr_reply.c
+++ b/deps/cares/src/ares_parse_ptr_reply.c
@@ -52,6 +52,7 @@ int ares_parse_ptr_reply(const unsigned char *abuf, int alen, const void *addr,
int aliascnt = 0;
int alias_alloc = 8;
char ** aliases;
+ size_t rr_data_len;
/* Set *host to NULL for all failure cases. */
*host = NULL;
@@ -124,14 +125,15 @@ int ares_parse_ptr_reply(const unsigned char *abuf, int alen, const void *addr,
if (hostname)
ares_free(hostname);
hostname = rr_data;
- aliases[aliascnt] = ares_malloc((strlen(rr_data)+1) * sizeof(char));
+ rr_data_len = strlen(rr_data)+1;
+ aliases[aliascnt] = ares_malloc(rr_data_len * sizeof(char));
if (!aliases[aliascnt])
{
ares_free(rr_name);
status = ARES_ENOMEM;
break;
}
- strncpy(aliases[aliascnt], rr_data, strlen(rr_data)+1);
+ strncpy(aliases[aliascnt], rr_data, rr_data_len);
aliascnt++;
if (aliascnt >= alias_alloc) {
char **ptr;
diff --git a/deps/cares/src/ares_private.h b/deps/cares/src/ares_private.h
index 5d773869c72a97..1990f6902fc75e 100644
--- a/deps/cares/src/ares_private.h
+++ b/deps/cares/src/ares_private.h
@@ -52,18 +52,19 @@
#if defined(WIN32) && !defined(WATT32)
-#define WIN_NS_9X "System\\CurrentControlSet\\Services\\VxD\\MSTCP"
-#define WIN_NS_NT_KEY "System\\CurrentControlSet\\Services\\Tcpip\\Parameters"
-#define WIN_DNSCLIENT "Software\\Policies\\Microsoft\\System\\DNSClient"
-#define NAMESERVER "NameServer"
-#define DHCPNAMESERVER "DhcpNameServer"
-#define DATABASEPATH "DatabasePath"
-#define WIN_PATH_HOSTS "\\hosts"
-#define SEARCHLIST_KEY "SearchList"
+#define WIN_NS_9X "System\\CurrentControlSet\\Services\\VxD\\MSTCP"
+#define WIN_NS_NT_KEY "System\\CurrentControlSet\\Services\\Tcpip\\Parameters"
+#define WIN_DNSCLIENT "Software\\Policies\\Microsoft\\System\\DNSClient"
+#define WIN_NT_DNSCLIENT "Software\\Policies\\Microsoft\\Windows NT\\DNSClient"
+#define NAMESERVER "NameServer"
+#define DHCPNAMESERVER "DhcpNameServer"
+#define DATABASEPATH "DatabasePath"
+#define WIN_PATH_HOSTS "\\hosts"
+#define SEARCHLIST_KEY "SearchList"
#define PRIMARYDNSSUFFIX_KEY "PrimaryDNSSuffix"
-#define INTERFACES_KEY "Interfaces"
-#define DOMAIN_KEY "Domain"
-#define DHCPDOMAIN_KEY "DhcpDomain"
+#define INTERFACES_KEY "Interfaces"
+#define DOMAIN_KEY "Domain"
+#define DHCPDOMAIN_KEY "DhcpDomain"
#elif defined(WATT32)
@@ -100,6 +101,7 @@
#endif
#include "ares_strdup.h"
+#include "ares_strsplit.h"
#ifndef HAVE_STRCASECMP
# include "ares_strcasecmp.h"
@@ -323,8 +325,14 @@ struct ares_channeldata {
const struct ares_socket_functions * sock_funcs;
void *sock_func_cb_data;
+
+ /* Path for resolv.conf file, configurable via ares_options */
+ char *resolvconf_path;
};
+/* Does the domain end in ".onion" or ".onion."? Case-insensitive. */
+int ares__is_onion_domain(const char *name);
+
/* Memory management functions */
extern void *(*ares_malloc)(size_t size);
extern void *(*ares_realloc)(void *ptr, size_t size);
diff --git a/deps/cares/src/ares_process.c b/deps/cares/src/ares_process.c
index df85524f624cfd..df9f290bb133a6 100644
--- a/deps/cares/src/ares_process.c
+++ b/deps/cares/src/ares_process.c
@@ -53,6 +53,7 @@
#include
#include
+#include
#include "ares.h"
#include "ares_dns.h"
@@ -871,8 +872,32 @@ void ares__send_query(ares_channel channel, struct query *query,
return;
}
}
- timeplus = channel->timeout << (query->try_count / channel->nservers);
- timeplus = (timeplus * (9 + (rand () & 7))) / 16;
+
+ /* For each trip through the entire server list, double the channel's
+ * assigned timeout, avoiding overflow. If channel->timeout is negative,
+ * leave it as-is, even though that should be impossible here.
+ */
+ timeplus = channel->timeout;
+ {
+ /* How many times do we want to double it? Presume sane values here. */
+ const int shift = query->try_count / channel->nservers;
+
+ /* Is there enough room to shift timeplus left that many times?
+ *
+ * To find out, confirm that all of the bits we'll shift away are zero.
+ * Stop considering a shift if we get to the point where we could shift
+ * a 1 into the sign bit (i.e. when shift is within two of the bit
+ * count).
+ *
+ * This has the side benefit of leaving negative numbers unchanged.
+ */
+ if(shift <= (int)(sizeof(int) * CHAR_BIT - 1)
+ && (timeplus >> (sizeof(int) * CHAR_BIT - 1 - shift)) == 0)
+ {
+ timeplus <<= shift;
+ }
+ }
+
query->timeout = *now;
timeadd(&query->timeout, timeplus);
/* Keep track of queries bucketed by timeout, so we can process
diff --git a/deps/cares/src/ares_search.c b/deps/cares/src/ares_search.c
index 68e852574f0909..001c3482a7dd5d 100644
--- a/deps/cares/src/ares_search.c
+++ b/deps/cares/src/ares_search.c
@@ -54,6 +54,13 @@ void ares_search(ares_channel channel, const char *name, int dnsclass,
const char *p;
int status, ndots;
+ /* Per RFC 7686, reject queries for ".onion" domain names with NXDOMAIN. */
+ if (ares__is_onion_domain(name))
+ {
+ callback(arg, ARES_ENOTFOUND, 0, NULL, 0);
+ return;
+ }
+
/* If name only yields one domain to search, then we don't have
* to keep extra state, so just do an ares_query().
*/
diff --git a/deps/cares/src/ares_send.c b/deps/cares/src/ares_send.c
index 88c0035520c504..f4f1f951197de8 100644
--- a/deps/cares/src/ares_send.c
+++ b/deps/cares/src/ares_send.c
@@ -60,6 +60,12 @@ void ares_send(ares_channel channel, const unsigned char *qbuf, int qlen,
callback(arg, ARES_ENOMEM, 0, NULL, 0);
return;
}
+ if (channel->nservers < 1)
+ {
+ ares_free(query);
+ callback(arg, ARES_ESERVFAIL, 0, NULL, 0);
+ return;
+ }
query->server_info = ares_malloc(channel->nservers *
sizeof(query->server_info[0]));
if (!query->server_info)
diff --git a/deps/cares/src/ares_strsplit.c b/deps/cares/src/ares_strsplit.c
new file mode 100644
index 00000000000000..b57a30f2a99c35
--- /dev/null
+++ b/deps/cares/src/ares_strsplit.c
@@ -0,0 +1,174 @@
+/* Copyright (C) 2018 by John Schember
+ *
+ * Permission to use, copy, modify, and distribute this
+ * software and its documentation for any purpose and without
+ * fee is hereby granted, provided that the above copyright
+ * notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting
+ * documentation, and that the name of M.I.T. not be used in
+ * advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ * M.I.T. makes no representations about the suitability of
+ * this software for any purpose. It is provided "as is"
+ * without express or implied warranty.
+ */
+
+#include "ares_setup.h"
+#include "ares_strsplit.h"
+#include "ares.h"
+#include "ares_private.h"
+
+static int list_contains(char * const *list, size_t num_elem, const char *str, int insensitive)
+{
+ size_t len;
+ size_t i;
+
+ len = strlen(str);
+ for (i=0; i
+ *
+ * Permission to use, copy, modify, and distribute this
+ * software and its documentation for any purpose and without
+ * fee is hereby granted, provided that the above copyright
+ * notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting
+ * documentation, and that the name of M.I.T. not be used in
+ * advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ * M.I.T. makes no representations about the suitability of
+ * this software for any purpose. It is provided "as is"
+ * without express or implied warranty.
+ */
+
+#include "ares_setup.h"
+
+/* Split a string on delem skipping empty elements.
+ *
+ * param in String to split.
+ * param delims String of characters to treat as a delimitor.
+ * Each character in the string is a delimitor so
+ * there can be multiple delimitors to split on.
+ * E.g. ", " will split on all comma's and spaces.
+ * param make_set Have the list be a Set where there are no
+ * duplicate entries. 1 for true, 0 or false.
+ * param num_elm Return parameter of the number of elements
+ * in the result array.
+ *
+ * returns an allocated array of allocated string elements.
+ *
+ */
+char **ares_strsplit(const char *in, const char *delms, int make_set, size_t *num_elm);
+
+/* Frees the result returned from ares_strsplit(). */
+void ares_strsplit_free(char **elms, size_t num_elm);
+
+
+#endif /* HEADER_CARES_STRSPLIT_H */
diff --git a/deps/cares/src/inet_ntop.c b/deps/cares/src/inet_ntop.c
index ce3ce588d3c0bd..1935a871cede6d 100644
--- a/deps/cares/src/inet_ntop.c
+++ b/deps/cares/src/inet_ntop.c
@@ -180,8 +180,7 @@ inet_ntop6(const unsigned char *src, char *dst, size_t size)
tp += sprintf(tp, "%x", words[i]);
}
/* Was it a trailing run of 0x00's? */
- if (best.base != -1 && (best.base + best.len) ==
- (NS_IN6ADDRSZ / NS_INT16SZ))
+ if (best.base != -1 && (best.base + best.len) == (NS_IN6ADDRSZ / NS_INT16SZ))
*tp++ = ':';
*tp++ = '\0';
diff --git a/deps/llhttp/LICENSE-MIT b/deps/llhttp/LICENSE-MIT
new file mode 100644
index 00000000000000..6c1512dd6bcd6d
--- /dev/null
+++ b/deps/llhttp/LICENSE-MIT
@@ -0,0 +1,22 @@
+This software is licensed under the MIT License.
+
+Copyright Fedor Indutny, 2018.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to permit
+persons to whom the Software is furnished to do so, subject to the
+following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/deps/llhttp/README.md b/deps/llhttp/README.md
new file mode 100644
index 00000000000000..bca973f80d0025
--- /dev/null
+++ b/deps/llhttp/README.md
@@ -0,0 +1,129 @@
+# llhttp
+[![Build Status](https://secure.travis-ci.org/indutny/llhttp.svg)](http://travis-ci.org/indutny/llhttp)
+
+Port of [http_parser][0] to [llparse][1].
+
+## Why?
+
+Let's face it, [http_parser][0] is practically unmaintainable. Even
+introduction of a single new method results in a significant code churn.
+
+This project aims to:
+
+* Make it maintainable
+* Verifiable
+* Improving benchmarks where possible
+
+## How?
+
+Over time, different approaches for improving [http_parser][0]'s code base
+were tried. However, all of them failed due to resulting significant performance
+degradation.
+
+This project is a port of [http_parser][0] to TypeScript. [llparse][1] is used
+to generate the output C and/or bitcode artifacts, which could be compiled and
+linked with the embedder's program (like [Node.js][7]).
+
+## Peformance
+
+So far llhttp outperforms http_parser:
+
+| | input size | bandwidth | reqs/sec | time |
+|:----------------|-----------:|-------------:|-----------:|--------:|
+| **llhttp** _(C)_ | 8192.00 mb | 1497.88 mb/s | 3020458.87 ops/sec | 5.47 s |
+| **llhttp** _(bitcode)_ | 8192.00 mb | 1131.75 mb/s | 2282171.24 ops/sec | 7.24 s |
+| **http_parser** | 8192.00 mb | 694.66 mb/s | 1406180.33 req/sec | 11.79 s |
+
+llhttp is faster by approximately **116%**.
+
+## Maintenance
+
+llhttp project has about 1400 lines of TypeScript code describing the parser
+itself and around 450 lines of C code and headers providing the helper methods.
+The whole [http_parser][0] is implemented in approximately 2500 lines of C, and
+436 lines of headers.
+
+All optimizations and multi-character matching in llhttp are generated
+automatically, and thus doesn't add any extra maintenance cost. On the contrary,
+most of http_parser's code is hand-optimized and unrolled. Instead describing
+"how" it should parse the HTTP requests/responses, a maintainer should
+implement the new features in [http_parser][0] cautiously, considering
+possible performance degradation and manually optimizing the new code.
+
+## Verification
+
+The state machine graph is encoded explicitly in llhttp. The [llparse][1]
+automatically checks the graph for absence of loops and correct reporting of the
+input ranges (spans) like header names and values. In the future, additional
+checks could be performed to get even stricter verification of the llhttp.
+
+## Usage
+
+```C
+#include "llhttp.h"
+
+llhttp_t parser;
+llhttp_settings_t settings;
+
+/* Initialize user callbacks and settings */
+llhttp_settings_init(&settings);
+
+/* Set user callback */
+settings.on_message_complete = handle_on_message_complete;
+
+/* Initialize the parser in HTTP_BOTH mode, meaning that it will select between
+ * HTTP_REQUEST and HTTP_RESPONSE parsing automatically while reading the first
+ * input.
+ */
+llhttp_init(&parser, HTTP_BOTH, &settings);
+
+/* Use `llhttp_set_type(&parser, HTTP_REQUEST);` to override the mode */
+
+/* Parse request! */
+const char* request = "GET / HTTP/1.1\r\n\r\n";
+int request_len = strlen(request);
+
+enum llhttp_errno err = llhttp_execute(&parser, request, request_len);
+if (err == HPE_OK) {
+ /* Successfully parsed! */
+} else {
+ fprintf(stderr, "Parse error: %s %s\n", llhttp_errno_name(err),
+ parser.reason);
+}
+```
+
+---
+
+#### LICENSE
+
+This software is licensed under the MIT License.
+
+Copyright Fedor Indutny, 2018.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to permit
+persons to whom the Software is furnished to do so, subject to the
+following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+[0]: /~https://github.com/nodejs/http-parser
+[1]: /~https://github.com/indutny/llparse
+[2]: https://en.wikipedia.org/wiki/Register_allocation#Spilling
+[3]: https://en.wikipedia.org/wiki/Tail_call
+[4]: https://llvm.org/docs/LangRef.html
+[5]: https://llvm.org/docs/LangRef.html#call-instruction
+[6]: https://clang.llvm.org/
+[7]: /~https://github.com/nodejs/node
diff --git a/deps/llhttp/common.gypi b/deps/llhttp/common.gypi
new file mode 100644
index 00000000000000..ef7549f809df26
--- /dev/null
+++ b/deps/llhttp/common.gypi
@@ -0,0 +1,46 @@
+{
+ 'target_defaults': {
+ 'default_configuration': 'Debug',
+ 'configurations': {
+ # TODO: hoist these out and put them somewhere common, because
+ # RuntimeLibrary MUST MATCH across the entire project
+ 'Debug': {
+ 'defines': [ 'DEBUG', '_DEBUG' ],
+ 'cflags': [ '-Wall', '-Wextra', '-O0', '-g', '-ftrapv' ],
+ 'msvs_settings': {
+ 'VCCLCompilerTool': {
+ 'RuntimeLibrary': 1, # static debug
+ },
+ },
+ },
+ 'Release': {
+ 'defines': [ 'NDEBUG' ],
+ 'cflags': [ '-Wall', '-Wextra', '-O3' ],
+ 'msvs_settings': {
+ 'VCCLCompilerTool': {
+ 'RuntimeLibrary': 0, # static release
+ },
+ },
+ }
+ },
+ 'msvs_settings': {
+ 'VCCLCompilerTool': {
+ # Compile as C++. llhttp.c is actually C99, but C++ is
+ # close enough in this case.
+ 'CompileAs': 2,
+ },
+ 'VCLibrarianTool': {
+ },
+ 'VCLinkerTool': {
+ 'GenerateDebugInformation': 'true',
+ },
+ },
+ 'conditions': [
+ ['OS == "win"', {
+ 'defines': [
+ 'WIN32'
+ ],
+ }]
+ ],
+ },
+}
diff --git a/deps/llhttp/include/llhttp.h b/deps/llhttp/include/llhttp.h
new file mode 100644
index 00000000000000..c114d11ffa9353
--- /dev/null
+++ b/deps/llhttp/include/llhttp.h
@@ -0,0 +1,353 @@
+#ifndef INCLUDE_LLHTTP_H_
+#define INCLUDE_LLHTTP_H_
+
+#define LLHTTP_VERSION_MAJOR 1
+#define LLHTTP_VERSION_MINOR 0
+#define LLHTTP_VERSION_PATCH 0
+
+#ifndef INCLUDE_LLHTTP_ITSELF_H_
+#define INCLUDE_LLHTTP_ITSELF_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include
+
+typedef struct llhttp__internal_s llhttp__internal_t;
+struct llhttp__internal_s {
+ int32_t _index;
+ void* _span_pos0;
+ void* _span_cb0;
+ int32_t error;
+ const char* reason;
+ const char* error_pos;
+ void* data;
+ void* _current;
+ uint64_t content_length;
+ uint8_t type;
+ uint8_t method;
+ uint8_t http_major;
+ uint8_t http_minor;
+ uint8_t header_state;
+ uint8_t flags;
+ uint8_t upgrade;
+ uint16_t status_code;
+ uint8_t finish;
+ void* settings;
+};
+
+int llhttp__internal_init(llhttp__internal_t* s);
+int llhttp__internal_execute(llhttp__internal_t* s, const char* p, const char* endp);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+#endif /* INCLUDE_LLHTTP_ITSELF_H_ */
+
+#ifndef LLLLHTTP_C_HEADERS_
+#define LLLLHTTP_C_HEADERS_
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+enum llhttp_errno {
+ HPE_OK = 0,
+ HPE_INTERNAL = 1,
+ HPE_STRICT = 2,
+ HPE_LF_EXPECTED = 3,
+ HPE_UNEXPECTED_CONTENT_LENGTH = 4,
+ HPE_CLOSED_CONNECTION = 5,
+ HPE_INVALID_METHOD = 6,
+ HPE_INVALID_URL = 7,
+ HPE_INVALID_CONSTANT = 8,
+ HPE_INVALID_VERSION = 9,
+ HPE_INVALID_HEADER_TOKEN = 10,
+ HPE_INVALID_CONTENT_LENGTH = 11,
+ HPE_INVALID_CHUNK_SIZE = 12,
+ HPE_INVALID_STATUS = 13,
+ HPE_INVALID_EOF_STATE = 14,
+ HPE_CB_MESSAGE_BEGIN = 15,
+ HPE_CB_HEADERS_COMPLETE = 16,
+ HPE_CB_MESSAGE_COMPLETE = 17,
+ HPE_CB_CHUNK_HEADER = 18,
+ HPE_CB_CHUNK_COMPLETE = 19,
+ HPE_PAUSED = 20,
+ HPE_PAUSED_UPGRADE = 21,
+ HPE_USER = 22
+};
+typedef enum llhttp_errno llhttp_errno_t;
+
+enum llhttp_flags {
+ F_CONNECTION_KEEP_ALIVE = 0x1,
+ F_CONNECTION_CLOSE = 0x2,
+ F_CONNECTION_UPGRADE = 0x4,
+ F_CHUNKED = 0x8,
+ F_UPGRADE = 0x10,
+ F_CONTENT_LENGTH = 0x20,
+ F_SKIPBODY = 0x40,
+ F_TRAILING = 0x80
+};
+typedef enum llhttp_flags llhttp_flags_t;
+
+enum llhttp_type {
+ HTTP_BOTH = 0,
+ HTTP_REQUEST = 1,
+ HTTP_RESPONSE = 2
+};
+typedef enum llhttp_type llhttp_type_t;
+
+enum llhttp_finish {
+ HTTP_FINISH_SAFE = 0,
+ HTTP_FINISH_SAFE_WITH_CB = 1,
+ HTTP_FINISH_UNSAFE = 2
+};
+typedef enum llhttp_finish llhttp_finish_t;
+
+enum llhttp_method {
+ HTTP_DELETE = 0,
+ HTTP_GET = 1,
+ HTTP_HEAD = 2,
+ HTTP_POST = 3,
+ HTTP_PUT = 4,
+ HTTP_CONNECT = 5,
+ HTTP_OPTIONS = 6,
+ HTTP_TRACE = 7,
+ HTTP_COPY = 8,
+ HTTP_LOCK = 9,
+ HTTP_MKCOL = 10,
+ HTTP_MOVE = 11,
+ HTTP_PROPFIND = 12,
+ HTTP_PROPPATCH = 13,
+ HTTP_SEARCH = 14,
+ HTTP_UNLOCK = 15,
+ HTTP_BIND = 16,
+ HTTP_REBIND = 17,
+ HTTP_UNBIND = 18,
+ HTTP_ACL = 19,
+ HTTP_REPORT = 20,
+ HTTP_MKACTIVITY = 21,
+ HTTP_CHECKOUT = 22,
+ HTTP_MERGE = 23,
+ HTTP_MSEARCH = 24,
+ HTTP_NOTIFY = 25,
+ HTTP_SUBSCRIBE = 26,
+ HTTP_UNSUBSCRIBE = 27,
+ HTTP_PATCH = 28,
+ HTTP_PURGE = 29,
+ HTTP_MKCALENDAR = 30,
+ HTTP_LINK = 31,
+ HTTP_UNLINK = 32,
+ HTTP_SOURCE = 33
+};
+typedef enum llhttp_method llhttp_method_t;
+
+#define HTTP_ERRNO_MAP(XX) \
+ XX(0, OK, OK) \
+ XX(1, INTERNAL, INTERNAL) \
+ XX(2, STRICT, STRICT) \
+ XX(3, LF_EXPECTED, LF_EXPECTED) \
+ XX(4, UNEXPECTED_CONTENT_LENGTH, UNEXPECTED_CONTENT_LENGTH) \
+ XX(5, CLOSED_CONNECTION, CLOSED_CONNECTION) \
+ XX(6, INVALID_METHOD, INVALID_METHOD) \
+ XX(7, INVALID_URL, INVALID_URL) \
+ XX(8, INVALID_CONSTANT, INVALID_CONSTANT) \
+ XX(9, INVALID_VERSION, INVALID_VERSION) \
+ XX(10, INVALID_HEADER_TOKEN, INVALID_HEADER_TOKEN) \
+ XX(11, INVALID_CONTENT_LENGTH, INVALID_CONTENT_LENGTH) \
+ XX(12, INVALID_CHUNK_SIZE, INVALID_CHUNK_SIZE) \
+ XX(13, INVALID_STATUS, INVALID_STATUS) \
+ XX(14, INVALID_EOF_STATE, INVALID_EOF_STATE) \
+ XX(15, CB_MESSAGE_BEGIN, CB_MESSAGE_BEGIN) \
+ XX(16, CB_HEADERS_COMPLETE, CB_HEADERS_COMPLETE) \
+ XX(17, CB_MESSAGE_COMPLETE, CB_MESSAGE_COMPLETE) \
+ XX(18, CB_CHUNK_HEADER, CB_CHUNK_HEADER) \
+ XX(19, CB_CHUNK_COMPLETE, CB_CHUNK_COMPLETE) \
+ XX(20, PAUSED, PAUSED) \
+ XX(21, PAUSED_UPGRADE, PAUSED_UPGRADE) \
+ XX(22, USER, USER) \
+
+
+#define HTTP_METHOD_MAP(XX) \
+ XX(0, DELETE, DELETE) \
+ XX(1, GET, GET) \
+ XX(2, HEAD, HEAD) \
+ XX(3, POST, POST) \
+ XX(4, PUT, PUT) \
+ XX(5, CONNECT, CONNECT) \
+ XX(6, OPTIONS, OPTIONS) \
+ XX(7, TRACE, TRACE) \
+ XX(8, COPY, COPY) \
+ XX(9, LOCK, LOCK) \
+ XX(10, MKCOL, MKCOL) \
+ XX(11, MOVE, MOVE) \
+ XX(12, PROPFIND, PROPFIND) \
+ XX(13, PROPPATCH, PROPPATCH) \
+ XX(14, SEARCH, SEARCH) \
+ XX(15, UNLOCK, UNLOCK) \
+ XX(16, BIND, BIND) \
+ XX(17, REBIND, REBIND) \
+ XX(18, UNBIND, UNBIND) \
+ XX(19, ACL, ACL) \
+ XX(20, REPORT, REPORT) \
+ XX(21, MKACTIVITY, MKACTIVITY) \
+ XX(22, CHECKOUT, CHECKOUT) \
+ XX(23, MERGE, MERGE) \
+ XX(24, MSEARCH, M-SEARCH) \
+ XX(25, NOTIFY, NOTIFY) \
+ XX(26, SUBSCRIBE, SUBSCRIBE) \
+ XX(27, UNSUBSCRIBE, UNSUBSCRIBE) \
+ XX(28, PATCH, PATCH) \
+ XX(29, PURGE, PURGE) \
+ XX(30, MKCALENDAR, MKCALENDAR) \
+ XX(31, LINK, LINK) \
+ XX(32, UNLINK, UNLINK) \
+ XX(33, SOURCE, SOURCE) \
+
+
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+#endif /* LLLLHTTP_C_HEADERS_ */
+
+#ifndef INCLUDE_LLHTTP_API_H_
+#define INCLUDE_LLHTTP_API_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef llhttp__internal_t llhttp_t;
+typedef struct llhttp_settings_s llhttp_settings_t;
+
+typedef int (*llhttp_data_cb)(llhttp_t*, const char *at, size_t length);
+typedef int (*llhttp_cb)(llhttp_t*);
+
+struct llhttp_settings_s {
+ /* Possible return values 0, -1, `HPE_PAUSED` */
+ llhttp_cb on_message_begin;
+
+ llhttp_data_cb on_url;
+ llhttp_data_cb on_status;
+ llhttp_data_cb on_header_field;
+ llhttp_data_cb on_header_value;
+
+ /* Possible return values:
+ * 0 - Proceed normally
+ * 1 - Assume that request/response has no body, and proceed to parsing the
+ * next message
+ * 2 - Assume absence of body (as above) and make `llhttp_execute()` return
+ * `HPE_PAUSED_UPGRADE`
+ * -1 - Error
+ * `HPE_PAUSED`
+ */
+ llhttp_cb on_headers_complete;
+
+ llhttp_data_cb on_body;
+
+ /* Possible return values 0, -1, `HPE_PAUSED` */
+ llhttp_cb on_message_complete;
+
+ /* When on_chunk_header is called, the current chunk length is stored
+ * in parser->content_length.
+ * Possible return values 0, -1, `HPE_PAUSED`
+ */
+ llhttp_cb on_chunk_header;
+ llhttp_cb on_chunk_complete;
+};
+
+/* Initialize the parser with specific type and user settings */
+void llhttp_init(llhttp_t* parser, llhttp_type_t type,
+ const llhttp_settings_t* settings);
+
+/* Initialize the settings object */
+void llhttp_settings_init(llhttp_settings_t* settings);
+
+/* Parse full or partial request/response, invoking user callbacks along the
+ * way.
+ *
+ * If any of `llhttp_data_cb` returns errno not equal to `HPE_OK` - the parsing
+ * interrupts, and such errno is returned from `llhttp_execute()`. If
+ * `HPE_PAUSED` was used as a errno, the execution can be resumed with
+ * `llhttp_resume()` call.
+ *
+ * In a special case of CONNECT/Upgrade request/response `HPE_PAUSED_UPGRADE`
+ * is returned after fully parsing the request/response. If the user wishes to
+ * continue parsing, they need to invoke `llhttp_resume_after_upgrade()`.
+ */
+llhttp_errno_t llhttp_execute(llhttp_t* parser, const char* data, size_t len);
+
+/* This method should be called when the other side has no further bytes to
+ * send (e.g. shutdown of readable side of the TCP connection.)
+ *
+ * Requests without `Content-Length` and other messages might require treating
+ * all incoming bytes as the part of the body, up to the last byte of the
+ * connection. This method will invoke `on_message_complete()` callback if the
+ * request was terminated safely. Otherwise a error code would be returned.
+ */
+llhttp_errno_t llhttp_finish(llhttp_t* parser);
+
+/* Returns `1` if the incoming message is parsed until the last byte, and has
+ * to be completed by calling `llhttp_finish()` on EOF
+ */
+int llhttp_message_needs_eof(const llhttp_t* parser);
+
+/* Returns `1` if there might be any other messages following the last that was
+ * successfuly parsed.
+ */
+int llhttp_should_keep_alive(const llhttp_t* parser);
+
+/* Make further calls of `llhttp_execute()` return `HPE_PAUSED` and set
+ * appropriate error reason.
+ *
+ * Important: do not call this from user callbacks! User callbacks must return
+ * `HPE_PAUSED` if pausing is required.
+ */
+void llhttp_pause(llhttp_t* parser);
+
+/* Might be called to resume the execution after the pause in user's callback.
+ * See `llhttp_execute()` above for details.
+ *
+ * Call this only if `llhttp_execute()` returns `HPE_PAUSED`.
+ */
+void llhttp_resume(llhttp_t* parser);
+
+/* Might be called to resume the execution after the pause in user's callback.
+ * See `llhttp_execute()` above for details.
+ *
+ * Call this only if `llhttp_execute()` returns `HPE_PAUSED_UPGRADE`
+ */
+void llhttp_resume_after_upgrade(llhttp_t* parser);
+
+/* Returns the latest return error */
+llhttp_errno_t llhttp_get_errno(const llhttp_t* parser);
+
+/* Returns the verbal explanation of the latest returned error.
+ *
+ * Note: User callback should set error reason when returning the error. See
+ * `llhttp_set_error_reason()` for details.
+ */
+const char* llhttp_get_error_reason(const llhttp_t* parser);
+
+/* Assign verbal description to the returned error. Must be called in user
+ * callbacks right before returning the errno.
+ *
+ * Note: `HPE_USER` error code might be useful in user callbacks.
+ */
+void llhttp_set_error_reason(llhttp_t* parser, const char* reason);
+
+/* Returns the pointer to the last parsed byte before the returned error. The
+ * pointer is relative to the `data` argument of `llhttp_execute()`.
+ *
+ * Note: this method might be useful for counting the number of parsed bytes.
+ */
+const char* llhttp_get_error_pos(const llhttp_t* parser);
+
+/* Returns textual name of error code */
+const char* llhttp_errno_name(llhttp_errno_t err);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+#endif /* INCLUDE_LLHTTP_API_H_ */
+
+#endif /* INCLUDE_LLHTTP_H_ */
diff --git a/deps/llhttp/llhttp.gyp b/deps/llhttp/llhttp.gyp
new file mode 100644
index 00000000000000..4acc79bdf399fc
--- /dev/null
+++ b/deps/llhttp/llhttp.gyp
@@ -0,0 +1,13 @@
+{
+ 'targets': [
+ {
+ 'target_name': 'llhttp',
+ 'type': 'static_library',
+ 'include_dirs': [ '.', 'include' ],
+ 'direct_dependent_settings': {
+ 'include_dirs': [ 'include' ],
+ },
+ 'sources': [ 'src/llhttp.c', 'src/api.c', 'src/http.c' ],
+ },
+ ]
+}
diff --git a/deps/llhttp/src/api.c b/deps/llhttp/src/api.c
new file mode 100644
index 00000000000000..37a5dcd183e0f6
--- /dev/null
+++ b/deps/llhttp/src/api.c
@@ -0,0 +1,205 @@
+#include
+#include
+#include
+
+#include "llhttp.h"
+
+#define CALLBACK_MAYBE(PARSER, NAME, ...) \
+ do { \
+ llhttp_settings_t* settings; \
+ settings = (llhttp_settings_t*) (PARSER)->settings; \
+ if (settings == NULL || settings->NAME == NULL) { \
+ err = 0; \
+ break; \
+ } \
+ err = settings->NAME(__VA_ARGS__); \
+ } while (0)
+
+void llhttp_init(llhttp_t* parser, llhttp_type_t type,
+ const llhttp_settings_t* settings) {
+ llhttp__internal_init(parser);
+
+ parser->type = type;
+ parser->settings = (void*) settings;
+}
+
+
+llhttp_errno_t llhttp_execute(llhttp_t* parser, const char* data, size_t len) {
+ return llhttp__internal_execute(parser, data, data + len);
+}
+
+
+void llhttp_settings_init(llhttp_settings_t* settings) {
+ memset(settings, 0, sizeof(*settings));
+}
+
+
+llhttp_errno_t llhttp_finish(llhttp_t* parser) {
+ int err;
+
+ /* We're in an error state. Don't bother doing anything. */
+ if (parser->error != 0) {
+ return 0;
+ }
+
+ switch (parser->finish) {
+ case HTTP_FINISH_SAFE_WITH_CB:
+ CALLBACK_MAYBE(parser, on_message_complete, parser);
+ if (err != HPE_OK) return err;
+
+ /* FALLTHROUGH */
+ case HTTP_FINISH_SAFE:
+ return HPE_OK;
+ case HTTP_FINISH_UNSAFE:
+ parser->reason = "Invalid EOF state";
+ return HPE_INVALID_EOF_STATE;
+ default:
+ abort();
+ }
+}
+
+
+void llhttp_pause(llhttp_t* parser) {
+ if (parser->error != HPE_OK) {
+ return;
+ }
+
+ parser->error = HPE_PAUSED;
+ parser->reason = "Paused";
+}
+
+
+void llhttp_resume(llhttp_t* parser) {
+ if (parser->error != HPE_PAUSED) {
+ return;
+ }
+
+ parser->error = 0;
+}
+
+
+void llhttp_resume_after_upgrade(llhttp_t* parser) {
+ if (parser->error != HPE_PAUSED_UPGRADE) {
+ return;
+ }
+
+ parser->error = 0;
+}
+
+
+llhttp_errno_t llhttp_get_errno(const llhttp_t* parser) {
+ return parser->error;
+}
+
+
+const char* llhttp_get_error_reason(const llhttp_t* parser) {
+ return parser->reason;
+}
+
+
+void llhttp_set_error_reason(llhttp_t* parser, const char* reason) {
+ parser->reason = reason;
+}
+
+
+const char* llhttp_get_error_pos(const llhttp_t* parser) {
+ return parser->error_pos;
+}
+
+
+const char* llhttp_errno_name(llhttp_errno_t err) {
+#define HTTP_ERRNO_GEN(CODE, NAME, _) case HPE_##NAME: return "HPE_" #NAME;
+ switch (err) {
+ HTTP_ERRNO_MAP(HTTP_ERRNO_GEN)
+ default: abort();
+ }
+#undef HTTP_ERRNO_GEN
+}
+
+
+/* Callbacks */
+
+
+int llhttp__on_message_begin(llhttp_t* s, const char* p, const char* endp) {
+ int err;
+ CALLBACK_MAYBE(s, on_message_begin, s);
+ return err;
+}
+
+
+int llhttp__on_url(llhttp_t* s, const char* p, const char* endp) {
+ int err;
+ CALLBACK_MAYBE(s, on_url, s, p, endp - p);
+ return err;
+}
+
+
+int llhttp__on_status(llhttp_t* s, const char* p, const char* endp) {
+ int err;
+ CALLBACK_MAYBE(s, on_status, s, p, endp - p);
+ return err;
+}
+
+
+int llhttp__on_header_field(llhttp_t* s, const char* p, const char* endp) {
+ int err;
+ CALLBACK_MAYBE(s, on_header_field, s, p, endp - p);
+ return err;
+}
+
+
+int llhttp__on_header_value(llhttp_t* s, const char* p, const char* endp) {
+ int err;
+ CALLBACK_MAYBE(s, on_header_value, s, p, endp - p);
+ return err;
+}
+
+
+int llhttp__on_headers_complete(llhttp_t* s, const char* p, const char* endp) {
+ int err;
+ CALLBACK_MAYBE(s, on_headers_complete, s);
+ return err;
+}
+
+
+int llhttp__on_message_complete(llhttp_t* s, const char* p, const char* endp) {
+ int err;
+ CALLBACK_MAYBE(s, on_message_complete, s);
+ return err;
+}
+
+
+int llhttp__on_body(llhttp_t* s, const char* p, const char* endp) {
+ int err;
+ CALLBACK_MAYBE(s, on_body, s, p, endp - p);
+ return err;
+}
+
+
+int llhttp__on_chunk_header(llhttp_t* s, const char* p, const char* endp) {
+ int err;
+ CALLBACK_MAYBE(s, on_chunk_header, s);
+ return err;
+}
+
+
+int llhttp__on_chunk_complete(llhttp_t* s, const char* p, const char* endp) {
+ int err;
+ CALLBACK_MAYBE(s, on_chunk_complete, s);
+ return err;
+}
+
+
+/* Private */
+
+
+void llhttp__debug(llhttp_t* s, const char* p, const char* endp,
+ const char* msg) {
+ if (p == endp) {
+ fprintf(stderr, "p=%p type=%d flags=%02x next=null debug=%s\n", s, s->type,
+ s->flags, msg);
+ } else {
+ fprintf(stderr, "p=%p type=%d flags=%02x next=%02x debug=%s\n", s,
+ s->type, s->flags, *p, msg);
+ }
+}
diff --git a/deps/llhttp/src/http.c b/deps/llhttp/src/http.c
new file mode 100644
index 00000000000000..67834c2d377c49
--- /dev/null
+++ b/deps/llhttp/src/http.c
@@ -0,0 +1,120 @@
+#include
+#ifndef LLHTTP__TEST
+# include "llhttp.h"
+#else
+# define llhttp_t llparse_t
+#endif /* */
+
+int llhttp_message_needs_eof(const llhttp_t* parser);
+int llhttp_should_keep_alive(const llhttp_t* parser);
+
+int llhttp__before_headers_complete(llhttp_t* parser, const char* p,
+ const char* endp) {
+ /* Set this here so that on_headers_complete() callbacks can see it */
+ if ((parser->flags & F_UPGRADE) &&
+ (parser->flags & F_CONNECTION_UPGRADE)) {
+ /* For responses, "Upgrade: foo" and "Connection: upgrade" are
+ * mandatory only when it is a 101 Switching Protocols response,
+ * otherwise it is purely informational, to announce support.
+ */
+ parser->upgrade =
+ (parser->type == HTTP_REQUEST || parser->status_code == 101);
+ } else {
+ parser->upgrade = (parser->method == HTTP_CONNECT);
+ }
+ return 0;
+}
+
+
+/* Return values:
+ * 0 - No body, `restart`, message_complete
+ * 1 - CONNECT request, `restart`, message_complete, and pause
+ * 2 - chunk_size_start
+ * 3 - body_identity
+ * 4 - body_identity_eof
+ */
+int llhttp__after_headers_complete(llhttp_t* parser, const char* p,
+ const char* endp) {
+ int hasBody;
+
+ hasBody = parser->flags & F_CHUNKED || parser->content_length > 0;
+ if (parser->upgrade && (parser->method == HTTP_CONNECT ||
+ (parser->flags & F_SKIPBODY) || !hasBody)) {
+ /* Exit, the rest of the message is in a different protocol. */
+ return 1;
+ }
+
+ if (parser->flags & F_SKIPBODY) {
+ return 0;
+ } else if (parser->flags & F_CHUNKED) {
+ /* chunked encoding - ignore Content-Length header */
+ return 2;
+ } else {
+ if (!(parser->flags & F_CONTENT_LENGTH)) {
+ if (!llhttp_message_needs_eof(parser)) {
+ /* Assume content-length 0 - read the next */
+ return 0;
+ } else {
+ /* Read body until EOF */
+ return 4;
+ }
+ } else if (parser->content_length == 0) {
+ /* Content-Length header given but zero: Content-Length: 0\r\n */
+ return 0;
+ } else {
+ /* Content-Length header given and non-zero */
+ return 3;
+ }
+ }
+}
+
+
+int llhttp__after_message_complete(llhttp_t* parser, const char* p,
+ const char* endp) {
+ int should_keep_alive;
+
+ should_keep_alive = llhttp_should_keep_alive(parser);
+ parser->flags = 0;
+ parser->finish = HTTP_FINISH_SAFE;
+
+ /* NOTE: this is ignored in loose parsing mode */
+ return should_keep_alive;
+}
+
+
+int llhttp_message_needs_eof(const llhttp_t* parser) {
+ if (parser->type == HTTP_REQUEST) {
+ return 0;
+ }
+
+ /* See RFC 2616 section 4.4 */
+ if (parser->status_code / 100 == 1 || /* 1xx e.g. Continue */
+ parser->status_code == 204 || /* No Content */
+ parser->status_code == 304 || /* Not Modified */
+ (parser->flags & F_SKIPBODY)) { /* response to a HEAD request */
+ return 0;
+ }
+
+ if (parser->flags & (F_CHUNKED | F_CONTENT_LENGTH)) {
+ return 0;
+ }
+
+ return 1;
+}
+
+
+int llhttp_should_keep_alive(const llhttp_t* parser) {
+ if (parser->http_major > 0 && parser->http_minor > 0) {
+ /* HTTP/1.1 */
+ if (parser->flags & F_CONNECTION_CLOSE) {
+ return 0;
+ }
+ } else {
+ /* HTTP/1.0 or earlier */
+ if (!(parser->flags & F_CONNECTION_KEEP_ALIVE)) {
+ return 0;
+ }
+ }
+
+ return !llhttp_message_needs_eof(parser);
+}
diff --git a/deps/llhttp/src/llhttp.c b/deps/llhttp/src/llhttp.c
new file mode 100644
index 00000000000000..cb12c8dfd0f182
--- /dev/null
+++ b/deps/llhttp/src/llhttp.c
@@ -0,0 +1,6044 @@
+#include
+#include
+#include
+
+#include "llhttp.h"
+
+typedef int (*llhttp__internal__span_cb)(
+ llhttp__internal_t*, const char*, const char*);
+
+static const unsigned char llparse_blob0[] = {
+ 'C', 'L'
+};
+static const unsigned char llparse_blob1[] = {
+ 'o', 'n'
+};
+static const unsigned char llparse_blob2[] = {
+ 'e', 'c', 't', 'i', 'o', 'n'
+};
+static const unsigned char llparse_blob3[] = {
+ 'l', 'o', 's', 'e'
+};
+static const unsigned char llparse_blob4[] = {
+ 'e', 'e', 'p', '-', 'a', 'l', 'i', 'v', 'e'
+};
+static const unsigned char llparse_blob5[] = {
+ 'p', 'g', 'r', 'a', 'd', 'e'
+};
+static const unsigned char llparse_blob6[] = {
+ 'h', 'u', 'n', 'k', 'e', 'd'
+};
+static const unsigned char llparse_blob7[] = {
+ 'e', 'n', 't', '-', 'l', 'e', 'n', 'g', 't', 'h'
+};
+static const unsigned char llparse_blob8[] = {
+ 'r', 'o', 'x', 'y', '-', 'c', 'o', 'n', 'n', 'e', 'c',
+ 't', 'i', 'o', 'n'
+};
+static const unsigned char llparse_blob9[] = {
+ 'r', 'a', 'n', 's', 'f', 'e', 'r', '-', 'e', 'n', 'c',
+ 'o', 'd', 'i', 'n', 'g'
+};
+static const unsigned char llparse_blob10[] = {
+ 'p', 'g', 'r', 'a', 'd', 'e'
+};
+static const unsigned char llparse_blob11[] = {
+ 0xd, 0xa
+};
+static const unsigned char llparse_blob12[] = {
+ 'T', 'T', 'P', '/'
+};
+static const unsigned char llparse_blob13[] = {
+ 'C', 'E', '/'
+};
+static const unsigned char llparse_blob14[] = {
+ 'I', 'N', 'D'
+};
+static const unsigned char llparse_blob15[] = {
+ 'E', 'C', 'K', 'O', 'U', 'T'
+};
+static const unsigned char llparse_blob16[] = {
+ 'N', 'E', 'C', 'T'
+};
+static const unsigned char llparse_blob17[] = {
+ 'E', 'L', 'E', 'T', 'E'
+};
+static const unsigned char llparse_blob18[] = {
+ 'E', 'T'
+};
+static const unsigned char llparse_blob19[] = {
+ 'E', 'A', 'D'
+};
+static const unsigned char llparse_blob20[] = {
+ 'N', 'K'
+};
+static const unsigned char llparse_blob21[] = {
+ 'C', 'K'
+};
+static const unsigned char llparse_blob22[] = {
+ 'S', 'E', 'A', 'R', 'C', 'H'
+};
+static const unsigned char llparse_blob23[] = {
+ 'R', 'G', 'E'
+};
+static const unsigned char llparse_blob24[] = {
+ 'C', 'T', 'I', 'V', 'I', 'T', 'Y'
+};
+static const unsigned char llparse_blob25[] = {
+ 'L', 'E', 'N', 'D', 'A', 'R'
+};
+static const unsigned char llparse_blob26[] = {
+ 'V', 'E'
+};
+static const unsigned char llparse_blob27[] = {
+ 'O', 'T', 'I', 'F', 'Y'
+};
+static const unsigned char llparse_blob28[] = {
+ 'P', 'T', 'I', 'O', 'N', 'S'
+};
+static const unsigned char llparse_blob29[] = {
+ 'T', 'C', 'H'
+};
+static const unsigned char llparse_blob30[] = {
+ 'S', 'T'
+};
+static const unsigned char llparse_blob31[] = {
+ 'O', 'P'
+};
+static const unsigned char llparse_blob32[] = {
+ 'I', 'N', 'D'
+};
+static const unsigned char llparse_blob33[] = {
+ 'A', 'T', 'C', 'H'
+};
+static const unsigned char llparse_blob34[] = {
+ 'G', 'E'
+};
+static const unsigned char llparse_blob35[] = {
+ 'I', 'N', 'D'
+};
+static const unsigned char llparse_blob36[] = {
+ 'O', 'R', 'T'
+};
+static const unsigned char llparse_blob37[] = {
+ 'A', 'R', 'C', 'H'
+};
+static const unsigned char llparse_blob38[] = {
+ 'U', 'R', 'C', 'E'
+};
+static const unsigned char llparse_blob39[] = {
+ 'B', 'S', 'C', 'R', 'I', 'B', 'E'
+};
+static const unsigned char llparse_blob40[] = {
+ 'R', 'A', 'C', 'E'
+};
+static const unsigned char llparse_blob41[] = {
+ 'I', 'N', 'D'
+};
+static const unsigned char llparse_blob42[] = {
+ 'N', 'K'
+};
+static const unsigned char llparse_blob43[] = {
+ 'C', 'K'
+};
+static const unsigned char llparse_blob44[] = {
+ 'U', 'B', 'S', 'C', 'R', 'I', 'B', 'E'
+};
+static const unsigned char llparse_blob45[] = {
+ 'H', 'T', 'T', 'P', '/'
+};
+static const unsigned char llparse_blob46[] = {
+ 'A', 'D'
+};
+static const unsigned char llparse_blob47[] = {
+ 'T', 'P', '/'
+};
+
+enum llparse_match_status_e {
+ kMatchComplete,
+ kMatchPause,
+ kMatchMismatch
+};
+typedef enum llparse_match_status_e llparse_match_status_t;
+
+struct llparse_match_s {
+ llparse_match_status_t status;
+ const unsigned char* current;
+};
+typedef struct llparse_match_s llparse_match_t;
+
+static llparse_match_t llparse__match_sequence_id(
+ llhttp__internal_t* s, const unsigned char* p,
+ const unsigned char* endp,
+ const unsigned char* seq, uint32_t seq_len) {
+ uint32_t index;
+ llparse_match_t res;
+
+ index = s->_index;
+ for (; p != endp; p++) {
+ unsigned char current;
+
+ current = *p;
+ if (current == seq[index]) {
+ if (++index == seq_len) {
+ res.status = kMatchComplete;
+ goto reset;
+ }
+ } else {
+ res.status = kMatchMismatch;
+ goto reset;
+ }
+ }
+ s->_index = index;
+ res.status = kMatchPause;
+ res.current = p;
+ return res;
+reset:
+ s->_index = 0;
+ res.current = p;
+ return res;
+}
+
+static llparse_match_t llparse__match_sequence_to_lower_unsafe(
+ llhttp__internal_t* s, const unsigned char* p,
+ const unsigned char* endp,
+ const unsigned char* seq, uint32_t seq_len) {
+ uint32_t index;
+ llparse_match_t res;
+
+ index = s->_index;
+ for (; p != endp; p++) {
+ unsigned char current;
+
+ current = ((*p) | 0x20);
+ if (current == seq[index]) {
+ if (++index == seq_len) {
+ res.status = kMatchComplete;
+ goto reset;
+ }
+ } else {
+ res.status = kMatchMismatch;
+ goto reset;
+ }
+ }
+ s->_index = index;
+ res.status = kMatchPause;
+ res.current = p;
+ return res;
+reset:
+ s->_index = 0;
+ res.current = p;
+ return res;
+}
+
+enum llparse_state_e {
+ s_error,
+ s_n_llhttp__internal__n_invoke_llhttp__after_message_complete,
+ s_n_llhttp__internal__n_pause_1,
+ s_n_llhttp__internal__n_invoke_is_equal_upgrade,
+ s_n_llhttp__internal__n_invoke_llhttp__on_message_complete_2,
+ s_n_llhttp__internal__n_chunk_data_almost_done_skip,
+ s_n_llhttp__internal__n_chunk_data_almost_done,
+ s_n_llhttp__internal__n_consume_content_length,
+ s_n_llhttp__internal__n_span_start_llhttp__on_body,
+ s_n_llhttp__internal__n_invoke_is_equal_content_length,
+ s_n_llhttp__internal__n_chunk_size_almost_done,
+ s_n_llhttp__internal__n_chunk_parameters,
+ s_n_llhttp__internal__n_chunk_size_otherwise,
+ s_n_llhttp__internal__n_chunk_size,
+ s_n_llhttp__internal__n_invoke_update_content_length,
+ s_n_llhttp__internal__n_consume_content_length_1,
+ s_n_llhttp__internal__n_span_start_llhttp__on_body_1,
+ s_n_llhttp__internal__n_eof,
+ s_n_llhttp__internal__n_span_start_llhttp__on_body_2,
+ s_n_llhttp__internal__n_invoke_llhttp__after_headers_complete,
+ s_n_llhttp__internal__n_headers_almost_done,
+ s_n_llhttp__internal__n_span_start_llhttp__on_header_value,
+ s_n_llhttp__internal__n_header_value_discard_lws,
+ s_n_llhttp__internal__n_header_value_discard_ws_almost_done,
+ s_n_llhttp__internal__n_header_value_lws,
+ s_n_llhttp__internal__n_header_value_almost_done,
+ s_n_llhttp__internal__n_header_value_otherwise,
+ s_n_llhttp__internal__n_header_value_connection_token,
+ s_n_llhttp__internal__n_header_value_connection_ws,
+ s_n_llhttp__internal__n_header_value_connection_1,
+ s_n_llhttp__internal__n_header_value_connection_2,
+ s_n_llhttp__internal__n_header_value_connection_3,
+ s_n_llhttp__internal__n_header_value_connection,
+ s_n_llhttp__internal__n_error_14,
+ s_n_llhttp__internal__n_header_value,
+ s_n_llhttp__internal__n_header_value_discard_rws,
+ s_n_llhttp__internal__n_error_15,
+ s_n_llhttp__internal__n_header_value_content_length_ws,
+ s_n_llhttp__internal__n_header_value_content_length,
+ s_n_llhttp__internal__n_header_value_te_chunked_1,
+ s_n_llhttp__internal__n_header_value_te_chunked,
+ s_n_llhttp__internal__n_span_start_llhttp__on_header_value_1,
+ s_n_llhttp__internal__n_header_value_discard_ws,
+ s_n_llhttp__internal__n_header_field_general_otherwise,
+ s_n_llhttp__internal__n_header_field_general,
+ s_n_llhttp__internal__n_header_field_colon,
+ s_n_llhttp__internal__n_header_field_3,
+ s_n_llhttp__internal__n_header_field_4,
+ s_n_llhttp__internal__n_header_field_2,
+ s_n_llhttp__internal__n_header_field_1,
+ s_n_llhttp__internal__n_header_field_5,
+ s_n_llhttp__internal__n_header_field_6,
+ s_n_llhttp__internal__n_header_field_7,
+ s_n_llhttp__internal__n_header_field,
+ s_n_llhttp__internal__n_span_start_llhttp__on_header_field,
+ s_n_llhttp__internal__n_header_field_start,
+ s_n_llhttp__internal__n_url_skip_to_http09,
+ s_n_llhttp__internal__n_url_skip_lf_to_http09,
+ s_n_llhttp__internal__n_req_http_end_1,
+ s_n_llhttp__internal__n_req_http_end,
+ s_n_llhttp__internal__n_req_http_minor,
+ s_n_llhttp__internal__n_req_http_dot,
+ s_n_llhttp__internal__n_req_http_major,
+ s_n_llhttp__internal__n_req_http_start_1,
+ s_n_llhttp__internal__n_req_http_start_2,
+ s_n_llhttp__internal__n_req_http_start,
+ s_n_llhttp__internal__n_url_skip_to_http,
+ s_n_llhttp__internal__n_url_fragment,
+ s_n_llhttp__internal__n_span_end_stub_query_3,
+ s_n_llhttp__internal__n_url_query,
+ s_n_llhttp__internal__n_url_query_or_fragment,
+ s_n_llhttp__internal__n_url_path,
+ s_n_llhttp__internal__n_span_start_stub_path_2,
+ s_n_llhttp__internal__n_span_start_stub_path,
+ s_n_llhttp__internal__n_span_start_stub_path_1,
+ s_n_llhttp__internal__n_url_server_with_at,
+ s_n_llhttp__internal__n_url_server,
+ s_n_llhttp__internal__n_url_schema_delim_1,
+ s_n_llhttp__internal__n_url_schema_delim,
+ s_n_llhttp__internal__n_span_end_stub_schema,
+ s_n_llhttp__internal__n_url_schema,
+ s_n_llhttp__internal__n_url_start,
+ s_n_llhttp__internal__n_span_start_llhttp__on_url_1,
+ s_n_llhttp__internal__n_span_start_llhttp__on_url,
+ s_n_llhttp__internal__n_req_spaces_before_url,
+ s_n_llhttp__internal__n_req_first_space_before_url,
+ s_n_llhttp__internal__n_start_req_1,
+ s_n_llhttp__internal__n_start_req_2,
+ s_n_llhttp__internal__n_start_req_4,
+ s_n_llhttp__internal__n_start_req_6,
+ s_n_llhttp__internal__n_start_req_7,
+ s_n_llhttp__internal__n_start_req_5,
+ s_n_llhttp__internal__n_start_req_3,
+ s_n_llhttp__internal__n_start_req_8,
+ s_n_llhttp__internal__n_start_req_9,
+ s_n_llhttp__internal__n_start_req_10,
+ s_n_llhttp__internal__n_start_req_12,
+ s_n_llhttp__internal__n_start_req_13,
+ s_n_llhttp__internal__n_start_req_11,
+ s_n_llhttp__internal__n_start_req_15,
+ s_n_llhttp__internal__n_start_req_16,
+ s_n_llhttp__internal__n_start_req_18,
+ s_n_llhttp__internal__n_start_req_20,
+ s_n_llhttp__internal__n_start_req_21,
+ s_n_llhttp__internal__n_start_req_19,
+ s_n_llhttp__internal__n_start_req_17,
+ s_n_llhttp__internal__n_start_req_22,
+ s_n_llhttp__internal__n_start_req_14,
+ s_n_llhttp__internal__n_start_req_23,
+ s_n_llhttp__internal__n_start_req_24,
+ s_n_llhttp__internal__n_start_req_26,
+ s_n_llhttp__internal__n_start_req_27,
+ s_n_llhttp__internal__n_start_req_30,
+ s_n_llhttp__internal__n_start_req_31,
+ s_n_llhttp__internal__n_start_req_29,
+ s_n_llhttp__internal__n_start_req_28,
+ s_n_llhttp__internal__n_start_req_33,
+ s_n_llhttp__internal__n_start_req_32,
+ s_n_llhttp__internal__n_start_req_25,
+ s_n_llhttp__internal__n_start_req_36,
+ s_n_llhttp__internal__n_start_req_37,
+ s_n_llhttp__internal__n_start_req_35,
+ s_n_llhttp__internal__n_start_req_34,
+ s_n_llhttp__internal__n_start_req_39,
+ s_n_llhttp__internal__n_start_req_40,
+ s_n_llhttp__internal__n_start_req_41,
+ s_n_llhttp__internal__n_start_req_38,
+ s_n_llhttp__internal__n_start_req_42,
+ s_n_llhttp__internal__n_start_req_45,
+ s_n_llhttp__internal__n_start_req_47,
+ s_n_llhttp__internal__n_start_req_48,
+ s_n_llhttp__internal__n_start_req_46,
+ s_n_llhttp__internal__n_start_req_49,
+ s_n_llhttp__internal__n_start_req_44,
+ s_n_llhttp__internal__n_start_req_43,
+ s_n_llhttp__internal__n_start_req,
+ s_n_llhttp__internal__n_res_line_almost_done,
+ s_n_llhttp__internal__n_res_status,
+ s_n_llhttp__internal__n_span_start_llhttp__on_status,
+ s_n_llhttp__internal__n_res_status_start,
+ s_n_llhttp__internal__n_res_status_code_otherwise,
+ s_n_llhttp__internal__n_res_status_code,
+ s_n_llhttp__internal__n_res_http_end,
+ s_n_llhttp__internal__n_res_http_minor,
+ s_n_llhttp__internal__n_res_http_dot,
+ s_n_llhttp__internal__n_res_http_major,
+ s_n_llhttp__internal__n_start_res,
+ s_n_llhttp__internal__n_req_or_res_method_2,
+ s_n_llhttp__internal__n_req_or_res_method_3,
+ s_n_llhttp__internal__n_req_or_res_method_1,
+ s_n_llhttp__internal__n_req_or_res_method,
+ s_n_llhttp__internal__n_start_req_or_res,
+ s_n_llhttp__internal__n_invoke_load_type,
+ s_n_llhttp__internal__n_start,
+};
+typedef enum llparse_state_e llparse_state_t;
+
+int llhttp__on_url(
+ llhttp__internal_t* s, const unsigned char* p,
+ const unsigned char* endp);
+
+int llhttp__on_header_field(
+ llhttp__internal_t* s, const unsigned char* p,
+ const unsigned char* endp);
+
+int llhttp__on_header_value(
+ llhttp__internal_t* s, const unsigned char* p,
+ const unsigned char* endp);
+
+int llhttp__on_body(
+ llhttp__internal_t* s, const unsigned char* p,
+ const unsigned char* endp);
+
+int llhttp__on_status(
+ llhttp__internal_t* s, const unsigned char* p,
+ const unsigned char* endp);
+
+int llhttp__internal__c_update_finish(
+ llhttp__internal_t* state,
+ const unsigned char* p,
+ const unsigned char* endp) {
+ state->finish = 2;
+ return 0;
+}
+
+int llhttp__on_message_begin(
+ llhttp__internal_t* s, const unsigned char* p,
+ const unsigned char* endp);
+
+int llhttp__internal__c_load_type(
+ llhttp__internal_t* state,
+ const unsigned char* p,
+ const unsigned char* endp) {
+ return state->type;
+}
+
+int llhttp__internal__c_store_method(
+ llhttp__internal_t* state,
+ const unsigned char* p,
+ const unsigned char* endp,
+ int match) {
+ state->method = match;
+ return 0;
+}
+
+int llhttp__internal__c_is_equal_method(
+ llhttp__internal_t* state,
+ const unsigned char* p,
+ const unsigned char* endp) {
+ return state->method == 5;
+}
+
+int llhttp__internal__c_update_http_major(
+ llhttp__internal_t* state,
+ const unsigned char* p,
+ const unsigned char* endp) {
+ state->http_major = 0;
+ return 0;
+}
+
+int llhttp__internal__c_update_http_minor(
+ llhttp__internal_t* state,
+ const unsigned char* p,
+ const unsigned char* endp) {
+ state->http_minor = 9;
+ return 0;
+}
+
+int llhttp__internal__c_test_flags(
+ llhttp__internal_t* state,
+ const unsigned char* p,
+ const unsigned char* endp) {
+ return (state->flags & 128) == 128;
+}
+
+int llhttp__on_chunk_complete(
+ llhttp__internal_t* s, const unsigned char* p,
+ const unsigned char* endp);
+
+int llhttp__on_message_complete(
+ llhttp__internal_t* s, const unsigned char* p,
+ const unsigned char* endp);
+
+int llhttp__internal__c_is_equal_upgrade(
+ llhttp__internal_t* state,
+ const unsigned char* p,
+ const unsigned char* endp) {
+ return state->upgrade == 1;
+}
+
+int llhttp__after_message_complete(
+ llhttp__internal_t* s, const unsigned char* p,
+ const unsigned char* endp);
+
+int llhttp__internal__c_test_flags_1(
+ llhttp__internal_t* state,
+ const unsigned char* p,
+ const unsigned char* endp) {
+ return (state->flags & 40) == 40;
+}
+
+int llhttp__before_headers_complete(
+ llhttp__internal_t* s, const unsigned char* p,
+ const unsigned char* endp);
+
+int llhttp__on_headers_complete(
+ llhttp__internal_t* s, const unsigned char* p,
+ const unsigned char* endp);
+
+int llhttp__after_headers_complete(
+ llhttp__internal_t* s, const unsigned char* p,
+ const unsigned char* endp);
+
+int llhttp__internal__c_update_content_length(
+ llhttp__internal_t* state,
+ const unsigned char* p,
+ const unsigned char* endp) {
+ state->content_length = 0;
+ return 0;
+}
+
+int llhttp__internal__c_mul_add_content_length(
+ llhttp__internal_t* state,
+ const unsigned char* p,
+ const unsigned char* endp,
+ int match) {
+ /* Multiplication overflow */
+ if (state->content_length > 0xffffffffffffffffULL / 16) {
+ return 1;
+ }
+
+ state->content_length *= 16;
+
+ /* Addition overflow */
+ if (match >= 0) {
+ if (state->content_length > 0xffffffffffffffffULL - match) {
+ return 1;
+ }
+ } else {
+ if (state->content_length < 0ULL - match) {
+ return 1;
+ }
+ }
+ state->content_length += match;
+ return 0;
+}
+
+int llhttp__on_chunk_header(
+ llhttp__internal_t* s, const unsigned char* p,
+ const unsigned char* endp);
+
+int llhttp__internal__c_is_equal_content_length(
+ llhttp__internal_t* state,
+ const unsigned char* p,
+ const unsigned char* endp) {
+ return state->content_length == 0;
+}
+
+int llhttp__internal__c_or_flags(
+ llhttp__internal_t* state,
+ const unsigned char* p,
+ const unsigned char* endp) {
+ state->flags |= 128;
+ return 0;
+}
+
+int llhttp__internal__c_update_finish_1(
+ llhttp__internal_t* state,
+ const unsigned char* p,
+ const unsigned char* endp) {
+ state->finish = 1;
+ return 0;
+}
+
+int llhttp__internal__c_or_flags_1(
+ llhttp__internal_t* state,
+ const unsigned char* p,
+ const unsigned char* endp) {
+ state->flags |= 64;
+ return 0;
+}
+
+int llhttp__internal__c_update_upgrade(
+ llhttp__internal_t* state,
+ const unsigned char* p,
+ const unsigned char* endp) {
+ state->upgrade = 1;
+ return 0;
+}
+
+int llhttp__internal__c_store_header_state(
+ llhttp__internal_t* state,
+ const unsigned char* p,
+ const unsigned char* endp,
+ int match) {
+ state->header_state = match;
+ return 0;
+}
+
+int llhttp__internal__c_load_header_state(
+ llhttp__internal_t* state,
+ const unsigned char* p,
+ const unsigned char* endp) {
+ return state->header_state;
+}
+
+int llhttp__internal__c_or_flags_3(
+ llhttp__internal_t* state,
+ const unsigned char* p,
+ const unsigned char* endp) {
+ state->flags |= 1;
+ return 0;
+}
+
+int llhttp__internal__c_update_header_state(
+ llhttp__internal_t* state,
+ const unsigned char* p,
+ const unsigned char* endp) {
+ state->header_state = 1;
+ return 0;
+}
+
+int llhttp__internal__c_or_flags_4(
+ llhttp__internal_t* state,
+ const unsigned char* p,
+ const unsigned char* endp) {
+ state->flags |= 2;
+ return 0;
+}
+
+int llhttp__internal__c_or_flags_5(
+ llhttp__internal_t* state,
+ const unsigned char* p,
+ const unsigned char* endp) {
+ state->flags |= 4;
+ return 0;
+}
+
+int llhttp__internal__c_or_flags_6(
+ llhttp__internal_t* state,
+ const unsigned char* p,
+ const unsigned char* endp) {
+ state->flags |= 8;
+ return 0;
+}
+
+int llhttp__internal__c_update_header_state_2(
+ llhttp__internal_t* state,
+ const unsigned char* p,
+ const unsigned char* endp) {
+ state->header_state = 6;
+ return 0;
+}
+
+int llhttp__internal__c_update_header_state_4(
+ llhttp__internal_t* state,
+ const unsigned char* p,
+ const unsigned char* endp) {
+ state->header_state = 0;
+ return 0;
+}
+
+int llhttp__internal__c_update_header_state_5(
+ llhttp__internal_t* state,
+ const unsigned char* p,
+ const unsigned char* endp) {
+ state->header_state = 5;
+ return 0;
+}
+
+int llhttp__internal__c_update_header_state_6(
+ llhttp__internal_t* state,
+ const unsigned char* p,
+ const unsigned char* endp) {
+ state->header_state = 7;
+ return 0;
+}
+
+int llhttp__internal__c_test_flags_2(
+ llhttp__internal_t* state,
+ const unsigned char* p,
+ const unsigned char* endp) {
+ return (state->flags & 32) == 32;
+}
+
+int llhttp__internal__c_mul_add_content_length_1(
+ llhttp__internal_t* state,
+ const unsigned char* p,
+ const unsigned char* endp,
+ int match) {
+ /* Multiplication overflow */
+ if (state->content_length > 0xffffffffffffffffULL / 10) {
+ return 1;
+ }
+
+ state->content_length *= 10;
+
+ /* Addition overflow */
+ if (match >= 0) {
+ if (state->content_length > 0xffffffffffffffffULL - match) {
+ return 1;
+ }
+ } else {
+ if (state->content_length < 0ULL - match) {
+ return 1;
+ }
+ }
+ state->content_length += match;
+ return 0;
+}
+
+int llhttp__internal__c_or_flags_15(
+ llhttp__internal_t* state,
+ const unsigned char* p,
+ const unsigned char* endp) {
+ state->flags |= 32;
+ return 0;
+}
+
+int llhttp__internal__c_update_header_state_8(
+ llhttp__internal_t* state,
+ const unsigned char* p,
+ const unsigned char* endp) {
+ state->header_state = 8;
+ return 0;
+}
+
+int llhttp__internal__c_or_flags_16(
+ llhttp__internal_t* state,
+ const unsigned char* p,
+ const unsigned char* endp) {
+ state->flags |= 16;
+ return 0;
+}
+
+int llhttp__internal__c_store_http_major(
+ llhttp__internal_t* state,
+ const unsigned char* p,
+ const unsigned char* endp,
+ int match) {
+ state->http_major = match;
+ return 0;
+}
+
+int llhttp__internal__c_store_http_minor(
+ llhttp__internal_t* state,
+ const unsigned char* p,
+ const unsigned char* endp,
+ int match) {
+ state->http_minor = match;
+ return 0;
+}
+
+int llhttp__internal__c_is_equal_method_1(
+ llhttp__internal_t* state,
+ const unsigned char* p,
+ const unsigned char* endp) {
+ return state->method == 33;
+}
+
+int llhttp__internal__c_update_status_code(
+ llhttp__internal_t* state,
+ const unsigned char* p,
+ const unsigned char* endp) {
+ state->status_code = 0;
+ return 0;
+}
+
+int llhttp__internal__c_mul_add_status_code(
+ llhttp__internal_t* state,
+ const unsigned char* p,
+ const unsigned char* endp,
+ int match) {
+ /* Multiplication overflow */
+ if (state->status_code > 0xffff / 10) {
+ return 1;
+ }
+
+ state->status_code *= 10;
+
+ /* Addition overflow */
+ if (match >= 0) {
+ if (state->status_code > 0xffff - match) {
+ return 1;
+ }
+ } else {
+ if (state->status_code < 0 - match) {
+ return 1;
+ }
+ }
+ state->status_code += match;
+
+ /* Enforce maximum */
+ if (state->status_code > 999) {
+ return 1;
+ }
+ return 0;
+}
+
+int llhttp__internal__c_update_type(
+ llhttp__internal_t* state,
+ const unsigned char* p,
+ const unsigned char* endp) {
+ state->type = 1;
+ return 0;
+}
+
+int llhttp__internal__c_update_type_1(
+ llhttp__internal_t* state,
+ const unsigned char* p,
+ const unsigned char* endp) {
+ state->type = 2;
+ return 0;
+}
+
+int llhttp__internal_init(llhttp__internal_t* state) {
+ memset(state, 0, sizeof(*state));
+ state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_start;
+ return 0;
+}
+
+static llparse_state_t llhttp__internal__run(
+ llhttp__internal_t* state,
+ const unsigned char* p,
+ const unsigned char* endp) {
+ int match;
+ switch ((llparse_state_t) (intptr_t) state->_current) {
+ case s_n_llhttp__internal__n_invoke_llhttp__after_message_complete:
+ s_n_llhttp__internal__n_invoke_llhttp__after_message_complete: {
+ switch (llhttp__after_message_complete(state, p, endp)) {
+ default:
+ goto s_n_llhttp__internal__n_start;
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_pause_1:
+ s_n_llhttp__internal__n_pause_1: {
+ state->error = 0x15;
+ state->reason = "Pause on CONNECT/Upgrade";
+ state->error_pos = (const char*) p;
+ state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_invoke_llhttp__after_message_complete;
+ return s_error;
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_invoke_is_equal_upgrade:
+ s_n_llhttp__internal__n_invoke_is_equal_upgrade: {
+ switch (llhttp__internal__c_is_equal_upgrade(state, p, endp)) {
+ case 0:
+ goto s_n_llhttp__internal__n_invoke_llhttp__after_message_complete;
+ default:
+ goto s_n_llhttp__internal__n_pause_1;
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_invoke_llhttp__on_message_complete_2:
+ s_n_llhttp__internal__n_invoke_llhttp__on_message_complete_2: {
+ switch (llhttp__on_message_complete(state, p, endp)) {
+ case 0:
+ goto s_n_llhttp__internal__n_invoke_is_equal_upgrade;
+ case 20:
+ goto s_n_llhttp__internal__n_pause_5;
+ default:
+ goto s_n_llhttp__internal__n_error_8;
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_chunk_data_almost_done_skip:
+ s_n_llhttp__internal__n_chunk_data_almost_done_skip: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_chunk_data_almost_done_skip;
+ }
+ p++;
+ goto s_n_llhttp__internal__n_invoke_llhttp__on_chunk_complete;
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_chunk_data_almost_done:
+ s_n_llhttp__internal__n_chunk_data_almost_done: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_chunk_data_almost_done;
+ }
+ p++;
+ goto s_n_llhttp__internal__n_chunk_data_almost_done_skip;
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_consume_content_length:
+ s_n_llhttp__internal__n_consume_content_length: {
+ size_t avail;
+ size_t need;
+
+ avail = endp - p;
+ need = state->content_length;
+ if (avail >= need) {
+ p += need;
+ state->content_length = 0;
+ goto s_n_llhttp__internal__n_span_end_llhttp__on_body;
+ }
+
+ state->content_length -= avail;
+ return s_n_llhttp__internal__n_consume_content_length;
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_span_start_llhttp__on_body:
+ s_n_llhttp__internal__n_span_start_llhttp__on_body: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_span_start_llhttp__on_body;
+ }
+ state->_span_pos0 = (void*) p;
+ state->_span_cb0 = llhttp__on_body;
+ goto s_n_llhttp__internal__n_consume_content_length;
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_invoke_is_equal_content_length:
+ s_n_llhttp__internal__n_invoke_is_equal_content_length: {
+ switch (llhttp__internal__c_is_equal_content_length(state, p, endp)) {
+ case 0:
+ goto s_n_llhttp__internal__n_span_start_llhttp__on_body;
+ default:
+ goto s_n_llhttp__internal__n_invoke_or_flags;
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_chunk_size_almost_done:
+ s_n_llhttp__internal__n_chunk_size_almost_done: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_chunk_size_almost_done;
+ }
+ p++;
+ goto s_n_llhttp__internal__n_invoke_llhttp__on_chunk_header;
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_chunk_parameters:
+ s_n_llhttp__internal__n_chunk_parameters: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_chunk_parameters;
+ }
+ switch (*p) {
+ case 13: {
+ p++;
+ goto s_n_llhttp__internal__n_chunk_size_almost_done;
+ }
+ default: {
+ p++;
+ goto s_n_llhttp__internal__n_chunk_parameters;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_chunk_size_otherwise:
+ s_n_llhttp__internal__n_chunk_size_otherwise: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_chunk_size_otherwise;
+ }
+ switch (*p) {
+ case 13: {
+ p++;
+ goto s_n_llhttp__internal__n_chunk_size_almost_done;
+ }
+ case ' ': {
+ p++;
+ goto s_n_llhttp__internal__n_chunk_parameters;
+ }
+ case ';': {
+ p++;
+ goto s_n_llhttp__internal__n_chunk_parameters;
+ }
+ default: {
+ goto s_n_llhttp__internal__n_error_7;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_chunk_size:
+ s_n_llhttp__internal__n_chunk_size: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_chunk_size;
+ }
+ switch (*p) {
+ case '0': {
+ p++;
+ match = 0;
+ goto s_n_llhttp__internal__n_invoke_mul_add_content_length;
+ }
+ case '1': {
+ p++;
+ match = 1;
+ goto s_n_llhttp__internal__n_invoke_mul_add_content_length;
+ }
+ case '2': {
+ p++;
+ match = 2;
+ goto s_n_llhttp__internal__n_invoke_mul_add_content_length;
+ }
+ case '3': {
+ p++;
+ match = 3;
+ goto s_n_llhttp__internal__n_invoke_mul_add_content_length;
+ }
+ case '4': {
+ p++;
+ match = 4;
+ goto s_n_llhttp__internal__n_invoke_mul_add_content_length;
+ }
+ case '5': {
+ p++;
+ match = 5;
+ goto s_n_llhttp__internal__n_invoke_mul_add_content_length;
+ }
+ case '6': {
+ p++;
+ match = 6;
+ goto s_n_llhttp__internal__n_invoke_mul_add_content_length;
+ }
+ case '7': {
+ p++;
+ match = 7;
+ goto s_n_llhttp__internal__n_invoke_mul_add_content_length;
+ }
+ case '8': {
+ p++;
+ match = 8;
+ goto s_n_llhttp__internal__n_invoke_mul_add_content_length;
+ }
+ case '9': {
+ p++;
+ match = 9;
+ goto s_n_llhttp__internal__n_invoke_mul_add_content_length;
+ }
+ case 'A': {
+ p++;
+ match = 10;
+ goto s_n_llhttp__internal__n_invoke_mul_add_content_length;
+ }
+ case 'B': {
+ p++;
+ match = 11;
+ goto s_n_llhttp__internal__n_invoke_mul_add_content_length;
+ }
+ case 'C': {
+ p++;
+ match = 12;
+ goto s_n_llhttp__internal__n_invoke_mul_add_content_length;
+ }
+ case 'D': {
+ p++;
+ match = 13;
+ goto s_n_llhttp__internal__n_invoke_mul_add_content_length;
+ }
+ case 'E': {
+ p++;
+ match = 14;
+ goto s_n_llhttp__internal__n_invoke_mul_add_content_length;
+ }
+ case 'F': {
+ p++;
+ match = 15;
+ goto s_n_llhttp__internal__n_invoke_mul_add_content_length;
+ }
+ case 'a': {
+ p++;
+ match = 10;
+ goto s_n_llhttp__internal__n_invoke_mul_add_content_length;
+ }
+ case 'b': {
+ p++;
+ match = 11;
+ goto s_n_llhttp__internal__n_invoke_mul_add_content_length;
+ }
+ case 'c': {
+ p++;
+ match = 12;
+ goto s_n_llhttp__internal__n_invoke_mul_add_content_length;
+ }
+ case 'd': {
+ p++;
+ match = 13;
+ goto s_n_llhttp__internal__n_invoke_mul_add_content_length;
+ }
+ case 'e': {
+ p++;
+ match = 14;
+ goto s_n_llhttp__internal__n_invoke_mul_add_content_length;
+ }
+ case 'f': {
+ p++;
+ match = 15;
+ goto s_n_llhttp__internal__n_invoke_mul_add_content_length;
+ }
+ default: {
+ goto s_n_llhttp__internal__n_chunk_size_otherwise;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_invoke_update_content_length:
+ s_n_llhttp__internal__n_invoke_update_content_length: {
+ switch (llhttp__internal__c_update_content_length(state, p, endp)) {
+ default:
+ goto s_n_llhttp__internal__n_chunk_size;
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_consume_content_length_1:
+ s_n_llhttp__internal__n_consume_content_length_1: {
+ size_t avail;
+ size_t need;
+
+ avail = endp - p;
+ need = state->content_length;
+ if (avail >= need) {
+ p += need;
+ state->content_length = 0;
+ goto s_n_llhttp__internal__n_span_end_llhttp__on_body_1;
+ }
+
+ state->content_length -= avail;
+ return s_n_llhttp__internal__n_consume_content_length_1;
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_span_start_llhttp__on_body_1:
+ s_n_llhttp__internal__n_span_start_llhttp__on_body_1: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_span_start_llhttp__on_body_1;
+ }
+ state->_span_pos0 = (void*) p;
+ state->_span_cb0 = llhttp__on_body;
+ goto s_n_llhttp__internal__n_consume_content_length_1;
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_eof:
+ s_n_llhttp__internal__n_eof: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_eof;
+ }
+ p++;
+ goto s_n_llhttp__internal__n_eof;
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_span_start_llhttp__on_body_2:
+ s_n_llhttp__internal__n_span_start_llhttp__on_body_2: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_span_start_llhttp__on_body_2;
+ }
+ state->_span_pos0 = (void*) p;
+ state->_span_cb0 = llhttp__on_body;
+ goto s_n_llhttp__internal__n_invoke_update_finish_1;
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_invoke_llhttp__after_headers_complete:
+ s_n_llhttp__internal__n_invoke_llhttp__after_headers_complete: {
+ switch (llhttp__after_headers_complete(state, p, endp)) {
+ case 1:
+ goto s_n_llhttp__internal__n_invoke_llhttp__on_message_complete_1;
+ case 2:
+ goto s_n_llhttp__internal__n_invoke_update_content_length;
+ case 3:
+ goto s_n_llhttp__internal__n_span_start_llhttp__on_body_1;
+ case 4:
+ goto s_n_llhttp__internal__n_span_start_llhttp__on_body_2;
+ default:
+ goto s_n_llhttp__internal__n_invoke_llhttp__on_message_complete;
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_headers_almost_done:
+ s_n_llhttp__internal__n_headers_almost_done: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_headers_almost_done;
+ }
+ p++;
+ goto s_n_llhttp__internal__n_invoke_test_flags;
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_span_start_llhttp__on_header_value:
+ s_n_llhttp__internal__n_span_start_llhttp__on_header_value: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_span_start_llhttp__on_header_value;
+ }
+ state->_span_pos0 = (void*) p;
+ state->_span_cb0 = llhttp__on_header_value;
+ goto s_n_llhttp__internal__n_span_end_llhttp__on_header_value;
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_header_value_discard_lws:
+ s_n_llhttp__internal__n_header_value_discard_lws: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_header_value_discard_lws;
+ }
+ switch (*p) {
+ case 9: {
+ p++;
+ goto s_n_llhttp__internal__n_header_value_discard_ws;
+ }
+ case ' ': {
+ p++;
+ goto s_n_llhttp__internal__n_header_value_discard_ws;
+ }
+ default: {
+ goto s_n_llhttp__internal__n_invoke_load_header_state;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_header_value_discard_ws_almost_done:
+ s_n_llhttp__internal__n_header_value_discard_ws_almost_done: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_header_value_discard_ws_almost_done;
+ }
+ p++;
+ goto s_n_llhttp__internal__n_header_value_discard_lws;
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_header_value_lws:
+ s_n_llhttp__internal__n_header_value_lws: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_header_value_lws;
+ }
+ switch (*p) {
+ case 9: {
+ goto s_n_llhttp__internal__n_span_start_llhttp__on_header_value_1;
+ }
+ case ' ': {
+ goto s_n_llhttp__internal__n_span_start_llhttp__on_header_value_1;
+ }
+ default: {
+ goto s_n_llhttp__internal__n_invoke_load_header_state_2;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_header_value_almost_done:
+ s_n_llhttp__internal__n_header_value_almost_done: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_header_value_almost_done;
+ }
+ switch (*p) {
+ case 10: {
+ p++;
+ goto s_n_llhttp__internal__n_header_value_lws;
+ }
+ default: {
+ goto s_n_llhttp__internal__n_error_11;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_header_value_otherwise:
+ s_n_llhttp__internal__n_header_value_otherwise: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_header_value_otherwise;
+ }
+ switch (*p) {
+ case 10: {
+ goto s_n_llhttp__internal__n_span_end_llhttp__on_header_value_1;
+ }
+ case 13: {
+ goto s_n_llhttp__internal__n_span_end_llhttp__on_header_value_2;
+ }
+ default: {
+ goto s_n_llhttp__internal__n_error_12;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_header_value_connection_token:
+ s_n_llhttp__internal__n_header_value_connection_token: {
+ static uint8_t lookup_table[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0
+ };
+ if (p == endp) {
+ return s_n_llhttp__internal__n_header_value_connection_token;
+ }
+ switch (lookup_table[(uint8_t) *p]) {
+ case 1: {
+ p++;
+ goto s_n_llhttp__internal__n_header_value_connection_token;
+ }
+ case 2: {
+ p++;
+ goto s_n_llhttp__internal__n_header_value_connection;
+ }
+ default: {
+ goto s_n_llhttp__internal__n_header_value_otherwise;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_header_value_connection_ws:
+ s_n_llhttp__internal__n_header_value_connection_ws: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_header_value_connection_ws;
+ }
+ switch (*p) {
+ case 10: {
+ goto s_n_llhttp__internal__n_header_value_otherwise;
+ }
+ case 13: {
+ goto s_n_llhttp__internal__n_header_value_otherwise;
+ }
+ case ' ': {
+ p++;
+ goto s_n_llhttp__internal__n_header_value_connection_ws;
+ }
+ case ',': {
+ p++;
+ goto s_n_llhttp__internal__n_invoke_load_header_state_3;
+ }
+ default: {
+ goto s_n_llhttp__internal__n_invoke_update_header_state_4;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_header_value_connection_1:
+ s_n_llhttp__internal__n_header_value_connection_1: {
+ llparse_match_t match_seq;
+
+ if (p == endp) {
+ return s_n_llhttp__internal__n_header_value_connection_1;
+ }
+ match_seq = llparse__match_sequence_to_lower_unsafe(state, p, endp, llparse_blob3, 4);
+ p = match_seq.current;
+ switch (match_seq.status) {
+ case kMatchComplete: {
+ p++;
+ goto s_n_llhttp__internal__n_invoke_update_header_state_2;
+ }
+ case kMatchPause: {
+ return s_n_llhttp__internal__n_header_value_connection_1;
+ }
+ case kMatchMismatch: {
+ goto s_n_llhttp__internal__n_header_value_connection_token;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_header_value_connection_2:
+ s_n_llhttp__internal__n_header_value_connection_2: {
+ llparse_match_t match_seq;
+
+ if (p == endp) {
+ return s_n_llhttp__internal__n_header_value_connection_2;
+ }
+ match_seq = llparse__match_sequence_to_lower_unsafe(state, p, endp, llparse_blob4, 9);
+ p = match_seq.current;
+ switch (match_seq.status) {
+ case kMatchComplete: {
+ p++;
+ goto s_n_llhttp__internal__n_invoke_update_header_state_5;
+ }
+ case kMatchPause: {
+ return s_n_llhttp__internal__n_header_value_connection_2;
+ }
+ case kMatchMismatch: {
+ goto s_n_llhttp__internal__n_header_value_connection_token;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_header_value_connection_3:
+ s_n_llhttp__internal__n_header_value_connection_3: {
+ llparse_match_t match_seq;
+
+ if (p == endp) {
+ return s_n_llhttp__internal__n_header_value_connection_3;
+ }
+ match_seq = llparse__match_sequence_to_lower_unsafe(state, p, endp, llparse_blob5, 6);
+ p = match_seq.current;
+ switch (match_seq.status) {
+ case kMatchComplete: {
+ p++;
+ goto s_n_llhttp__internal__n_invoke_update_header_state_6;
+ }
+ case kMatchPause: {
+ return s_n_llhttp__internal__n_header_value_connection_3;
+ }
+ case kMatchMismatch: {
+ goto s_n_llhttp__internal__n_header_value_connection_token;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_header_value_connection:
+ s_n_llhttp__internal__n_header_value_connection: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_header_value_connection;
+ }
+ switch (((*p) | 0x20)) {
+ case 9: {
+ p++;
+ goto s_n_llhttp__internal__n_header_value_connection;
+ }
+ case ' ': {
+ p++;
+ goto s_n_llhttp__internal__n_header_value_connection;
+ }
+ case 'c': {
+ p++;
+ goto s_n_llhttp__internal__n_header_value_connection_1;
+ }
+ case 'k': {
+ p++;
+ goto s_n_llhttp__internal__n_header_value_connection_2;
+ }
+ case 'u': {
+ p++;
+ goto s_n_llhttp__internal__n_header_value_connection_3;
+ }
+ default: {
+ goto s_n_llhttp__internal__n_header_value_connection_token;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_error_14:
+ s_n_llhttp__internal__n_error_14: {
+ state->error = 0xb;
+ state->reason = "Content-Length overflow";
+ state->error_pos = (const char*) p;
+ state->_current = (void*) (intptr_t) s_error;
+ return s_error;
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_header_value:
+ s_n_llhttp__internal__n_header_value: {
+ static uint8_t lookup_table[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0
+ };
+ if (p == endp) {
+ return s_n_llhttp__internal__n_header_value;
+ }
+ switch (lookup_table[(uint8_t) *p]) {
+ case 1: {
+ p++;
+ goto s_n_llhttp__internal__n_header_value;
+ }
+ default: {
+ goto s_n_llhttp__internal__n_header_value_otherwise;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_header_value_discard_rws:
+ s_n_llhttp__internal__n_header_value_discard_rws: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_header_value_discard_rws;
+ }
+ switch (*p) {
+ case 10: {
+ goto s_n_llhttp__internal__n_header_value_otherwise;
+ }
+ case 13: {
+ goto s_n_llhttp__internal__n_header_value_otherwise;
+ }
+ case ' ': {
+ p++;
+ goto s_n_llhttp__internal__n_header_value_discard_rws;
+ }
+ default: {
+ goto s_n_llhttp__internal__n_invoke_update_header_state_7;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_error_15:
+ s_n_llhttp__internal__n_error_15: {
+ state->error = 0xb;
+ state->reason = "Invalid character in Content-Length";
+ state->error_pos = (const char*) p;
+ state->_current = (void*) (intptr_t) s_error;
+ return s_error;
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_header_value_content_length_ws:
+ s_n_llhttp__internal__n_header_value_content_length_ws: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_header_value_content_length_ws;
+ }
+ switch (*p) {
+ case 10: {
+ goto s_n_llhttp__internal__n_invoke_or_flags_15;
+ }
+ case 13: {
+ goto s_n_llhttp__internal__n_invoke_or_flags_15;
+ }
+ case ' ': {
+ p++;
+ goto s_n_llhttp__internal__n_header_value_content_length_ws;
+ }
+ default: {
+ goto s_n_llhttp__internal__n_span_end_llhttp__on_header_value_4;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_header_value_content_length:
+ s_n_llhttp__internal__n_header_value_content_length: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_header_value_content_length;
+ }
+ switch (*p) {
+ case '0': {
+ p++;
+ match = 0;
+ goto s_n_llhttp__internal__n_invoke_mul_add_content_length_1;
+ }
+ case '1': {
+ p++;
+ match = 1;
+ goto s_n_llhttp__internal__n_invoke_mul_add_content_length_1;
+ }
+ case '2': {
+ p++;
+ match = 2;
+ goto s_n_llhttp__internal__n_invoke_mul_add_content_length_1;
+ }
+ case '3': {
+ p++;
+ match = 3;
+ goto s_n_llhttp__internal__n_invoke_mul_add_content_length_1;
+ }
+ case '4': {
+ p++;
+ match = 4;
+ goto s_n_llhttp__internal__n_invoke_mul_add_content_length_1;
+ }
+ case '5': {
+ p++;
+ match = 5;
+ goto s_n_llhttp__internal__n_invoke_mul_add_content_length_1;
+ }
+ case '6': {
+ p++;
+ match = 6;
+ goto s_n_llhttp__internal__n_invoke_mul_add_content_length_1;
+ }
+ case '7': {
+ p++;
+ match = 7;
+ goto s_n_llhttp__internal__n_invoke_mul_add_content_length_1;
+ }
+ case '8': {
+ p++;
+ match = 8;
+ goto s_n_llhttp__internal__n_invoke_mul_add_content_length_1;
+ }
+ case '9': {
+ p++;
+ match = 9;
+ goto s_n_llhttp__internal__n_invoke_mul_add_content_length_1;
+ }
+ default: {
+ goto s_n_llhttp__internal__n_header_value_content_length_ws;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_header_value_te_chunked_1:
+ s_n_llhttp__internal__n_header_value_te_chunked_1: {
+ llparse_match_t match_seq;
+
+ if (p == endp) {
+ return s_n_llhttp__internal__n_header_value_te_chunked_1;
+ }
+ match_seq = llparse__match_sequence_to_lower_unsafe(state, p, endp, llparse_blob6, 6);
+ p = match_seq.current;
+ switch (match_seq.status) {
+ case kMatchComplete: {
+ p++;
+ goto s_n_llhttp__internal__n_invoke_update_header_state_8;
+ }
+ case kMatchPause: {
+ return s_n_llhttp__internal__n_header_value_te_chunked_1;
+ }
+ case kMatchMismatch: {
+ goto s_n_llhttp__internal__n_invoke_update_header_state_7;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_header_value_te_chunked:
+ s_n_llhttp__internal__n_header_value_te_chunked: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_header_value_te_chunked;
+ }
+ switch (((*p) | 0x20)) {
+ case 10: {
+ goto s_n_llhttp__internal__n_header_value_discard_rws;
+ }
+ case 13: {
+ goto s_n_llhttp__internal__n_header_value_discard_rws;
+ }
+ case ' ': {
+ goto s_n_llhttp__internal__n_header_value_discard_rws;
+ }
+ case 'c': {
+ p++;
+ goto s_n_llhttp__internal__n_header_value_te_chunked_1;
+ }
+ default: {
+ goto s_n_llhttp__internal__n_invoke_update_header_state_7;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_span_start_llhttp__on_header_value_1:
+ s_n_llhttp__internal__n_span_start_llhttp__on_header_value_1: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_span_start_llhttp__on_header_value_1;
+ }
+ state->_span_pos0 = (void*) p;
+ state->_span_cb0 = llhttp__on_header_value;
+ goto s_n_llhttp__internal__n_invoke_load_header_state_1;
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_header_value_discard_ws:
+ s_n_llhttp__internal__n_header_value_discard_ws: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_header_value_discard_ws;
+ }
+ switch (*p) {
+ case 9: {
+ p++;
+ goto s_n_llhttp__internal__n_header_value_discard_ws;
+ }
+ case 10: {
+ p++;
+ goto s_n_llhttp__internal__n_header_value_discard_lws;
+ }
+ case 13: {
+ p++;
+ goto s_n_llhttp__internal__n_header_value_discard_ws_almost_done;
+ }
+ case ' ': {
+ p++;
+ goto s_n_llhttp__internal__n_header_value_discard_ws;
+ }
+ default: {
+ goto s_n_llhttp__internal__n_span_start_llhttp__on_header_value_1;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_header_field_general_otherwise:
+ s_n_llhttp__internal__n_header_field_general_otherwise: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_header_field_general_otherwise;
+ }
+ switch (*p) {
+ case ':': {
+ goto s_n_llhttp__internal__n_span_end_llhttp__on_header_field_1;
+ }
+ default: {
+ goto s_n_llhttp__internal__n_error_16;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_header_field_general:
+ s_n_llhttp__internal__n_header_field_general: {
+ static uint8_t lookup_table[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0,
+ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ };
+ if (p == endp) {
+ return s_n_llhttp__internal__n_header_field_general;
+ }
+ switch (lookup_table[(uint8_t) *p]) {
+ case 1: {
+ p++;
+ goto s_n_llhttp__internal__n_header_field_general;
+ }
+ default: {
+ goto s_n_llhttp__internal__n_header_field_general_otherwise;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_header_field_colon:
+ s_n_llhttp__internal__n_header_field_colon: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_header_field_colon;
+ }
+ switch (*p) {
+ case ' ': {
+ p++;
+ goto s_n_llhttp__internal__n_header_field_colon;
+ }
+ case ':': {
+ goto s_n_llhttp__internal__n_span_end_llhttp__on_header_field;
+ }
+ default: {
+ goto s_n_llhttp__internal__n_invoke_update_header_state_9;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_header_field_3:
+ s_n_llhttp__internal__n_header_field_3: {
+ llparse_match_t match_seq;
+
+ if (p == endp) {
+ return s_n_llhttp__internal__n_header_field_3;
+ }
+ match_seq = llparse__match_sequence_to_lower_unsafe(state, p, endp, llparse_blob2, 6);
+ p = match_seq.current;
+ switch (match_seq.status) {
+ case kMatchComplete: {
+ p++;
+ match = 1;
+ goto s_n_llhttp__internal__n_invoke_store_header_state;
+ }
+ case kMatchPause: {
+ return s_n_llhttp__internal__n_header_field_3;
+ }
+ case kMatchMismatch: {
+ goto s_n_llhttp__internal__n_invoke_update_header_state_10;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_header_field_4:
+ s_n_llhttp__internal__n_header_field_4: {
+ llparse_match_t match_seq;
+
+ if (p == endp) {
+ return s_n_llhttp__internal__n_header_field_4;
+ }
+ match_seq = llparse__match_sequence_to_lower_unsafe(state, p, endp, llparse_blob7, 10);
+ p = match_seq.current;
+ switch (match_seq.status) {
+ case kMatchComplete: {
+ p++;
+ match = 2;
+ goto s_n_llhttp__internal__n_invoke_store_header_state;
+ }
+ case kMatchPause: {
+ return s_n_llhttp__internal__n_header_field_4;
+ }
+ case kMatchMismatch: {
+ goto s_n_llhttp__internal__n_invoke_update_header_state_10;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_header_field_2:
+ s_n_llhttp__internal__n_header_field_2: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_header_field_2;
+ }
+ switch (((*p) | 0x20)) {
+ case 'n': {
+ p++;
+ goto s_n_llhttp__internal__n_header_field_3;
+ }
+ case 't': {
+ p++;
+ goto s_n_llhttp__internal__n_header_field_4;
+ }
+ default: {
+ goto s_n_llhttp__internal__n_invoke_update_header_state_10;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_header_field_1:
+ s_n_llhttp__internal__n_header_field_1: {
+ llparse_match_t match_seq;
+
+ if (p == endp) {
+ return s_n_llhttp__internal__n_header_field_1;
+ }
+ match_seq = llparse__match_sequence_to_lower_unsafe(state, p, endp, llparse_blob1, 2);
+ p = match_seq.current;
+ switch (match_seq.status) {
+ case kMatchComplete: {
+ p++;
+ goto s_n_llhttp__internal__n_header_field_2;
+ }
+ case kMatchPause: {
+ return s_n_llhttp__internal__n_header_field_1;
+ }
+ case kMatchMismatch: {
+ goto s_n_llhttp__internal__n_invoke_update_header_state_10;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_header_field_5:
+ s_n_llhttp__internal__n_header_field_5: {
+ llparse_match_t match_seq;
+
+ if (p == endp) {
+ return s_n_llhttp__internal__n_header_field_5;
+ }
+ match_seq = llparse__match_sequence_to_lower_unsafe(state, p, endp, llparse_blob8, 15);
+ p = match_seq.current;
+ switch (match_seq.status) {
+ case kMatchComplete: {
+ p++;
+ match = 1;
+ goto s_n_llhttp__internal__n_invoke_store_header_state;
+ }
+ case kMatchPause: {
+ return s_n_llhttp__internal__n_header_field_5;
+ }
+ case kMatchMismatch: {
+ goto s_n_llhttp__internal__n_invoke_update_header_state_10;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_header_field_6:
+ s_n_llhttp__internal__n_header_field_6: {
+ llparse_match_t match_seq;
+
+ if (p == endp) {
+ return s_n_llhttp__internal__n_header_field_6;
+ }
+ match_seq = llparse__match_sequence_to_lower_unsafe(state, p, endp, llparse_blob9, 16);
+ p = match_seq.current;
+ switch (match_seq.status) {
+ case kMatchComplete: {
+ p++;
+ match = 3;
+ goto s_n_llhttp__internal__n_invoke_store_header_state;
+ }
+ case kMatchPause: {
+ return s_n_llhttp__internal__n_header_field_6;
+ }
+ case kMatchMismatch: {
+ goto s_n_llhttp__internal__n_invoke_update_header_state_10;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_header_field_7:
+ s_n_llhttp__internal__n_header_field_7: {
+ llparse_match_t match_seq;
+
+ if (p == endp) {
+ return s_n_llhttp__internal__n_header_field_7;
+ }
+ match_seq = llparse__match_sequence_to_lower_unsafe(state, p, endp, llparse_blob10, 6);
+ p = match_seq.current;
+ switch (match_seq.status) {
+ case kMatchComplete: {
+ p++;
+ match = 4;
+ goto s_n_llhttp__internal__n_invoke_store_header_state;
+ }
+ case kMatchPause: {
+ return s_n_llhttp__internal__n_header_field_7;
+ }
+ case kMatchMismatch: {
+ goto s_n_llhttp__internal__n_invoke_update_header_state_10;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_header_field:
+ s_n_llhttp__internal__n_header_field: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_header_field;
+ }
+ switch (((*p) | 0x20)) {
+ case 'c': {
+ p++;
+ goto s_n_llhttp__internal__n_header_field_1;
+ }
+ case 'p': {
+ p++;
+ goto s_n_llhttp__internal__n_header_field_5;
+ }
+ case 't': {
+ p++;
+ goto s_n_llhttp__internal__n_header_field_6;
+ }
+ case 'u': {
+ p++;
+ goto s_n_llhttp__internal__n_header_field_7;
+ }
+ default: {
+ goto s_n_llhttp__internal__n_invoke_update_header_state_10;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_span_start_llhttp__on_header_field:
+ s_n_llhttp__internal__n_span_start_llhttp__on_header_field: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_span_start_llhttp__on_header_field;
+ }
+ state->_span_pos0 = (void*) p;
+ state->_span_cb0 = llhttp__on_header_field;
+ goto s_n_llhttp__internal__n_header_field;
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_header_field_start:
+ s_n_llhttp__internal__n_header_field_start: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_header_field_start;
+ }
+ switch (*p) {
+ case 10: {
+ goto s_n_llhttp__internal__n_headers_almost_done;
+ }
+ case 13: {
+ p++;
+ goto s_n_llhttp__internal__n_headers_almost_done;
+ }
+ default: {
+ goto s_n_llhttp__internal__n_span_start_llhttp__on_header_field;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_url_skip_to_http09:
+ s_n_llhttp__internal__n_url_skip_to_http09: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_url_skip_to_http09;
+ }
+ p++;
+ goto s_n_llhttp__internal__n_invoke_update_http_major;
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_url_skip_lf_to_http09:
+ s_n_llhttp__internal__n_url_skip_lf_to_http09: {
+ llparse_match_t match_seq;
+
+ if (p == endp) {
+ return s_n_llhttp__internal__n_url_skip_lf_to_http09;
+ }
+ match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob11, 2);
+ p = match_seq.current;
+ switch (match_seq.status) {
+ case kMatchComplete: {
+ p++;
+ goto s_n_llhttp__internal__n_invoke_update_http_major;
+ }
+ case kMatchPause: {
+ return s_n_llhttp__internal__n_url_skip_lf_to_http09;
+ }
+ case kMatchMismatch: {
+ goto s_n_llhttp__internal__n_error_17;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_req_http_end_1:
+ s_n_llhttp__internal__n_req_http_end_1: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_req_http_end_1;
+ }
+ switch (*p) {
+ case 10: {
+ p++;
+ goto s_n_llhttp__internal__n_header_field_start;
+ }
+ default: {
+ goto s_n_llhttp__internal__n_error_18;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_req_http_end:
+ s_n_llhttp__internal__n_req_http_end: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_req_http_end;
+ }
+ switch (*p) {
+ case 10: {
+ p++;
+ goto s_n_llhttp__internal__n_header_field_start;
+ }
+ case 13: {
+ p++;
+ goto s_n_llhttp__internal__n_req_http_end_1;
+ }
+ default: {
+ goto s_n_llhttp__internal__n_error_18;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_req_http_minor:
+ s_n_llhttp__internal__n_req_http_minor: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_req_http_minor;
+ }
+ switch (*p) {
+ case '0': {
+ p++;
+ match = 0;
+ goto s_n_llhttp__internal__n_invoke_store_http_minor;
+ }
+ case '1': {
+ p++;
+ match = 1;
+ goto s_n_llhttp__internal__n_invoke_store_http_minor;
+ }
+ case '2': {
+ p++;
+ match = 2;
+ goto s_n_llhttp__internal__n_invoke_store_http_minor;
+ }
+ case '3': {
+ p++;
+ match = 3;
+ goto s_n_llhttp__internal__n_invoke_store_http_minor;
+ }
+ case '4': {
+ p++;
+ match = 4;
+ goto s_n_llhttp__internal__n_invoke_store_http_minor;
+ }
+ case '5': {
+ p++;
+ match = 5;
+ goto s_n_llhttp__internal__n_invoke_store_http_minor;
+ }
+ case '6': {
+ p++;
+ match = 6;
+ goto s_n_llhttp__internal__n_invoke_store_http_minor;
+ }
+ case '7': {
+ p++;
+ match = 7;
+ goto s_n_llhttp__internal__n_invoke_store_http_minor;
+ }
+ case '8': {
+ p++;
+ match = 8;
+ goto s_n_llhttp__internal__n_invoke_store_http_minor;
+ }
+ case '9': {
+ p++;
+ match = 9;
+ goto s_n_llhttp__internal__n_invoke_store_http_minor;
+ }
+ default: {
+ goto s_n_llhttp__internal__n_error_19;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_req_http_dot:
+ s_n_llhttp__internal__n_req_http_dot: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_req_http_dot;
+ }
+ switch (*p) {
+ case '.': {
+ p++;
+ goto s_n_llhttp__internal__n_req_http_minor;
+ }
+ default: {
+ goto s_n_llhttp__internal__n_error_20;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_req_http_major:
+ s_n_llhttp__internal__n_req_http_major: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_req_http_major;
+ }
+ switch (*p) {
+ case '0': {
+ p++;
+ match = 0;
+ goto s_n_llhttp__internal__n_invoke_store_http_major;
+ }
+ case '1': {
+ p++;
+ match = 1;
+ goto s_n_llhttp__internal__n_invoke_store_http_major;
+ }
+ case '2': {
+ p++;
+ match = 2;
+ goto s_n_llhttp__internal__n_invoke_store_http_major;
+ }
+ case '3': {
+ p++;
+ match = 3;
+ goto s_n_llhttp__internal__n_invoke_store_http_major;
+ }
+ case '4': {
+ p++;
+ match = 4;
+ goto s_n_llhttp__internal__n_invoke_store_http_major;
+ }
+ case '5': {
+ p++;
+ match = 5;
+ goto s_n_llhttp__internal__n_invoke_store_http_major;
+ }
+ case '6': {
+ p++;
+ match = 6;
+ goto s_n_llhttp__internal__n_invoke_store_http_major;
+ }
+ case '7': {
+ p++;
+ match = 7;
+ goto s_n_llhttp__internal__n_invoke_store_http_major;
+ }
+ case '8': {
+ p++;
+ match = 8;
+ goto s_n_llhttp__internal__n_invoke_store_http_major;
+ }
+ case '9': {
+ p++;
+ match = 9;
+ goto s_n_llhttp__internal__n_invoke_store_http_major;
+ }
+ default: {
+ goto s_n_llhttp__internal__n_error_21;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_req_http_start_1:
+ s_n_llhttp__internal__n_req_http_start_1: {
+ llparse_match_t match_seq;
+
+ if (p == endp) {
+ return s_n_llhttp__internal__n_req_http_start_1;
+ }
+ match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob12, 4);
+ p = match_seq.current;
+ switch (match_seq.status) {
+ case kMatchComplete: {
+ p++;
+ goto s_n_llhttp__internal__n_req_http_major;
+ }
+ case kMatchPause: {
+ return s_n_llhttp__internal__n_req_http_start_1;
+ }
+ case kMatchMismatch: {
+ goto s_n_llhttp__internal__n_error_23;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_req_http_start_2:
+ s_n_llhttp__internal__n_req_http_start_2: {
+ llparse_match_t match_seq;
+
+ if (p == endp) {
+ return s_n_llhttp__internal__n_req_http_start_2;
+ }
+ match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob13, 3);
+ p = match_seq.current;
+ switch (match_seq.status) {
+ case kMatchComplete: {
+ p++;
+ goto s_n_llhttp__internal__n_invoke_is_equal_method_1;
+ }
+ case kMatchPause: {
+ return s_n_llhttp__internal__n_req_http_start_2;
+ }
+ case kMatchMismatch: {
+ goto s_n_llhttp__internal__n_error_23;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_req_http_start:
+ s_n_llhttp__internal__n_req_http_start: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_req_http_start;
+ }
+ switch (*p) {
+ case ' ': {
+ p++;
+ goto s_n_llhttp__internal__n_req_http_start;
+ }
+ case 'H': {
+ p++;
+ goto s_n_llhttp__internal__n_req_http_start_1;
+ }
+ case 'I': {
+ p++;
+ goto s_n_llhttp__internal__n_req_http_start_2;
+ }
+ default: {
+ goto s_n_llhttp__internal__n_error_23;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_url_skip_to_http:
+ s_n_llhttp__internal__n_url_skip_to_http: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_url_skip_to_http;
+ }
+ p++;
+ goto s_n_llhttp__internal__n_req_http_start;
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_url_fragment:
+ s_n_llhttp__internal__n_url_fragment: {
+ static uint8_t lookup_table[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 0, 1, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
+ };
+ if (p == endp) {
+ return s_n_llhttp__internal__n_url_fragment;
+ }
+ switch (lookup_table[(uint8_t) *p]) {
+ case 1: {
+ p++;
+ goto s_n_llhttp__internal__n_url_fragment;
+ }
+ case 2: {
+ goto s_n_llhttp__internal__n_span_end_llhttp__on_url_6;
+ }
+ case 3: {
+ goto s_n_llhttp__internal__n_span_end_llhttp__on_url_7;
+ }
+ case 4: {
+ goto s_n_llhttp__internal__n_span_end_llhttp__on_url_8;
+ }
+ default: {
+ goto s_n_llhttp__internal__n_error_24;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_span_end_stub_query_3:
+ s_n_llhttp__internal__n_span_end_stub_query_3: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_span_end_stub_query_3;
+ }
+ p++;
+ goto s_n_llhttp__internal__n_url_fragment;
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_url_query:
+ s_n_llhttp__internal__n_url_query: {
+ static uint8_t lookup_table[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 0, 1, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 4, 1, 1, 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
+ };
+ if (p == endp) {
+ return s_n_llhttp__internal__n_url_query;
+ }
+ switch (lookup_table[(uint8_t) *p]) {
+ case 1: {
+ p++;
+ goto s_n_llhttp__internal__n_url_query;
+ }
+ case 2: {
+ goto s_n_llhttp__internal__n_span_end_llhttp__on_url_9;
+ }
+ case 3: {
+ goto s_n_llhttp__internal__n_span_end_llhttp__on_url_10;
+ }
+ case 4: {
+ goto s_n_llhttp__internal__n_span_end_llhttp__on_url_11;
+ }
+ case 5: {
+ goto s_n_llhttp__internal__n_span_end_stub_query_3;
+ }
+ default: {
+ goto s_n_llhttp__internal__n_error_25;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_url_query_or_fragment:
+ s_n_llhttp__internal__n_url_query_or_fragment: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_url_query_or_fragment;
+ }
+ switch (*p) {
+ case 10: {
+ goto s_n_llhttp__internal__n_span_end_llhttp__on_url_3;
+ }
+ case 13: {
+ goto s_n_llhttp__internal__n_span_end_llhttp__on_url_4;
+ }
+ case ' ': {
+ goto s_n_llhttp__internal__n_span_end_llhttp__on_url_5;
+ }
+ case '#': {
+ p++;
+ goto s_n_llhttp__internal__n_url_fragment;
+ }
+ case '?': {
+ p++;
+ goto s_n_llhttp__internal__n_url_query;
+ }
+ default: {
+ goto s_n_llhttp__internal__n_error_26;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_url_path:
+ s_n_llhttp__internal__n_url_path: {
+ static uint8_t lookup_table[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
+ };
+ if (p == endp) {
+ return s_n_llhttp__internal__n_url_path;
+ }
+ switch (lookup_table[(uint8_t) *p]) {
+ case 1: {
+ p++;
+ goto s_n_llhttp__internal__n_url_path;
+ }
+ default: {
+ goto s_n_llhttp__internal__n_url_query_or_fragment;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_span_start_stub_path_2:
+ s_n_llhttp__internal__n_span_start_stub_path_2: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_span_start_stub_path_2;
+ }
+ p++;
+ goto s_n_llhttp__internal__n_url_path;
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_span_start_stub_path:
+ s_n_llhttp__internal__n_span_start_stub_path: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_span_start_stub_path;
+ }
+ p++;
+ goto s_n_llhttp__internal__n_url_path;
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_span_start_stub_path_1:
+ s_n_llhttp__internal__n_span_start_stub_path_1: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_span_start_stub_path_1;
+ }
+ p++;
+ goto s_n_llhttp__internal__n_url_path;
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_url_server_with_at:
+ s_n_llhttp__internal__n_url_server_with_at: {
+ static uint8_t lookup_table[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 2, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 3, 4, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 4, 0, 6,
+ 7, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 4, 0, 4,
+ 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 0, 4, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ };
+ if (p == endp) {
+ return s_n_llhttp__internal__n_url_server_with_at;
+ }
+ switch (lookup_table[(uint8_t) *p]) {
+ case 1: {
+ goto s_n_llhttp__internal__n_span_end_llhttp__on_url_12;
+ }
+ case 2: {
+ goto s_n_llhttp__internal__n_span_end_llhttp__on_url_13;
+ }
+ case 3: {
+ goto s_n_llhttp__internal__n_span_end_llhttp__on_url_14;
+ }
+ case 4: {
+ p++;
+ goto s_n_llhttp__internal__n_url_server;
+ }
+ case 5: {
+ goto s_n_llhttp__internal__n_span_start_stub_path_1;
+ }
+ case 6: {
+ p++;
+ goto s_n_llhttp__internal__n_url_query;
+ }
+ case 7: {
+ p++;
+ goto s_n_llhttp__internal__n_error_27;
+ }
+ default: {
+ goto s_n_llhttp__internal__n_error_28;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_url_server:
+ s_n_llhttp__internal__n_url_server: {
+ static uint8_t lookup_table[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 2, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 3, 4, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 4, 0, 6,
+ 7, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 4, 0, 4,
+ 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 0, 4, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ };
+ if (p == endp) {
+ return s_n_llhttp__internal__n_url_server;
+ }
+ switch (lookup_table[(uint8_t) *p]) {
+ case 1: {
+ goto s_n_llhttp__internal__n_span_end_llhttp__on_url;
+ }
+ case 2: {
+ goto s_n_llhttp__internal__n_span_end_llhttp__on_url_1;
+ }
+ case 3: {
+ goto s_n_llhttp__internal__n_span_end_llhttp__on_url_2;
+ }
+ case 4: {
+ p++;
+ goto s_n_llhttp__internal__n_url_server;
+ }
+ case 5: {
+ goto s_n_llhttp__internal__n_span_start_stub_path;
+ }
+ case 6: {
+ p++;
+ goto s_n_llhttp__internal__n_url_query;
+ }
+ case 7: {
+ p++;
+ goto s_n_llhttp__internal__n_url_server_with_at;
+ }
+ default: {
+ goto s_n_llhttp__internal__n_error_29;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_url_schema_delim_1:
+ s_n_llhttp__internal__n_url_schema_delim_1: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_url_schema_delim_1;
+ }
+ switch (*p) {
+ case '/': {
+ p++;
+ goto s_n_llhttp__internal__n_url_server;
+ }
+ default: {
+ goto s_n_llhttp__internal__n_error_31;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_url_schema_delim:
+ s_n_llhttp__internal__n_url_schema_delim: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_url_schema_delim;
+ }
+ switch (*p) {
+ case 10: {
+ p++;
+ goto s_n_llhttp__internal__n_error_30;
+ }
+ case 13: {
+ p++;
+ goto s_n_llhttp__internal__n_error_30;
+ }
+ case ' ': {
+ p++;
+ goto s_n_llhttp__internal__n_error_30;
+ }
+ case '/': {
+ p++;
+ goto s_n_llhttp__internal__n_url_schema_delim_1;
+ }
+ default: {
+ goto s_n_llhttp__internal__n_error_31;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_span_end_stub_schema:
+ s_n_llhttp__internal__n_span_end_stub_schema: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_span_end_stub_schema;
+ }
+ p++;
+ goto s_n_llhttp__internal__n_url_schema_delim;
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_url_schema:
+ s_n_llhttp__internal__n_url_schema: {
+ static uint8_t lookup_table[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0,
+ 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0,
+ 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ };
+ if (p == endp) {
+ return s_n_llhttp__internal__n_url_schema;
+ }
+ switch (lookup_table[(uint8_t) *p]) {
+ case 1: {
+ p++;
+ goto s_n_llhttp__internal__n_error_30;
+ }
+ case 2: {
+ goto s_n_llhttp__internal__n_span_end_stub_schema;
+ }
+ case 3: {
+ p++;
+ goto s_n_llhttp__internal__n_url_schema;
+ }
+ default: {
+ goto s_n_llhttp__internal__n_error_32;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_url_start:
+ s_n_llhttp__internal__n_url_start: {
+ static uint8_t lookup_table[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 2,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0,
+ 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ };
+ if (p == endp) {
+ return s_n_llhttp__internal__n_url_start;
+ }
+ switch (lookup_table[(uint8_t) *p]) {
+ case 1: {
+ p++;
+ goto s_n_llhttp__internal__n_error_30;
+ }
+ case 2: {
+ goto s_n_llhttp__internal__n_span_start_stub_path_2;
+ }
+ case 3: {
+ goto s_n_llhttp__internal__n_url_schema;
+ }
+ default: {
+ goto s_n_llhttp__internal__n_error_33;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_span_start_llhttp__on_url_1:
+ s_n_llhttp__internal__n_span_start_llhttp__on_url_1: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_span_start_llhttp__on_url_1;
+ }
+ state->_span_pos0 = (void*) p;
+ state->_span_cb0 = llhttp__on_url;
+ goto s_n_llhttp__internal__n_url_start;
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_span_start_llhttp__on_url:
+ s_n_llhttp__internal__n_span_start_llhttp__on_url: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_span_start_llhttp__on_url;
+ }
+ state->_span_pos0 = (void*) p;
+ state->_span_cb0 = llhttp__on_url;
+ goto s_n_llhttp__internal__n_url_server;
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_req_spaces_before_url:
+ s_n_llhttp__internal__n_req_spaces_before_url: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_req_spaces_before_url;
+ }
+ switch (*p) {
+ case ' ': {
+ p++;
+ goto s_n_llhttp__internal__n_req_spaces_before_url;
+ }
+ default: {
+ goto s_n_llhttp__internal__n_invoke_is_equal_method;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_req_first_space_before_url:
+ s_n_llhttp__internal__n_req_first_space_before_url: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_req_first_space_before_url;
+ }
+ switch (*p) {
+ case ' ': {
+ p++;
+ goto s_n_llhttp__internal__n_req_spaces_before_url;
+ }
+ default: {
+ goto s_n_llhttp__internal__n_error_34;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_start_req_1:
+ s_n_llhttp__internal__n_start_req_1: {
+ llparse_match_t match_seq;
+
+ if (p == endp) {
+ return s_n_llhttp__internal__n_start_req_1;
+ }
+ match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob0, 2);
+ p = match_seq.current;
+ switch (match_seq.status) {
+ case kMatchComplete: {
+ p++;
+ match = 19;
+ goto s_n_llhttp__internal__n_invoke_store_method_1;
+ }
+ case kMatchPause: {
+ return s_n_llhttp__internal__n_start_req_1;
+ }
+ case kMatchMismatch: {
+ goto s_n_llhttp__internal__n_error_42;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_start_req_2:
+ s_n_llhttp__internal__n_start_req_2: {
+ llparse_match_t match_seq;
+
+ if (p == endp) {
+ return s_n_llhttp__internal__n_start_req_2;
+ }
+ match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob14, 3);
+ p = match_seq.current;
+ switch (match_seq.status) {
+ case kMatchComplete: {
+ p++;
+ match = 16;
+ goto s_n_llhttp__internal__n_invoke_store_method_1;
+ }
+ case kMatchPause: {
+ return s_n_llhttp__internal__n_start_req_2;
+ }
+ case kMatchMismatch: {
+ goto s_n_llhttp__internal__n_error_42;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_start_req_4:
+ s_n_llhttp__internal__n_start_req_4: {
+ llparse_match_t match_seq;
+
+ if (p == endp) {
+ return s_n_llhttp__internal__n_start_req_4;
+ }
+ match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob15, 6);
+ p = match_seq.current;
+ switch (match_seq.status) {
+ case kMatchComplete: {
+ p++;
+ match = 22;
+ goto s_n_llhttp__internal__n_invoke_store_method_1;
+ }
+ case kMatchPause: {
+ return s_n_llhttp__internal__n_start_req_4;
+ }
+ case kMatchMismatch: {
+ goto s_n_llhttp__internal__n_error_42;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_start_req_6:
+ s_n_llhttp__internal__n_start_req_6: {
+ llparse_match_t match_seq;
+
+ if (p == endp) {
+ return s_n_llhttp__internal__n_start_req_6;
+ }
+ match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob16, 4);
+ p = match_seq.current;
+ switch (match_seq.status) {
+ case kMatchComplete: {
+ p++;
+ match = 5;
+ goto s_n_llhttp__internal__n_invoke_store_method_1;
+ }
+ case kMatchPause: {
+ return s_n_llhttp__internal__n_start_req_6;
+ }
+ case kMatchMismatch: {
+ goto s_n_llhttp__internal__n_error_42;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_start_req_7:
+ s_n_llhttp__internal__n_start_req_7: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_start_req_7;
+ }
+ switch (*p) {
+ case 'Y': {
+ p++;
+ match = 8;
+ goto s_n_llhttp__internal__n_invoke_store_method_1;
+ }
+ default: {
+ goto s_n_llhttp__internal__n_error_42;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_start_req_5:
+ s_n_llhttp__internal__n_start_req_5: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_start_req_5;
+ }
+ switch (*p) {
+ case 'N': {
+ p++;
+ goto s_n_llhttp__internal__n_start_req_6;
+ }
+ case 'P': {
+ p++;
+ goto s_n_llhttp__internal__n_start_req_7;
+ }
+ default: {
+ goto s_n_llhttp__internal__n_error_42;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_start_req_3:
+ s_n_llhttp__internal__n_start_req_3: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_start_req_3;
+ }
+ switch (*p) {
+ case 'H': {
+ p++;
+ goto s_n_llhttp__internal__n_start_req_4;
+ }
+ case 'O': {
+ p++;
+ goto s_n_llhttp__internal__n_start_req_5;
+ }
+ default: {
+ goto s_n_llhttp__internal__n_error_42;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_start_req_8:
+ s_n_llhttp__internal__n_start_req_8: {
+ llparse_match_t match_seq;
+
+ if (p == endp) {
+ return s_n_llhttp__internal__n_start_req_8;
+ }
+ match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob17, 5);
+ p = match_seq.current;
+ switch (match_seq.status) {
+ case kMatchComplete: {
+ p++;
+ match = 0;
+ goto s_n_llhttp__internal__n_invoke_store_method_1;
+ }
+ case kMatchPause: {
+ return s_n_llhttp__internal__n_start_req_8;
+ }
+ case kMatchMismatch: {
+ goto s_n_llhttp__internal__n_error_42;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_start_req_9:
+ s_n_llhttp__internal__n_start_req_9: {
+ llparse_match_t match_seq;
+
+ if (p == endp) {
+ return s_n_llhttp__internal__n_start_req_9;
+ }
+ match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob18, 2);
+ p = match_seq.current;
+ switch (match_seq.status) {
+ case kMatchComplete: {
+ p++;
+ match = 1;
+ goto s_n_llhttp__internal__n_invoke_store_method_1;
+ }
+ case kMatchPause: {
+ return s_n_llhttp__internal__n_start_req_9;
+ }
+ case kMatchMismatch: {
+ goto s_n_llhttp__internal__n_error_42;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_start_req_10:
+ s_n_llhttp__internal__n_start_req_10: {
+ llparse_match_t match_seq;
+
+ if (p == endp) {
+ return s_n_llhttp__internal__n_start_req_10;
+ }
+ match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob19, 3);
+ p = match_seq.current;
+ switch (match_seq.status) {
+ case kMatchComplete: {
+ p++;
+ match = 2;
+ goto s_n_llhttp__internal__n_invoke_store_method_1;
+ }
+ case kMatchPause: {
+ return s_n_llhttp__internal__n_start_req_10;
+ }
+ case kMatchMismatch: {
+ goto s_n_llhttp__internal__n_error_42;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_start_req_12:
+ s_n_llhttp__internal__n_start_req_12: {
+ llparse_match_t match_seq;
+
+ if (p == endp) {
+ return s_n_llhttp__internal__n_start_req_12;
+ }
+ match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob20, 2);
+ p = match_seq.current;
+ switch (match_seq.status) {
+ case kMatchComplete: {
+ p++;
+ match = 31;
+ goto s_n_llhttp__internal__n_invoke_store_method_1;
+ }
+ case kMatchPause: {
+ return s_n_llhttp__internal__n_start_req_12;
+ }
+ case kMatchMismatch: {
+ goto s_n_llhttp__internal__n_error_42;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_start_req_13:
+ s_n_llhttp__internal__n_start_req_13: {
+ llparse_match_t match_seq;
+
+ if (p == endp) {
+ return s_n_llhttp__internal__n_start_req_13;
+ }
+ match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob21, 2);
+ p = match_seq.current;
+ switch (match_seq.status) {
+ case kMatchComplete: {
+ p++;
+ match = 9;
+ goto s_n_llhttp__internal__n_invoke_store_method_1;
+ }
+ case kMatchPause: {
+ return s_n_llhttp__internal__n_start_req_13;
+ }
+ case kMatchMismatch: {
+ goto s_n_llhttp__internal__n_error_42;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_start_req_11:
+ s_n_llhttp__internal__n_start_req_11: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_start_req_11;
+ }
+ switch (*p) {
+ case 'I': {
+ p++;
+ goto s_n_llhttp__internal__n_start_req_12;
+ }
+ case 'O': {
+ p++;
+ goto s_n_llhttp__internal__n_start_req_13;
+ }
+ default: {
+ goto s_n_llhttp__internal__n_error_42;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_start_req_15:
+ s_n_llhttp__internal__n_start_req_15: {
+ llparse_match_t match_seq;
+
+ if (p == endp) {
+ return s_n_llhttp__internal__n_start_req_15;
+ }
+ match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob22, 6);
+ p = match_seq.current;
+ switch (match_seq.status) {
+ case kMatchComplete: {
+ p++;
+ match = 24;
+ goto s_n_llhttp__internal__n_invoke_store_method_1;
+ }
+ case kMatchPause: {
+ return s_n_llhttp__internal__n_start_req_15;
+ }
+ case kMatchMismatch: {
+ goto s_n_llhttp__internal__n_error_42;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_start_req_16:
+ s_n_llhttp__internal__n_start_req_16: {
+ llparse_match_t match_seq;
+
+ if (p == endp) {
+ return s_n_llhttp__internal__n_start_req_16;
+ }
+ match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob23, 3);
+ p = match_seq.current;
+ switch (match_seq.status) {
+ case kMatchComplete: {
+ p++;
+ match = 23;
+ goto s_n_llhttp__internal__n_invoke_store_method_1;
+ }
+ case kMatchPause: {
+ return s_n_llhttp__internal__n_start_req_16;
+ }
+ case kMatchMismatch: {
+ goto s_n_llhttp__internal__n_error_42;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_start_req_18:
+ s_n_llhttp__internal__n_start_req_18: {
+ llparse_match_t match_seq;
+
+ if (p == endp) {
+ return s_n_llhttp__internal__n_start_req_18;
+ }
+ match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob24, 7);
+ p = match_seq.current;
+ switch (match_seq.status) {
+ case kMatchComplete: {
+ p++;
+ match = 21;
+ goto s_n_llhttp__internal__n_invoke_store_method_1;
+ }
+ case kMatchPause: {
+ return s_n_llhttp__internal__n_start_req_18;
+ }
+ case kMatchMismatch: {
+ goto s_n_llhttp__internal__n_error_42;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_start_req_20:
+ s_n_llhttp__internal__n_start_req_20: {
+ llparse_match_t match_seq;
+
+ if (p == endp) {
+ return s_n_llhttp__internal__n_start_req_20;
+ }
+ match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob25, 6);
+ p = match_seq.current;
+ switch (match_seq.status) {
+ case kMatchComplete: {
+ p++;
+ match = 30;
+ goto s_n_llhttp__internal__n_invoke_store_method_1;
+ }
+ case kMatchPause: {
+ return s_n_llhttp__internal__n_start_req_20;
+ }
+ case kMatchMismatch: {
+ goto s_n_llhttp__internal__n_error_42;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_start_req_21:
+ s_n_llhttp__internal__n_start_req_21: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_start_req_21;
+ }
+ switch (*p) {
+ case 'L': {
+ p++;
+ match = 10;
+ goto s_n_llhttp__internal__n_invoke_store_method_1;
+ }
+ default: {
+ goto s_n_llhttp__internal__n_error_42;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_start_req_19:
+ s_n_llhttp__internal__n_start_req_19: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_start_req_19;
+ }
+ switch (*p) {
+ case 'A': {
+ p++;
+ goto s_n_llhttp__internal__n_start_req_20;
+ }
+ case 'O': {
+ p++;
+ goto s_n_llhttp__internal__n_start_req_21;
+ }
+ default: {
+ goto s_n_llhttp__internal__n_error_42;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_start_req_17:
+ s_n_llhttp__internal__n_start_req_17: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_start_req_17;
+ }
+ switch (*p) {
+ case 'A': {
+ p++;
+ goto s_n_llhttp__internal__n_start_req_18;
+ }
+ case 'C': {
+ p++;
+ goto s_n_llhttp__internal__n_start_req_19;
+ }
+ default: {
+ goto s_n_llhttp__internal__n_error_42;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_start_req_22:
+ s_n_llhttp__internal__n_start_req_22: {
+ llparse_match_t match_seq;
+
+ if (p == endp) {
+ return s_n_llhttp__internal__n_start_req_22;
+ }
+ match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob26, 2);
+ p = match_seq.current;
+ switch (match_seq.status) {
+ case kMatchComplete: {
+ p++;
+ match = 11;
+ goto s_n_llhttp__internal__n_invoke_store_method_1;
+ }
+ case kMatchPause: {
+ return s_n_llhttp__internal__n_start_req_22;
+ }
+ case kMatchMismatch: {
+ goto s_n_llhttp__internal__n_error_42;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_start_req_14:
+ s_n_llhttp__internal__n_start_req_14: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_start_req_14;
+ }
+ switch (*p) {
+ case '-': {
+ p++;
+ goto s_n_llhttp__internal__n_start_req_15;
+ }
+ case 'E': {
+ p++;
+ goto s_n_llhttp__internal__n_start_req_16;
+ }
+ case 'K': {
+ p++;
+ goto s_n_llhttp__internal__n_start_req_17;
+ }
+ case 'O': {
+ p++;
+ goto s_n_llhttp__internal__n_start_req_22;
+ }
+ default: {
+ goto s_n_llhttp__internal__n_error_42;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_start_req_23:
+ s_n_llhttp__internal__n_start_req_23: {
+ llparse_match_t match_seq;
+
+ if (p == endp) {
+ return s_n_llhttp__internal__n_start_req_23;
+ }
+ match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob27, 5);
+ p = match_seq.current;
+ switch (match_seq.status) {
+ case kMatchComplete: {
+ p++;
+ match = 25;
+ goto s_n_llhttp__internal__n_invoke_store_method_1;
+ }
+ case kMatchPause: {
+ return s_n_llhttp__internal__n_start_req_23;
+ }
+ case kMatchMismatch: {
+ goto s_n_llhttp__internal__n_error_42;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_start_req_24:
+ s_n_llhttp__internal__n_start_req_24: {
+ llparse_match_t match_seq;
+
+ if (p == endp) {
+ return s_n_llhttp__internal__n_start_req_24;
+ }
+ match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob28, 6);
+ p = match_seq.current;
+ switch (match_seq.status) {
+ case kMatchComplete: {
+ p++;
+ match = 6;
+ goto s_n_llhttp__internal__n_invoke_store_method_1;
+ }
+ case kMatchPause: {
+ return s_n_llhttp__internal__n_start_req_24;
+ }
+ case kMatchMismatch: {
+ goto s_n_llhttp__internal__n_error_42;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_start_req_26:
+ s_n_llhttp__internal__n_start_req_26: {
+ llparse_match_t match_seq;
+
+ if (p == endp) {
+ return s_n_llhttp__internal__n_start_req_26;
+ }
+ match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob29, 3);
+ p = match_seq.current;
+ switch (match_seq.status) {
+ case kMatchComplete: {
+ p++;
+ match = 28;
+ goto s_n_llhttp__internal__n_invoke_store_method_1;
+ }
+ case kMatchPause: {
+ return s_n_llhttp__internal__n_start_req_26;
+ }
+ case kMatchMismatch: {
+ goto s_n_llhttp__internal__n_error_42;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_start_req_27:
+ s_n_llhttp__internal__n_start_req_27: {
+ llparse_match_t match_seq;
+
+ if (p == endp) {
+ return s_n_llhttp__internal__n_start_req_27;
+ }
+ match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob30, 2);
+ p = match_seq.current;
+ switch (match_seq.status) {
+ case kMatchComplete: {
+ p++;
+ match = 3;
+ goto s_n_llhttp__internal__n_invoke_store_method_1;
+ }
+ case kMatchPause: {
+ return s_n_llhttp__internal__n_start_req_27;
+ }
+ case kMatchMismatch: {
+ goto s_n_llhttp__internal__n_error_42;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_start_req_30:
+ s_n_llhttp__internal__n_start_req_30: {
+ llparse_match_t match_seq;
+
+ if (p == endp) {
+ return s_n_llhttp__internal__n_start_req_30;
+ }
+ match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob32, 3);
+ p = match_seq.current;
+ switch (match_seq.status) {
+ case kMatchComplete: {
+ p++;
+ match = 12;
+ goto s_n_llhttp__internal__n_invoke_store_method_1;
+ }
+ case kMatchPause: {
+ return s_n_llhttp__internal__n_start_req_30;
+ }
+ case kMatchMismatch: {
+ goto s_n_llhttp__internal__n_error_42;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_start_req_31:
+ s_n_llhttp__internal__n_start_req_31: {
+ llparse_match_t match_seq;
+
+ if (p == endp) {
+ return s_n_llhttp__internal__n_start_req_31;
+ }
+ match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob33, 4);
+ p = match_seq.current;
+ switch (match_seq.status) {
+ case kMatchComplete: {
+ p++;
+ match = 13;
+ goto s_n_llhttp__internal__n_invoke_store_method_1;
+ }
+ case kMatchPause: {
+ return s_n_llhttp__internal__n_start_req_31;
+ }
+ case kMatchMismatch: {
+ goto s_n_llhttp__internal__n_error_42;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_start_req_29:
+ s_n_llhttp__internal__n_start_req_29: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_start_req_29;
+ }
+ switch (*p) {
+ case 'F': {
+ p++;
+ goto s_n_llhttp__internal__n_start_req_30;
+ }
+ case 'P': {
+ p++;
+ goto s_n_llhttp__internal__n_start_req_31;
+ }
+ default: {
+ goto s_n_llhttp__internal__n_error_42;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_start_req_28:
+ s_n_llhttp__internal__n_start_req_28: {
+ llparse_match_t match_seq;
+
+ if (p == endp) {
+ return s_n_llhttp__internal__n_start_req_28;
+ }
+ match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob31, 2);
+ p = match_seq.current;
+ switch (match_seq.status) {
+ case kMatchComplete: {
+ p++;
+ goto s_n_llhttp__internal__n_start_req_29;
+ }
+ case kMatchPause: {
+ return s_n_llhttp__internal__n_start_req_28;
+ }
+ case kMatchMismatch: {
+ goto s_n_llhttp__internal__n_error_42;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_start_req_33:
+ s_n_llhttp__internal__n_start_req_33: {
+ llparse_match_t match_seq;
+
+ if (p == endp) {
+ return s_n_llhttp__internal__n_start_req_33;
+ }
+ match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob34, 2);
+ p = match_seq.current;
+ switch (match_seq.status) {
+ case kMatchComplete: {
+ p++;
+ match = 29;
+ goto s_n_llhttp__internal__n_invoke_store_method_1;
+ }
+ case kMatchPause: {
+ return s_n_llhttp__internal__n_start_req_33;
+ }
+ case kMatchMismatch: {
+ goto s_n_llhttp__internal__n_error_42;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_start_req_32:
+ s_n_llhttp__internal__n_start_req_32: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_start_req_32;
+ }
+ switch (*p) {
+ case 'R': {
+ p++;
+ goto s_n_llhttp__internal__n_start_req_33;
+ }
+ case 'T': {
+ p++;
+ match = 4;
+ goto s_n_llhttp__internal__n_invoke_store_method_1;
+ }
+ default: {
+ goto s_n_llhttp__internal__n_error_42;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_start_req_25:
+ s_n_llhttp__internal__n_start_req_25: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_start_req_25;
+ }
+ switch (*p) {
+ case 'A': {
+ p++;
+ goto s_n_llhttp__internal__n_start_req_26;
+ }
+ case 'O': {
+ p++;
+ goto s_n_llhttp__internal__n_start_req_27;
+ }
+ case 'R': {
+ p++;
+ goto s_n_llhttp__internal__n_start_req_28;
+ }
+ case 'U': {
+ p++;
+ goto s_n_llhttp__internal__n_start_req_32;
+ }
+ default: {
+ goto s_n_llhttp__internal__n_error_42;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_start_req_36:
+ s_n_llhttp__internal__n_start_req_36: {
+ llparse_match_t match_seq;
+
+ if (p == endp) {
+ return s_n_llhttp__internal__n_start_req_36;
+ }
+ match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob35, 3);
+ p = match_seq.current;
+ switch (match_seq.status) {
+ case kMatchComplete: {
+ p++;
+ match = 17;
+ goto s_n_llhttp__internal__n_invoke_store_method_1;
+ }
+ case kMatchPause: {
+ return s_n_llhttp__internal__n_start_req_36;
+ }
+ case kMatchMismatch: {
+ goto s_n_llhttp__internal__n_error_42;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_start_req_37:
+ s_n_llhttp__internal__n_start_req_37: {
+ llparse_match_t match_seq;
+
+ if (p == endp) {
+ return s_n_llhttp__internal__n_start_req_37;
+ }
+ match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob36, 3);
+ p = match_seq.current;
+ switch (match_seq.status) {
+ case kMatchComplete: {
+ p++;
+ match = 20;
+ goto s_n_llhttp__internal__n_invoke_store_method_1;
+ }
+ case kMatchPause: {
+ return s_n_llhttp__internal__n_start_req_37;
+ }
+ case kMatchMismatch: {
+ goto s_n_llhttp__internal__n_error_42;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_start_req_35:
+ s_n_llhttp__internal__n_start_req_35: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_start_req_35;
+ }
+ switch (*p) {
+ case 'B': {
+ p++;
+ goto s_n_llhttp__internal__n_start_req_36;
+ }
+ case 'P': {
+ p++;
+ goto s_n_llhttp__internal__n_start_req_37;
+ }
+ default: {
+ goto s_n_llhttp__internal__n_error_42;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_start_req_34:
+ s_n_llhttp__internal__n_start_req_34: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_start_req_34;
+ }
+ switch (*p) {
+ case 'E': {
+ p++;
+ goto s_n_llhttp__internal__n_start_req_35;
+ }
+ default: {
+ goto s_n_llhttp__internal__n_error_42;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_start_req_39:
+ s_n_llhttp__internal__n_start_req_39: {
+ llparse_match_t match_seq;
+
+ if (p == endp) {
+ return s_n_llhttp__internal__n_start_req_39;
+ }
+ match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob37, 4);
+ p = match_seq.current;
+ switch (match_seq.status) {
+ case kMatchComplete: {
+ p++;
+ match = 14;
+ goto s_n_llhttp__internal__n_invoke_store_method_1;
+ }
+ case kMatchPause: {
+ return s_n_llhttp__internal__n_start_req_39;
+ }
+ case kMatchMismatch: {
+ goto s_n_llhttp__internal__n_error_42;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_start_req_40:
+ s_n_llhttp__internal__n_start_req_40: {
+ llparse_match_t match_seq;
+
+ if (p == endp) {
+ return s_n_llhttp__internal__n_start_req_40;
+ }
+ match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob38, 4);
+ p = match_seq.current;
+ switch (match_seq.status) {
+ case kMatchComplete: {
+ p++;
+ match = 33;
+ goto s_n_llhttp__internal__n_invoke_store_method_1;
+ }
+ case kMatchPause: {
+ return s_n_llhttp__internal__n_start_req_40;
+ }
+ case kMatchMismatch: {
+ goto s_n_llhttp__internal__n_error_42;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_start_req_41:
+ s_n_llhttp__internal__n_start_req_41: {
+ llparse_match_t match_seq;
+
+ if (p == endp) {
+ return s_n_llhttp__internal__n_start_req_41;
+ }
+ match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob39, 7);
+ p = match_seq.current;
+ switch (match_seq.status) {
+ case kMatchComplete: {
+ p++;
+ match = 26;
+ goto s_n_llhttp__internal__n_invoke_store_method_1;
+ }
+ case kMatchPause: {
+ return s_n_llhttp__internal__n_start_req_41;
+ }
+ case kMatchMismatch: {
+ goto s_n_llhttp__internal__n_error_42;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_start_req_38:
+ s_n_llhttp__internal__n_start_req_38: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_start_req_38;
+ }
+ switch (*p) {
+ case 'E': {
+ p++;
+ goto s_n_llhttp__internal__n_start_req_39;
+ }
+ case 'O': {
+ p++;
+ goto s_n_llhttp__internal__n_start_req_40;
+ }
+ case 'U': {
+ p++;
+ goto s_n_llhttp__internal__n_start_req_41;
+ }
+ default: {
+ goto s_n_llhttp__internal__n_error_42;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_start_req_42:
+ s_n_llhttp__internal__n_start_req_42: {
+ llparse_match_t match_seq;
+
+ if (p == endp) {
+ return s_n_llhttp__internal__n_start_req_42;
+ }
+ match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob40, 4);
+ p = match_seq.current;
+ switch (match_seq.status) {
+ case kMatchComplete: {
+ p++;
+ match = 7;
+ goto s_n_llhttp__internal__n_invoke_store_method_1;
+ }
+ case kMatchPause: {
+ return s_n_llhttp__internal__n_start_req_42;
+ }
+ case kMatchMismatch: {
+ goto s_n_llhttp__internal__n_error_42;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_start_req_45:
+ s_n_llhttp__internal__n_start_req_45: {
+ llparse_match_t match_seq;
+
+ if (p == endp) {
+ return s_n_llhttp__internal__n_start_req_45;
+ }
+ match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob41, 3);
+ p = match_seq.current;
+ switch (match_seq.status) {
+ case kMatchComplete: {
+ p++;
+ match = 18;
+ goto s_n_llhttp__internal__n_invoke_store_method_1;
+ }
+ case kMatchPause: {
+ return s_n_llhttp__internal__n_start_req_45;
+ }
+ case kMatchMismatch: {
+ goto s_n_llhttp__internal__n_error_42;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_start_req_47:
+ s_n_llhttp__internal__n_start_req_47: {
+ llparse_match_t match_seq;
+
+ if (p == endp) {
+ return s_n_llhttp__internal__n_start_req_47;
+ }
+ match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob42, 2);
+ p = match_seq.current;
+ switch (match_seq.status) {
+ case kMatchComplete: {
+ p++;
+ match = 32;
+ goto s_n_llhttp__internal__n_invoke_store_method_1;
+ }
+ case kMatchPause: {
+ return s_n_llhttp__internal__n_start_req_47;
+ }
+ case kMatchMismatch: {
+ goto s_n_llhttp__internal__n_error_42;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_start_req_48:
+ s_n_llhttp__internal__n_start_req_48: {
+ llparse_match_t match_seq;
+
+ if (p == endp) {
+ return s_n_llhttp__internal__n_start_req_48;
+ }
+ match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob43, 2);
+ p = match_seq.current;
+ switch (match_seq.status) {
+ case kMatchComplete: {
+ p++;
+ match = 15;
+ goto s_n_llhttp__internal__n_invoke_store_method_1;
+ }
+ case kMatchPause: {
+ return s_n_llhttp__internal__n_start_req_48;
+ }
+ case kMatchMismatch: {
+ goto s_n_llhttp__internal__n_error_42;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_start_req_46:
+ s_n_llhttp__internal__n_start_req_46: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_start_req_46;
+ }
+ switch (*p) {
+ case 'I': {
+ p++;
+ goto s_n_llhttp__internal__n_start_req_47;
+ }
+ case 'O': {
+ p++;
+ goto s_n_llhttp__internal__n_start_req_48;
+ }
+ default: {
+ goto s_n_llhttp__internal__n_error_42;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_start_req_49:
+ s_n_llhttp__internal__n_start_req_49: {
+ llparse_match_t match_seq;
+
+ if (p == endp) {
+ return s_n_llhttp__internal__n_start_req_49;
+ }
+ match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob44, 8);
+ p = match_seq.current;
+ switch (match_seq.status) {
+ case kMatchComplete: {
+ p++;
+ match = 27;
+ goto s_n_llhttp__internal__n_invoke_store_method_1;
+ }
+ case kMatchPause: {
+ return s_n_llhttp__internal__n_start_req_49;
+ }
+ case kMatchMismatch: {
+ goto s_n_llhttp__internal__n_error_42;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_start_req_44:
+ s_n_llhttp__internal__n_start_req_44: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_start_req_44;
+ }
+ switch (*p) {
+ case 'B': {
+ p++;
+ goto s_n_llhttp__internal__n_start_req_45;
+ }
+ case 'L': {
+ p++;
+ goto s_n_llhttp__internal__n_start_req_46;
+ }
+ case 'S': {
+ p++;
+ goto s_n_llhttp__internal__n_start_req_49;
+ }
+ default: {
+ goto s_n_llhttp__internal__n_error_42;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_start_req_43:
+ s_n_llhttp__internal__n_start_req_43: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_start_req_43;
+ }
+ switch (*p) {
+ case 'N': {
+ p++;
+ goto s_n_llhttp__internal__n_start_req_44;
+ }
+ default: {
+ goto s_n_llhttp__internal__n_error_42;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_start_req:
+ s_n_llhttp__internal__n_start_req: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_start_req;
+ }
+ switch (*p) {
+ case 'A': {
+ p++;
+ goto s_n_llhttp__internal__n_start_req_1;
+ }
+ case 'B': {
+ p++;
+ goto s_n_llhttp__internal__n_start_req_2;
+ }
+ case 'C': {
+ p++;
+ goto s_n_llhttp__internal__n_start_req_3;
+ }
+ case 'D': {
+ p++;
+ goto s_n_llhttp__internal__n_start_req_8;
+ }
+ case 'G': {
+ p++;
+ goto s_n_llhttp__internal__n_start_req_9;
+ }
+ case 'H': {
+ p++;
+ goto s_n_llhttp__internal__n_start_req_10;
+ }
+ case 'L': {
+ p++;
+ goto s_n_llhttp__internal__n_start_req_11;
+ }
+ case 'M': {
+ p++;
+ goto s_n_llhttp__internal__n_start_req_14;
+ }
+ case 'N': {
+ p++;
+ goto s_n_llhttp__internal__n_start_req_23;
+ }
+ case 'O': {
+ p++;
+ goto s_n_llhttp__internal__n_start_req_24;
+ }
+ case 'P': {
+ p++;
+ goto s_n_llhttp__internal__n_start_req_25;
+ }
+ case 'R': {
+ p++;
+ goto s_n_llhttp__internal__n_start_req_34;
+ }
+ case 'S': {
+ p++;
+ goto s_n_llhttp__internal__n_start_req_38;
+ }
+ case 'T': {
+ p++;
+ goto s_n_llhttp__internal__n_start_req_42;
+ }
+ case 'U': {
+ p++;
+ goto s_n_llhttp__internal__n_start_req_43;
+ }
+ default: {
+ goto s_n_llhttp__internal__n_error_42;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_res_line_almost_done:
+ s_n_llhttp__internal__n_res_line_almost_done: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_res_line_almost_done;
+ }
+ p++;
+ goto s_n_llhttp__internal__n_header_field_start;
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_res_status:
+ s_n_llhttp__internal__n_res_status: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_res_status;
+ }
+ switch (*p) {
+ case 10: {
+ goto s_n_llhttp__internal__n_span_end_llhttp__on_status;
+ }
+ case 13: {
+ goto s_n_llhttp__internal__n_span_end_llhttp__on_status_1;
+ }
+ default: {
+ p++;
+ goto s_n_llhttp__internal__n_res_status;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_span_start_llhttp__on_status:
+ s_n_llhttp__internal__n_span_start_llhttp__on_status: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_span_start_llhttp__on_status;
+ }
+ state->_span_pos0 = (void*) p;
+ state->_span_cb0 = llhttp__on_status;
+ goto s_n_llhttp__internal__n_res_status;
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_res_status_start:
+ s_n_llhttp__internal__n_res_status_start: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_res_status_start;
+ }
+ switch (*p) {
+ case 10: {
+ p++;
+ goto s_n_llhttp__internal__n_header_field_start;
+ }
+ case 13: {
+ p++;
+ goto s_n_llhttp__internal__n_res_line_almost_done;
+ }
+ default: {
+ goto s_n_llhttp__internal__n_span_start_llhttp__on_status;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_res_status_code_otherwise:
+ s_n_llhttp__internal__n_res_status_code_otherwise: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_res_status_code_otherwise;
+ }
+ switch (*p) {
+ case 10: {
+ goto s_n_llhttp__internal__n_res_status_start;
+ }
+ case 13: {
+ goto s_n_llhttp__internal__n_res_status_start;
+ }
+ case ' ': {
+ p++;
+ goto s_n_llhttp__internal__n_res_status_start;
+ }
+ default: {
+ goto s_n_llhttp__internal__n_error_36;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_res_status_code:
+ s_n_llhttp__internal__n_res_status_code: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_res_status_code;
+ }
+ switch (*p) {
+ case '0': {
+ p++;
+ match = 0;
+ goto s_n_llhttp__internal__n_invoke_mul_add_status_code;
+ }
+ case '1': {
+ p++;
+ match = 1;
+ goto s_n_llhttp__internal__n_invoke_mul_add_status_code;
+ }
+ case '2': {
+ p++;
+ match = 2;
+ goto s_n_llhttp__internal__n_invoke_mul_add_status_code;
+ }
+ case '3': {
+ p++;
+ match = 3;
+ goto s_n_llhttp__internal__n_invoke_mul_add_status_code;
+ }
+ case '4': {
+ p++;
+ match = 4;
+ goto s_n_llhttp__internal__n_invoke_mul_add_status_code;
+ }
+ case '5': {
+ p++;
+ match = 5;
+ goto s_n_llhttp__internal__n_invoke_mul_add_status_code;
+ }
+ case '6': {
+ p++;
+ match = 6;
+ goto s_n_llhttp__internal__n_invoke_mul_add_status_code;
+ }
+ case '7': {
+ p++;
+ match = 7;
+ goto s_n_llhttp__internal__n_invoke_mul_add_status_code;
+ }
+ case '8': {
+ p++;
+ match = 8;
+ goto s_n_llhttp__internal__n_invoke_mul_add_status_code;
+ }
+ case '9': {
+ p++;
+ match = 9;
+ goto s_n_llhttp__internal__n_invoke_mul_add_status_code;
+ }
+ default: {
+ goto s_n_llhttp__internal__n_res_status_code_otherwise;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_res_http_end:
+ s_n_llhttp__internal__n_res_http_end: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_res_http_end;
+ }
+ switch (*p) {
+ case ' ': {
+ p++;
+ goto s_n_llhttp__internal__n_invoke_update_status_code;
+ }
+ default: {
+ goto s_n_llhttp__internal__n_error_37;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_res_http_minor:
+ s_n_llhttp__internal__n_res_http_minor: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_res_http_minor;
+ }
+ switch (*p) {
+ case '0': {
+ p++;
+ match = 0;
+ goto s_n_llhttp__internal__n_invoke_store_http_minor_1;
+ }
+ case '1': {
+ p++;
+ match = 1;
+ goto s_n_llhttp__internal__n_invoke_store_http_minor_1;
+ }
+ case '2': {
+ p++;
+ match = 2;
+ goto s_n_llhttp__internal__n_invoke_store_http_minor_1;
+ }
+ case '3': {
+ p++;
+ match = 3;
+ goto s_n_llhttp__internal__n_invoke_store_http_minor_1;
+ }
+ case '4': {
+ p++;
+ match = 4;
+ goto s_n_llhttp__internal__n_invoke_store_http_minor_1;
+ }
+ case '5': {
+ p++;
+ match = 5;
+ goto s_n_llhttp__internal__n_invoke_store_http_minor_1;
+ }
+ case '6': {
+ p++;
+ match = 6;
+ goto s_n_llhttp__internal__n_invoke_store_http_minor_1;
+ }
+ case '7': {
+ p++;
+ match = 7;
+ goto s_n_llhttp__internal__n_invoke_store_http_minor_1;
+ }
+ case '8': {
+ p++;
+ match = 8;
+ goto s_n_llhttp__internal__n_invoke_store_http_minor_1;
+ }
+ case '9': {
+ p++;
+ match = 9;
+ goto s_n_llhttp__internal__n_invoke_store_http_minor_1;
+ }
+ default: {
+ goto s_n_llhttp__internal__n_error_38;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_res_http_dot:
+ s_n_llhttp__internal__n_res_http_dot: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_res_http_dot;
+ }
+ switch (*p) {
+ case '.': {
+ p++;
+ goto s_n_llhttp__internal__n_res_http_minor;
+ }
+ default: {
+ goto s_n_llhttp__internal__n_error_39;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_res_http_major:
+ s_n_llhttp__internal__n_res_http_major: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_res_http_major;
+ }
+ switch (*p) {
+ case '0': {
+ p++;
+ match = 0;
+ goto s_n_llhttp__internal__n_invoke_store_http_major_1;
+ }
+ case '1': {
+ p++;
+ match = 1;
+ goto s_n_llhttp__internal__n_invoke_store_http_major_1;
+ }
+ case '2': {
+ p++;
+ match = 2;
+ goto s_n_llhttp__internal__n_invoke_store_http_major_1;
+ }
+ case '3': {
+ p++;
+ match = 3;
+ goto s_n_llhttp__internal__n_invoke_store_http_major_1;
+ }
+ case '4': {
+ p++;
+ match = 4;
+ goto s_n_llhttp__internal__n_invoke_store_http_major_1;
+ }
+ case '5': {
+ p++;
+ match = 5;
+ goto s_n_llhttp__internal__n_invoke_store_http_major_1;
+ }
+ case '6': {
+ p++;
+ match = 6;
+ goto s_n_llhttp__internal__n_invoke_store_http_major_1;
+ }
+ case '7': {
+ p++;
+ match = 7;
+ goto s_n_llhttp__internal__n_invoke_store_http_major_1;
+ }
+ case '8': {
+ p++;
+ match = 8;
+ goto s_n_llhttp__internal__n_invoke_store_http_major_1;
+ }
+ case '9': {
+ p++;
+ match = 9;
+ goto s_n_llhttp__internal__n_invoke_store_http_major_1;
+ }
+ default: {
+ goto s_n_llhttp__internal__n_error_40;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_start_res:
+ s_n_llhttp__internal__n_start_res: {
+ llparse_match_t match_seq;
+
+ if (p == endp) {
+ return s_n_llhttp__internal__n_start_res;
+ }
+ match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob45, 5);
+ p = match_seq.current;
+ switch (match_seq.status) {
+ case kMatchComplete: {
+ p++;
+ goto s_n_llhttp__internal__n_res_http_major;
+ }
+ case kMatchPause: {
+ return s_n_llhttp__internal__n_start_res;
+ }
+ case kMatchMismatch: {
+ goto s_n_llhttp__internal__n_error_43;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_req_or_res_method_2:
+ s_n_llhttp__internal__n_req_or_res_method_2: {
+ llparse_match_t match_seq;
+
+ if (p == endp) {
+ return s_n_llhttp__internal__n_req_or_res_method_2;
+ }
+ match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob46, 2);
+ p = match_seq.current;
+ switch (match_seq.status) {
+ case kMatchComplete: {
+ p++;
+ match = 2;
+ goto s_n_llhttp__internal__n_invoke_store_method;
+ }
+ case kMatchPause: {
+ return s_n_llhttp__internal__n_req_or_res_method_2;
+ }
+ case kMatchMismatch: {
+ goto s_n_llhttp__internal__n_error_41;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_req_or_res_method_3:
+ s_n_llhttp__internal__n_req_or_res_method_3: {
+ llparse_match_t match_seq;
+
+ if (p == endp) {
+ return s_n_llhttp__internal__n_req_or_res_method_3;
+ }
+ match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob47, 3);
+ p = match_seq.current;
+ switch (match_seq.status) {
+ case kMatchComplete: {
+ p++;
+ goto s_n_llhttp__internal__n_invoke_update_type_1;
+ }
+ case kMatchPause: {
+ return s_n_llhttp__internal__n_req_or_res_method_3;
+ }
+ case kMatchMismatch: {
+ goto s_n_llhttp__internal__n_error_41;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_req_or_res_method_1:
+ s_n_llhttp__internal__n_req_or_res_method_1: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_req_or_res_method_1;
+ }
+ switch (*p) {
+ case 'E': {
+ p++;
+ goto s_n_llhttp__internal__n_req_or_res_method_2;
+ }
+ case 'T': {
+ p++;
+ goto s_n_llhttp__internal__n_req_or_res_method_3;
+ }
+ default: {
+ goto s_n_llhttp__internal__n_error_41;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_req_or_res_method:
+ s_n_llhttp__internal__n_req_or_res_method: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_req_or_res_method;
+ }
+ switch (*p) {
+ case 'H': {
+ p++;
+ goto s_n_llhttp__internal__n_req_or_res_method_1;
+ }
+ default: {
+ goto s_n_llhttp__internal__n_error_41;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_start_req_or_res:
+ s_n_llhttp__internal__n_start_req_or_res: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_start_req_or_res;
+ }
+ switch (*p) {
+ case 'H': {
+ goto s_n_llhttp__internal__n_req_or_res_method;
+ }
+ default: {
+ goto s_n_llhttp__internal__n_invoke_update_type_2;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_invoke_load_type:
+ s_n_llhttp__internal__n_invoke_load_type: {
+ switch (llhttp__internal__c_load_type(state, p, endp)) {
+ case 1:
+ goto s_n_llhttp__internal__n_start_req;
+ case 2:
+ goto s_n_llhttp__internal__n_start_res;
+ default:
+ goto s_n_llhttp__internal__n_start_req_or_res;
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ case s_n_llhttp__internal__n_start:
+ s_n_llhttp__internal__n_start: {
+ if (p == endp) {
+ return s_n_llhttp__internal__n_start;
+ }
+ switch (*p) {
+ case 10: {
+ p++;
+ goto s_n_llhttp__internal__n_start;
+ }
+ case 13: {
+ p++;
+ goto s_n_llhttp__internal__n_start;
+ }
+ default: {
+ goto s_n_llhttp__internal__n_invoke_update_finish;
+ }
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ default:
+ /* UNREACHABLE */
+ abort();
+ }
+ s_n_llhttp__internal__n_error_30: {
+ state->error = 0x7;
+ state->reason = "Invalid characters in url";
+ state->error_pos = (const char*) p;
+ state->_current = (void*) (intptr_t) s_error;
+ return s_error;
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_pause_5: {
+ state->error = 0x14;
+ state->reason = "on_message_complete pause";
+ state->error_pos = (const char*) p;
+ state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_invoke_is_equal_upgrade;
+ return s_error;
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_error_8: {
+ state->error = 0x11;
+ state->reason = "`on_message_complete` callback error";
+ state->error_pos = (const char*) p;
+ state->_current = (void*) (intptr_t) s_error;
+ return s_error;
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_pause_7: {
+ state->error = 0x14;
+ state->reason = "on_chunk_complete pause";
+ state->error_pos = (const char*) p;
+ state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_invoke_llhttp__on_message_complete_2;
+ return s_error;
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_error_10: {
+ state->error = 0x13;
+ state->reason = "`on_chunk_complete` callback error";
+ state->error_pos = (const char*) p;
+ state->_current = (void*) (intptr_t) s_error;
+ return s_error;
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_invoke_llhttp__on_chunk_complete_1: {
+ switch (llhttp__on_chunk_complete(state, p, endp)) {
+ case 0:
+ goto s_n_llhttp__internal__n_invoke_llhttp__on_message_complete_2;
+ case 20:
+ goto s_n_llhttp__internal__n_pause_7;
+ default:
+ goto s_n_llhttp__internal__n_error_10;
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_error_9: {
+ state->error = 0x4;
+ state->reason = "Content-Length can't be present with chunked encoding";
+ state->error_pos = (const char*) p;
+ state->_current = (void*) (intptr_t) s_error;
+ return s_error;
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_pause_2: {
+ state->error = 0x14;
+ state->reason = "on_message_complete pause";
+ state->error_pos = (const char*) p;
+ state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_pause_1;
+ return s_error;
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_error_3: {
+ state->error = 0x11;
+ state->reason = "`on_message_complete` callback error";
+ state->error_pos = (const char*) p;
+ state->_current = (void*) (intptr_t) s_error;
+ return s_error;
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_invoke_llhttp__on_message_complete_1: {
+ switch (llhttp__on_message_complete(state, p, endp)) {
+ case 0:
+ goto s_n_llhttp__internal__n_pause_1;
+ case 20:
+ goto s_n_llhttp__internal__n_pause_2;
+ default:
+ goto s_n_llhttp__internal__n_error_3;
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_error_4: {
+ state->error = 0xc;
+ state->reason = "Chunk size overflow";
+ state->error_pos = (const char*) p;
+ state->_current = (void*) (intptr_t) s_error;
+ return s_error;
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_invoke_mul_add_content_length: {
+ switch (llhttp__internal__c_mul_add_content_length(state, p, endp, match)) {
+ case 1:
+ goto s_n_llhttp__internal__n_error_4;
+ default:
+ goto s_n_llhttp__internal__n_chunk_size;
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_pause_3: {
+ state->error = 0x14;
+ state->reason = "on_chunk_complete pause";
+ state->error_pos = (const char*) p;
+ state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_invoke_update_content_length;
+ return s_error;
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_error_6: {
+ state->error = 0x13;
+ state->reason = "`on_chunk_complete` callback error";
+ state->error_pos = (const char*) p;
+ state->_current = (void*) (intptr_t) s_error;
+ return s_error;
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_invoke_llhttp__on_chunk_complete: {
+ switch (llhttp__on_chunk_complete(state, p, endp)) {
+ case 0:
+ goto s_n_llhttp__internal__n_invoke_update_content_length;
+ case 20:
+ goto s_n_llhttp__internal__n_pause_3;
+ default:
+ goto s_n_llhttp__internal__n_error_6;
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_span_end_llhttp__on_body: {
+ const unsigned char* start;
+ int err;
+
+ start = state->_span_pos0;
+ state->_span_pos0 = NULL;
+ err = llhttp__on_body(state, start, p);
+ if (err != 0) {
+ state->error = err;
+ state->error_pos = (const char*) p;
+ state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_chunk_data_almost_done;
+ return s_error;
+ }
+ goto s_n_llhttp__internal__n_chunk_data_almost_done;
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_invoke_or_flags: {
+ switch (llhttp__internal__c_or_flags(state, p, endp)) {
+ default:
+ goto s_n_llhttp__internal__n_header_field_start;
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_pause_4: {
+ state->error = 0x14;
+ state->reason = "on_chunk_header pause";
+ state->error_pos = (const char*) p;
+ state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_invoke_is_equal_content_length;
+ return s_error;
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_error_5: {
+ state->error = 0x12;
+ state->reason = "`on_chunk_header` callback error";
+ state->error_pos = (const char*) p;
+ state->_current = (void*) (intptr_t) s_error;
+ return s_error;
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_invoke_llhttp__on_chunk_header: {
+ switch (llhttp__on_chunk_header(state, p, endp)) {
+ case 0:
+ goto s_n_llhttp__internal__n_invoke_is_equal_content_length;
+ case 20:
+ goto s_n_llhttp__internal__n_pause_4;
+ default:
+ goto s_n_llhttp__internal__n_error_5;
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_error_7: {
+ state->error = 0xc;
+ state->reason = "Invalid character in chunk size";
+ state->error_pos = (const char*) p;
+ state->_current = (void*) (intptr_t) s_error;
+ return s_error;
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_span_end_llhttp__on_body_1: {
+ const unsigned char* start;
+ int err;
+
+ start = state->_span_pos0;
+ state->_span_pos0 = NULL;
+ err = llhttp__on_body(state, start, p);
+ if (err != 0) {
+ state->error = err;
+ state->error_pos = (const char*) p;
+ state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_invoke_llhttp__on_message_complete_2;
+ return s_error;
+ }
+ goto s_n_llhttp__internal__n_invoke_llhttp__on_message_complete_2;
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_invoke_update_finish_1: {
+ switch (llhttp__internal__c_update_finish_1(state, p, endp)) {
+ default:
+ goto s_n_llhttp__internal__n_eof;
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_pause: {
+ state->error = 0x14;
+ state->reason = "on_message_complete pause";
+ state->error_pos = (const char*) p;
+ state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_invoke_llhttp__after_message_complete;
+ return s_error;
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_error_2: {
+ state->error = 0x11;
+ state->reason = "`on_message_complete` callback error";
+ state->error_pos = (const char*) p;
+ state->_current = (void*) (intptr_t) s_error;
+ return s_error;
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_invoke_llhttp__on_message_complete: {
+ switch (llhttp__on_message_complete(state, p, endp)) {
+ case 0:
+ goto s_n_llhttp__internal__n_invoke_llhttp__after_message_complete;
+ case 20:
+ goto s_n_llhttp__internal__n_pause;
+ default:
+ goto s_n_llhttp__internal__n_error_2;
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_invoke_or_flags_1: {
+ switch (llhttp__internal__c_or_flags_1(state, p, endp)) {
+ default:
+ goto s_n_llhttp__internal__n_invoke_llhttp__after_headers_complete;
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_invoke_or_flags_2: {
+ switch (llhttp__internal__c_or_flags_1(state, p, endp)) {
+ default:
+ goto s_n_llhttp__internal__n_invoke_llhttp__after_headers_complete;
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_invoke_update_upgrade: {
+ switch (llhttp__internal__c_update_upgrade(state, p, endp)) {
+ default:
+ goto s_n_llhttp__internal__n_invoke_or_flags_2;
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_pause_6: {
+ state->error = 0x14;
+ state->reason = "Paused by on_headers_complete";
+ state->error_pos = (const char*) p;
+ state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_invoke_llhttp__after_headers_complete;
+ return s_error;
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_error_1: {
+ state->error = 0x10;
+ state->reason = "User callback error";
+ state->error_pos = (const char*) p;
+ state->_current = (void*) (intptr_t) s_error;
+ return s_error;
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_invoke_llhttp__on_headers_complete: {
+ switch (llhttp__on_headers_complete(state, p, endp)) {
+ case 0:
+ goto s_n_llhttp__internal__n_invoke_llhttp__after_headers_complete;
+ case 1:
+ goto s_n_llhttp__internal__n_invoke_or_flags_1;
+ case 2:
+ goto s_n_llhttp__internal__n_invoke_update_upgrade;
+ case 20:
+ goto s_n_llhttp__internal__n_pause_6;
+ default:
+ goto s_n_llhttp__internal__n_error_1;
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_invoke_llhttp__before_headers_complete: {
+ switch (llhttp__before_headers_complete(state, p, endp)) {
+ default:
+ goto s_n_llhttp__internal__n_invoke_llhttp__on_headers_complete;
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_invoke_test_flags_1: {
+ switch (llhttp__internal__c_test_flags_1(state, p, endp)) {
+ case 1:
+ goto s_n_llhttp__internal__n_error_9;
+ default:
+ goto s_n_llhttp__internal__n_invoke_llhttp__before_headers_complete;
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_invoke_test_flags: {
+ switch (llhttp__internal__c_test_flags(state, p, endp)) {
+ case 1:
+ goto s_n_llhttp__internal__n_invoke_llhttp__on_chunk_complete_1;
+ default:
+ goto s_n_llhttp__internal__n_invoke_test_flags_1;
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_span_end_llhttp__on_header_value: {
+ const unsigned char* start;
+ int err;
+
+ start = state->_span_pos0;
+ state->_span_pos0 = NULL;
+ err = llhttp__on_header_value(state, start, p);
+ if (err != 0) {
+ state->error = err;
+ state->error_pos = (const char*) p;
+ state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_header_field_start;
+ return s_error;
+ }
+ goto s_n_llhttp__internal__n_header_field_start;
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_invoke_update_header_state: {
+ switch (llhttp__internal__c_update_header_state(state, p, endp)) {
+ default:
+ goto s_n_llhttp__internal__n_span_start_llhttp__on_header_value;
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_invoke_or_flags_3: {
+ switch (llhttp__internal__c_or_flags_3(state, p, endp)) {
+ default:
+ goto s_n_llhttp__internal__n_invoke_update_header_state;
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_invoke_or_flags_4: {
+ switch (llhttp__internal__c_or_flags_4(state, p, endp)) {
+ default:
+ goto s_n_llhttp__internal__n_invoke_update_header_state;
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_invoke_or_flags_5: {
+ switch (llhttp__internal__c_or_flags_5(state, p, endp)) {
+ default:
+ goto s_n_llhttp__internal__n_invoke_update_header_state;
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_invoke_or_flags_6: {
+ switch (llhttp__internal__c_or_flags_6(state, p, endp)) {
+ default:
+ goto s_n_llhttp__internal__n_span_start_llhttp__on_header_value;
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_invoke_load_header_state: {
+ switch (llhttp__internal__c_load_header_state(state, p, endp)) {
+ case 5:
+ goto s_n_llhttp__internal__n_invoke_or_flags_3;
+ case 6:
+ goto s_n_llhttp__internal__n_invoke_or_flags_4;
+ case 7:
+ goto s_n_llhttp__internal__n_invoke_or_flags_5;
+ case 8:
+ goto s_n_llhttp__internal__n_invoke_or_flags_6;
+ default:
+ goto s_n_llhttp__internal__n_span_start_llhttp__on_header_value;
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_invoke_update_header_state_1: {
+ switch (llhttp__internal__c_update_header_state(state, p, endp)) {
+ default:
+ goto s_n_llhttp__internal__n_header_field_start;
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_invoke_or_flags_7: {
+ switch (llhttp__internal__c_or_flags_3(state, p, endp)) {
+ default:
+ goto s_n_llhttp__internal__n_invoke_update_header_state_1;
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_invoke_or_flags_8: {
+ switch (llhttp__internal__c_or_flags_4(state, p, endp)) {
+ default:
+ goto s_n_llhttp__internal__n_invoke_update_header_state_1;
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_invoke_or_flags_9: {
+ switch (llhttp__internal__c_or_flags_5(state, p, endp)) {
+ default:
+ goto s_n_llhttp__internal__n_invoke_update_header_state_1;
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_invoke_or_flags_10: {
+ switch (llhttp__internal__c_or_flags_6(state, p, endp)) {
+ default:
+ goto s_n_llhttp__internal__n_header_field_start;
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_invoke_load_header_state_2: {
+ switch (llhttp__internal__c_load_header_state(state, p, endp)) {
+ case 5:
+ goto s_n_llhttp__internal__n_invoke_or_flags_7;
+ case 6:
+ goto s_n_llhttp__internal__n_invoke_or_flags_8;
+ case 7:
+ goto s_n_llhttp__internal__n_invoke_or_flags_9;
+ case 8:
+ goto s_n_llhttp__internal__n_invoke_or_flags_10;
+ default:
+ goto s_n_llhttp__internal__n_header_field_start;
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_error_11: {
+ state->error = 0x3;
+ state->reason = "Missing expected LF after header value";
+ state->error_pos = (const char*) p;
+ state->_current = (void*) (intptr_t) s_error;
+ return s_error;
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_span_end_llhttp__on_header_value_1: {
+ const unsigned char* start;
+ int err;
+
+ start = state->_span_pos0;
+ state->_span_pos0 = NULL;
+ err = llhttp__on_header_value(state, start, p);
+ if (err != 0) {
+ state->error = err;
+ state->error_pos = (const char*) p;
+ state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_header_value_almost_done;
+ return s_error;
+ }
+ goto s_n_llhttp__internal__n_header_value_almost_done;
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_span_end_llhttp__on_header_value_2: {
+ const unsigned char* start;
+ int err;
+
+ start = state->_span_pos0;
+ state->_span_pos0 = NULL;
+ err = llhttp__on_header_value(state, start, p);
+ if (err != 0) {
+ state->error = err;
+ state->error_pos = (const char*) (p + 1);
+ state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_header_value_almost_done;
+ return s_error;
+ }
+ p++;
+ goto s_n_llhttp__internal__n_header_value_almost_done;
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_error_12: {
+ state->error = 0xa;
+ state->reason = "Invalid header value char";
+ state->error_pos = (const char*) p;
+ state->_current = (void*) (intptr_t) s_error;
+ return s_error;
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_invoke_update_header_state_3: {
+ switch (llhttp__internal__c_update_header_state(state, p, endp)) {
+ default:
+ goto s_n_llhttp__internal__n_header_value_connection;
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_invoke_or_flags_11: {
+ switch (llhttp__internal__c_or_flags_3(state, p, endp)) {
+ default:
+ goto s_n_llhttp__internal__n_invoke_update_header_state_3;
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_invoke_or_flags_12: {
+ switch (llhttp__internal__c_or_flags_4(state, p, endp)) {
+ default:
+ goto s_n_llhttp__internal__n_invoke_update_header_state_3;
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_invoke_or_flags_13: {
+ switch (llhttp__internal__c_or_flags_5(state, p, endp)) {
+ default:
+ goto s_n_llhttp__internal__n_invoke_update_header_state_3;
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_invoke_or_flags_14: {
+ switch (llhttp__internal__c_or_flags_6(state, p, endp)) {
+ default:
+ goto s_n_llhttp__internal__n_header_value_connection;
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_invoke_load_header_state_3: {
+ switch (llhttp__internal__c_load_header_state(state, p, endp)) {
+ case 5:
+ goto s_n_llhttp__internal__n_invoke_or_flags_11;
+ case 6:
+ goto s_n_llhttp__internal__n_invoke_or_flags_12;
+ case 7:
+ goto s_n_llhttp__internal__n_invoke_or_flags_13;
+ case 8:
+ goto s_n_llhttp__internal__n_invoke_or_flags_14;
+ default:
+ goto s_n_llhttp__internal__n_header_value_connection;
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_invoke_update_header_state_4: {
+ switch (llhttp__internal__c_update_header_state_4(state, p, endp)) {
+ default:
+ goto s_n_llhttp__internal__n_header_value_connection_token;
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_invoke_update_header_state_2: {
+ switch (llhttp__internal__c_update_header_state_2(state, p, endp)) {
+ default:
+ goto s_n_llhttp__internal__n_header_value_connection_ws;
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_invoke_update_header_state_5: {
+ switch (llhttp__internal__c_update_header_state_5(state, p, endp)) {
+ default:
+ goto s_n_llhttp__internal__n_header_value_connection_ws;
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_invoke_update_header_state_6: {
+ switch (llhttp__internal__c_update_header_state_6(state, p, endp)) {
+ default:
+ goto s_n_llhttp__internal__n_header_value_connection_ws;
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_span_end_llhttp__on_header_value_3: {
+ const unsigned char* start;
+ int err;
+
+ start = state->_span_pos0;
+ state->_span_pos0 = NULL;
+ err = llhttp__on_header_value(state, start, p);
+ if (err != 0) {
+ state->error = err;
+ state->error_pos = (const char*) p;
+ state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_error_14;
+ return s_error;
+ }
+ goto s_n_llhttp__internal__n_error_14;
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_invoke_mul_add_content_length_1: {
+ switch (llhttp__internal__c_mul_add_content_length_1(state, p, endp, match)) {
+ case 1:
+ goto s_n_llhttp__internal__n_span_end_llhttp__on_header_value_3;
+ default:
+ goto s_n_llhttp__internal__n_header_value_content_length;
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_invoke_update_header_state_7: {
+ switch (llhttp__internal__c_update_header_state_4(state, p, endp)) {
+ default:
+ goto s_n_llhttp__internal__n_header_value;
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_invoke_or_flags_15: {
+ switch (llhttp__internal__c_or_flags_15(state, p, endp)) {
+ default:
+ goto s_n_llhttp__internal__n_header_value_discard_rws;
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_span_end_llhttp__on_header_value_4: {
+ const unsigned char* start;
+ int err;
+
+ start = state->_span_pos0;
+ state->_span_pos0 = NULL;
+ err = llhttp__on_header_value(state, start, p);
+ if (err != 0) {
+ state->error = err;
+ state->error_pos = (const char*) p;
+ state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_error_15;
+ return s_error;
+ }
+ goto s_n_llhttp__internal__n_error_15;
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_error_13: {
+ state->error = 0x4;
+ state->reason = "Duplicate Content-Length";
+ state->error_pos = (const char*) p;
+ state->_current = (void*) (intptr_t) s_error;
+ return s_error;
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_invoke_test_flags_2: {
+ switch (llhttp__internal__c_test_flags_2(state, p, endp)) {
+ case 0:
+ goto s_n_llhttp__internal__n_header_value_content_length;
+ default:
+ goto s_n_llhttp__internal__n_error_13;
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_invoke_update_header_state_8: {
+ switch (llhttp__internal__c_update_header_state_8(state, p, endp)) {
+ default:
+ goto s_n_llhttp__internal__n_header_value_discard_rws;
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_invoke_or_flags_16: {
+ switch (llhttp__internal__c_or_flags_16(state, p, endp)) {
+ default:
+ goto s_n_llhttp__internal__n_invoke_update_header_state_7;
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_invoke_load_header_state_1: {
+ switch (llhttp__internal__c_load_header_state(state, p, endp)) {
+ case 1:
+ goto s_n_llhttp__internal__n_header_value_connection;
+ case 2:
+ goto s_n_llhttp__internal__n_invoke_test_flags_2;
+ case 3:
+ goto s_n_llhttp__internal__n_header_value_te_chunked;
+ case 4:
+ goto s_n_llhttp__internal__n_invoke_or_flags_16;
+ default:
+ goto s_n_llhttp__internal__n_header_value;
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_span_end_llhttp__on_header_field: {
+ const unsigned char* start;
+ int err;
+
+ start = state->_span_pos0;
+ state->_span_pos0 = NULL;
+ err = llhttp__on_header_field(state, start, p);
+ if (err != 0) {
+ state->error = err;
+ state->error_pos = (const char*) (p + 1);
+ state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_header_value_discard_ws;
+ return s_error;
+ }
+ p++;
+ goto s_n_llhttp__internal__n_header_value_discard_ws;
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_span_end_llhttp__on_header_field_1: {
+ const unsigned char* start;
+ int err;
+
+ start = state->_span_pos0;
+ state->_span_pos0 = NULL;
+ err = llhttp__on_header_field(state, start, p);
+ if (err != 0) {
+ state->error = err;
+ state->error_pos = (const char*) (p + 1);
+ state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_header_value_discard_ws;
+ return s_error;
+ }
+ p++;
+ goto s_n_llhttp__internal__n_header_value_discard_ws;
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_error_16: {
+ state->error = 0xa;
+ state->reason = "Invalid header token";
+ state->error_pos = (const char*) p;
+ state->_current = (void*) (intptr_t) s_error;
+ return s_error;
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_invoke_update_header_state_9: {
+ switch (llhttp__internal__c_update_header_state_4(state, p, endp)) {
+ default:
+ goto s_n_llhttp__internal__n_header_field_general;
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_invoke_store_header_state: {
+ switch (llhttp__internal__c_store_header_state(state, p, endp, match)) {
+ default:
+ goto s_n_llhttp__internal__n_header_field_colon;
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_invoke_update_header_state_10: {
+ switch (llhttp__internal__c_update_header_state_4(state, p, endp)) {
+ default:
+ goto s_n_llhttp__internal__n_header_field_general;
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_invoke_update_http_minor: {
+ switch (llhttp__internal__c_update_http_minor(state, p, endp)) {
+ default:
+ goto s_n_llhttp__internal__n_header_field_start;
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_invoke_update_http_major: {
+ switch (llhttp__internal__c_update_http_major(state, p, endp)) {
+ default:
+ goto s_n_llhttp__internal__n_invoke_update_http_minor;
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_span_end_llhttp__on_url_3: {
+ const unsigned char* start;
+ int err;
+
+ start = state->_span_pos0;
+ state->_span_pos0 = NULL;
+ err = llhttp__on_url(state, start, p);
+ if (err != 0) {
+ state->error = err;
+ state->error_pos = (const char*) p;
+ state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_url_skip_to_http09;
+ return s_error;
+ }
+ goto s_n_llhttp__internal__n_url_skip_to_http09;
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_error_17: {
+ state->error = 0x7;
+ state->reason = "Expected CRLF";
+ state->error_pos = (const char*) p;
+ state->_current = (void*) (intptr_t) s_error;
+ return s_error;
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_span_end_llhttp__on_url_4: {
+ const unsigned char* start;
+ int err;
+
+ start = state->_span_pos0;
+ state->_span_pos0 = NULL;
+ err = llhttp__on_url(state, start, p);
+ if (err != 0) {
+ state->error = err;
+ state->error_pos = (const char*) p;
+ state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_url_skip_lf_to_http09;
+ return s_error;
+ }
+ goto s_n_llhttp__internal__n_url_skip_lf_to_http09;
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_error_18: {
+ state->error = 0x9;
+ state->reason = "Expected CRLF after version";
+ state->error_pos = (const char*) p;
+ state->_current = (void*) (intptr_t) s_error;
+ return s_error;
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_invoke_store_http_minor: {
+ switch (llhttp__internal__c_store_http_minor(state, p, endp, match)) {
+ default:
+ goto s_n_llhttp__internal__n_req_http_end;
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_error_19: {
+ state->error = 0x9;
+ state->reason = "Invalid minor version";
+ state->error_pos = (const char*) p;
+ state->_current = (void*) (intptr_t) s_error;
+ return s_error;
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_error_20: {
+ state->error = 0x9;
+ state->reason = "Expected dot";
+ state->error_pos = (const char*) p;
+ state->_current = (void*) (intptr_t) s_error;
+ return s_error;
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_invoke_store_http_major: {
+ switch (llhttp__internal__c_store_http_major(state, p, endp, match)) {
+ default:
+ goto s_n_llhttp__internal__n_req_http_dot;
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_error_21: {
+ state->error = 0x9;
+ state->reason = "Invalid major version";
+ state->error_pos = (const char*) p;
+ state->_current = (void*) (intptr_t) s_error;
+ return s_error;
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_error_23: {
+ state->error = 0x8;
+ state->reason = "Expected HTTP/";
+ state->error_pos = (const char*) p;
+ state->_current = (void*) (intptr_t) s_error;
+ return s_error;
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_error_22: {
+ state->error = 0x8;
+ state->reason = "Expected SOURCE method for ICE/x.x request";
+ state->error_pos = (const char*) p;
+ state->_current = (void*) (intptr_t) s_error;
+ return s_error;
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_invoke_is_equal_method_1: {
+ switch (llhttp__internal__c_is_equal_method_1(state, p, endp)) {
+ case 0:
+ goto s_n_llhttp__internal__n_error_22;
+ default:
+ goto s_n_llhttp__internal__n_req_http_major;
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_span_end_llhttp__on_url_5: {
+ const unsigned char* start;
+ int err;
+
+ start = state->_span_pos0;
+ state->_span_pos0 = NULL;
+ err = llhttp__on_url(state, start, p);
+ if (err != 0) {
+ state->error = err;
+ state->error_pos = (const char*) p;
+ state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_url_skip_to_http;
+ return s_error;
+ }
+ goto s_n_llhttp__internal__n_url_skip_to_http;
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_span_end_llhttp__on_url_6: {
+ const unsigned char* start;
+ int err;
+
+ start = state->_span_pos0;
+ state->_span_pos0 = NULL;
+ err = llhttp__on_url(state, start, p);
+ if (err != 0) {
+ state->error = err;
+ state->error_pos = (const char*) p;
+ state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_url_skip_to_http09;
+ return s_error;
+ }
+ goto s_n_llhttp__internal__n_url_skip_to_http09;
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_span_end_llhttp__on_url_7: {
+ const unsigned char* start;
+ int err;
+
+ start = state->_span_pos0;
+ state->_span_pos0 = NULL;
+ err = llhttp__on_url(state, start, p);
+ if (err != 0) {
+ state->error = err;
+ state->error_pos = (const char*) p;
+ state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_url_skip_lf_to_http09;
+ return s_error;
+ }
+ goto s_n_llhttp__internal__n_url_skip_lf_to_http09;
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_span_end_llhttp__on_url_8: {
+ const unsigned char* start;
+ int err;
+
+ start = state->_span_pos0;
+ state->_span_pos0 = NULL;
+ err = llhttp__on_url(state, start, p);
+ if (err != 0) {
+ state->error = err;
+ state->error_pos = (const char*) p;
+ state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_url_skip_to_http;
+ return s_error;
+ }
+ goto s_n_llhttp__internal__n_url_skip_to_http;
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_error_24: {
+ state->error = 0x7;
+ state->reason = "Invalid char in url fragment start";
+ state->error_pos = (const char*) p;
+ state->_current = (void*) (intptr_t) s_error;
+ return s_error;
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_span_end_llhttp__on_url_9: {
+ const unsigned char* start;
+ int err;
+
+ start = state->_span_pos0;
+ state->_span_pos0 = NULL;
+ err = llhttp__on_url(state, start, p);
+ if (err != 0) {
+ state->error = err;
+ state->error_pos = (const char*) p;
+ state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_url_skip_to_http09;
+ return s_error;
+ }
+ goto s_n_llhttp__internal__n_url_skip_to_http09;
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_span_end_llhttp__on_url_10: {
+ const unsigned char* start;
+ int err;
+
+ start = state->_span_pos0;
+ state->_span_pos0 = NULL;
+ err = llhttp__on_url(state, start, p);
+ if (err != 0) {
+ state->error = err;
+ state->error_pos = (const char*) p;
+ state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_url_skip_lf_to_http09;
+ return s_error;
+ }
+ goto s_n_llhttp__internal__n_url_skip_lf_to_http09;
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_span_end_llhttp__on_url_11: {
+ const unsigned char* start;
+ int err;
+
+ start = state->_span_pos0;
+ state->_span_pos0 = NULL;
+ err = llhttp__on_url(state, start, p);
+ if (err != 0) {
+ state->error = err;
+ state->error_pos = (const char*) p;
+ state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_url_skip_to_http;
+ return s_error;
+ }
+ goto s_n_llhttp__internal__n_url_skip_to_http;
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_error_25: {
+ state->error = 0x7;
+ state->reason = "Invalid char in url query";
+ state->error_pos = (const char*) p;
+ state->_current = (void*) (intptr_t) s_error;
+ return s_error;
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_error_26: {
+ state->error = 0x7;
+ state->reason = "Invalid char in url path";
+ state->error_pos = (const char*) p;
+ state->_current = (void*) (intptr_t) s_error;
+ return s_error;
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_span_end_llhttp__on_url: {
+ const unsigned char* start;
+ int err;
+
+ start = state->_span_pos0;
+ state->_span_pos0 = NULL;
+ err = llhttp__on_url(state, start, p);
+ if (err != 0) {
+ state->error = err;
+ state->error_pos = (const char*) p;
+ state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_url_skip_to_http09;
+ return s_error;
+ }
+ goto s_n_llhttp__internal__n_url_skip_to_http09;
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_span_end_llhttp__on_url_1: {
+ const unsigned char* start;
+ int err;
+
+ start = state->_span_pos0;
+ state->_span_pos0 = NULL;
+ err = llhttp__on_url(state, start, p);
+ if (err != 0) {
+ state->error = err;
+ state->error_pos = (const char*) p;
+ state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_url_skip_lf_to_http09;
+ return s_error;
+ }
+ goto s_n_llhttp__internal__n_url_skip_lf_to_http09;
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_span_end_llhttp__on_url_2: {
+ const unsigned char* start;
+ int err;
+
+ start = state->_span_pos0;
+ state->_span_pos0 = NULL;
+ err = llhttp__on_url(state, start, p);
+ if (err != 0) {
+ state->error = err;
+ state->error_pos = (const char*) p;
+ state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_url_skip_to_http;
+ return s_error;
+ }
+ goto s_n_llhttp__internal__n_url_skip_to_http;
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_span_end_llhttp__on_url_12: {
+ const unsigned char* start;
+ int err;
+
+ start = state->_span_pos0;
+ state->_span_pos0 = NULL;
+ err = llhttp__on_url(state, start, p);
+ if (err != 0) {
+ state->error = err;
+ state->error_pos = (const char*) p;
+ state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_url_skip_to_http09;
+ return s_error;
+ }
+ goto s_n_llhttp__internal__n_url_skip_to_http09;
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_span_end_llhttp__on_url_13: {
+ const unsigned char* start;
+ int err;
+
+ start = state->_span_pos0;
+ state->_span_pos0 = NULL;
+ err = llhttp__on_url(state, start, p);
+ if (err != 0) {
+ state->error = err;
+ state->error_pos = (const char*) p;
+ state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_url_skip_lf_to_http09;
+ return s_error;
+ }
+ goto s_n_llhttp__internal__n_url_skip_lf_to_http09;
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_span_end_llhttp__on_url_14: {
+ const unsigned char* start;
+ int err;
+
+ start = state->_span_pos0;
+ state->_span_pos0 = NULL;
+ err = llhttp__on_url(state, start, p);
+ if (err != 0) {
+ state->error = err;
+ state->error_pos = (const char*) p;
+ state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_url_skip_to_http;
+ return s_error;
+ }
+ goto s_n_llhttp__internal__n_url_skip_to_http;
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_error_27: {
+ state->error = 0x7;
+ state->reason = "Double @ in url";
+ state->error_pos = (const char*) p;
+ state->_current = (void*) (intptr_t) s_error;
+ return s_error;
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_error_28: {
+ state->error = 0x7;
+ state->reason = "Unexpected char in url server";
+ state->error_pos = (const char*) p;
+ state->_current = (void*) (intptr_t) s_error;
+ return s_error;
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_error_29: {
+ state->error = 0x7;
+ state->reason = "Unexpected char in url server";
+ state->error_pos = (const char*) p;
+ state->_current = (void*) (intptr_t) s_error;
+ return s_error;
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_error_31: {
+ state->error = 0x7;
+ state->reason = "Unexpected char in url schema";
+ state->error_pos = (const char*) p;
+ state->_current = (void*) (intptr_t) s_error;
+ return s_error;
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_error_32: {
+ state->error = 0x7;
+ state->reason = "Unexpected char in url schema";
+ state->error_pos = (const char*) p;
+ state->_current = (void*) (intptr_t) s_error;
+ return s_error;
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_error_33: {
+ state->error = 0x7;
+ state->reason = "Unexpected start char in url";
+ state->error_pos = (const char*) p;
+ state->_current = (void*) (intptr_t) s_error;
+ return s_error;
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_invoke_is_equal_method: {
+ switch (llhttp__internal__c_is_equal_method(state, p, endp)) {
+ case 0:
+ goto s_n_llhttp__internal__n_span_start_llhttp__on_url_1;
+ default:
+ goto s_n_llhttp__internal__n_span_start_llhttp__on_url;
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_error_34: {
+ state->error = 0x6;
+ state->reason = "Expected space after method";
+ state->error_pos = (const char*) p;
+ state->_current = (void*) (intptr_t) s_error;
+ return s_error;
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_invoke_store_method_1: {
+ switch (llhttp__internal__c_store_method(state, p, endp, match)) {
+ default:
+ goto s_n_llhttp__internal__n_req_first_space_before_url;
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_error_42: {
+ state->error = 0x6;
+ state->reason = "Invalid method encountered";
+ state->error_pos = (const char*) p;
+ state->_current = (void*) (intptr_t) s_error;
+ return s_error;
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_error_35: {
+ state->error = 0xd;
+ state->reason = "Response overflow";
+ state->error_pos = (const char*) p;
+ state->_current = (void*) (intptr_t) s_error;
+ return s_error;
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_invoke_mul_add_status_code: {
+ switch (llhttp__internal__c_mul_add_status_code(state, p, endp, match)) {
+ case 1:
+ goto s_n_llhttp__internal__n_error_35;
+ default:
+ goto s_n_llhttp__internal__n_res_status_code;
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_span_end_llhttp__on_status: {
+ const unsigned char* start;
+ int err;
+
+ start = state->_span_pos0;
+ state->_span_pos0 = NULL;
+ err = llhttp__on_status(state, start, p);
+ if (err != 0) {
+ state->error = err;
+ state->error_pos = (const char*) (p + 1);
+ state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_header_field_start;
+ return s_error;
+ }
+ p++;
+ goto s_n_llhttp__internal__n_header_field_start;
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_span_end_llhttp__on_status_1: {
+ const unsigned char* start;
+ int err;
+
+ start = state->_span_pos0;
+ state->_span_pos0 = NULL;
+ err = llhttp__on_status(state, start, p);
+ if (err != 0) {
+ state->error = err;
+ state->error_pos = (const char*) (p + 1);
+ state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_res_line_almost_done;
+ return s_error;
+ }
+ p++;
+ goto s_n_llhttp__internal__n_res_line_almost_done;
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_error_36: {
+ state->error = 0xd;
+ state->reason = "Invalid response status";
+ state->error_pos = (const char*) p;
+ state->_current = (void*) (intptr_t) s_error;
+ return s_error;
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_invoke_update_status_code: {
+ switch (llhttp__internal__c_update_status_code(state, p, endp)) {
+ default:
+ goto s_n_llhttp__internal__n_res_status_code;
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_error_37: {
+ state->error = 0x9;
+ state->reason = "Expected space after version";
+ state->error_pos = (const char*) p;
+ state->_current = (void*) (intptr_t) s_error;
+ return s_error;
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_invoke_store_http_minor_1: {
+ switch (llhttp__internal__c_store_http_minor(state, p, endp, match)) {
+ default:
+ goto s_n_llhttp__internal__n_res_http_end;
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_error_38: {
+ state->error = 0x9;
+ state->reason = "Invalid minor version";
+ state->error_pos = (const char*) p;
+ state->_current = (void*) (intptr_t) s_error;
+ return s_error;
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_error_39: {
+ state->error = 0x9;
+ state->reason = "Expected dot";
+ state->error_pos = (const char*) p;
+ state->_current = (void*) (intptr_t) s_error;
+ return s_error;
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_invoke_store_http_major_1: {
+ switch (llhttp__internal__c_store_http_major(state, p, endp, match)) {
+ default:
+ goto s_n_llhttp__internal__n_res_http_dot;
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_error_40: {
+ state->error = 0x9;
+ state->reason = "Invalid major version";
+ state->error_pos = (const char*) p;
+ state->_current = (void*) (intptr_t) s_error;
+ return s_error;
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_error_43: {
+ state->error = 0x8;
+ state->reason = "Expected HTTP/";
+ state->error_pos = (const char*) p;
+ state->_current = (void*) (intptr_t) s_error;
+ return s_error;
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_invoke_update_type: {
+ switch (llhttp__internal__c_update_type(state, p, endp)) {
+ default:
+ goto s_n_llhttp__internal__n_req_first_space_before_url;
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_invoke_store_method: {
+ switch (llhttp__internal__c_store_method(state, p, endp, match)) {
+ default:
+ goto s_n_llhttp__internal__n_invoke_update_type;
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_error_41: {
+ state->error = 0x8;
+ state->reason = "Invalid word encountered";
+ state->error_pos = (const char*) p;
+ state->_current = (void*) (intptr_t) s_error;
+ return s_error;
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_invoke_update_type_1: {
+ switch (llhttp__internal__c_update_type_1(state, p, endp)) {
+ default:
+ goto s_n_llhttp__internal__n_res_http_major;
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_invoke_update_type_2: {
+ switch (llhttp__internal__c_update_type(state, p, endp)) {
+ default:
+ goto s_n_llhttp__internal__n_start_req;
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_pause_8: {
+ state->error = 0x14;
+ state->reason = "on_message_begin pause";
+ state->error_pos = (const char*) p;
+ state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_invoke_load_type;
+ return s_error;
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_error: {
+ state->error = 0xf;
+ state->reason = "`on_message_begin` callback error";
+ state->error_pos = (const char*) p;
+ state->_current = (void*) (intptr_t) s_error;
+ return s_error;
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_invoke_llhttp__on_message_begin: {
+ switch (llhttp__on_message_begin(state, p, endp)) {
+ case 0:
+ goto s_n_llhttp__internal__n_invoke_load_type;
+ case 20:
+ goto s_n_llhttp__internal__n_pause_8;
+ default:
+ goto s_n_llhttp__internal__n_error;
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+ s_n_llhttp__internal__n_invoke_update_finish: {
+ switch (llhttp__internal__c_update_finish(state, p, endp)) {
+ default:
+ goto s_n_llhttp__internal__n_invoke_llhttp__on_message_begin;
+ }
+ /* UNREACHABLE */;
+ abort();
+ }
+}
+
+int llhttp__internal_execute(llhttp__internal_t* state, const char* p, const char* endp) {
+ llparse_state_t next;
+
+ /* check lingering errors */
+ if (state->error != 0) {
+ return state->error;
+ }
+
+ /* restart spans */
+ if (state->_span_pos0 != NULL) {
+ state->_span_pos0 = (void*) p;
+ }
+
+ next = llhttp__internal__run(state, (const unsigned char*) p, (const unsigned char*) endp);
+ if (next == s_error) {
+ return state->error;
+ }
+ state->_current = (void*) (intptr_t) next;
+
+ /* execute spans */
+ if (state->_span_pos0 != NULL) {
+ int error;
+
+ error = ((llhttp__internal__span_cb) state->_span_cb0)(state, state->_span_pos0, (const char*) endp);
+ if (error != 0) {
+ state->error = error;
+ state->error_pos = endp;
+ }
+ }
+
+ return 0;
+}
\ No newline at end of file
diff --git a/deps/openssl/openssl.gyp b/deps/openssl/openssl.gyp
index 6b0770ebbc1b0e..4a6b55686679d4 100644
--- a/deps/openssl/openssl.gyp
+++ b/deps/openssl/openssl.gyp
@@ -1,7 +1,4 @@
{
- 'variables': {
- 'openssl_no_asm%': 0,
- },
'targets': [
{
'target_name': 'openssl',
diff --git a/deps/v8/gypfiles/toolchain.gypi b/deps/v8/gypfiles/toolchain.gypi
index ea8f1c2f00da56..4860c5b7724e20 100644
--- a/deps/v8/gypfiles/toolchain.gypi
+++ b/deps/v8/gypfiles/toolchain.gypi
@@ -1134,121 +1134,7 @@
}],
], # conditions
'configurations': {
- # Abstract configuration for v8_optimized_debug == 0.
- 'DebugBase0': {
- 'abstract': 1,
- 'msvs_settings': {
- 'VCCLCompilerTool': {
- 'Optimization': '0',
- 'conditions': [
- ['component=="shared_library" or force_dynamic_crt==1', {
- 'RuntimeLibrary': '3', # /MDd
- }, {
- 'RuntimeLibrary': '1', # /MTd
- }],
- ],
- },
- 'VCLinkerTool': {
- 'LinkIncremental': '2',
- },
- },
- 'variables': {
- 'v8_enable_slow_dchecks%': 1,
- },
- 'conditions': [
- ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" or \
- OS=="qnx" or OS=="aix"', {
- 'cflags!': [
- '-O3',
- '-O2',
- '-O1',
- '-Os',
- ],
- 'cflags': [
- '-fdata-sections',
- '-ffunction-sections',
- ],
- }],
- ['OS=="mac"', {
- 'xcode_settings': {
- 'GCC_OPTIMIZATION_LEVEL': '0', # -O0
- },
- }],
- ['v8_enable_slow_dchecks==1', {
- 'defines': [
- 'ENABLE_SLOW_DCHECKS',
- ],
- }],
- ],
- }, # DebugBase0
- # Abstract configuration for v8_optimized_debug == 1.
- 'DebugBase1': {
- 'abstract': 1,
- 'msvs_settings': {
- 'VCCLCompilerTool': {
- 'Optimization': '2',
- 'InlineFunctionExpansion': '2',
- 'EnableIntrinsicFunctions': 'true',
- 'FavorSizeOrSpeed': '0',
- 'StringPooling': 'true',
- 'BasicRuntimeChecks': '0',
- 'conditions': [
- ['component=="shared_library" or force_dynamic_crt==1', {
- 'RuntimeLibrary': '3', #/MDd
- }, {
- 'RuntimeLibrary': '1', #/MTd
- }],
- ],
- },
- 'VCLinkerTool': {
- 'LinkIncremental': '1',
- 'OptimizeReferences': '2',
- 'EnableCOMDATFolding': '2',
- },
- },
- 'variables': {
- 'v8_enable_slow_dchecks%': 0,
- },
- 'conditions': [
- ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" or \
- OS=="qnx" or OS=="aix"', {
- 'cflags!': [
- '-O0',
- '-O1',
- '-Os',
- ],
- 'cflags': [
- '-fdata-sections',
- '-ffunction-sections',
- ],
- 'conditions': [
- # Don't use -O3 with sanitizers.
- ['asan==0 and msan==0 and lsan==0 \
- and tsan==0 and ubsan==0 and ubsan_vptr==0', {
- 'cflags': ['-O3'],
- 'cflags!': ['-O2'],
- }, {
- 'cflags': ['-O2'],
- 'cflags!': ['-O3'],
- }],
- ],
- }],
- ['OS=="mac"', {
- 'xcode_settings': {
- 'GCC_OPTIMIZATION_LEVEL': '3', # -O3
- 'GCC_STRICT_ALIASING': 'YES',
- },
- }],
- ['v8_enable_slow_dchecks==1', {
- 'defines': [
- 'ENABLE_SLOW_DCHECKS',
- ],
- }],
- ],
- }, # DebugBase1
- # Common settings for the Debug configuration.
- 'DebugBaseCommon': {
- 'abstract': 1,
+ 'Debug': {
'defines': [
'ENABLE_DISASSEMBLER',
'V8_ENABLE_CHECKS',
@@ -1311,27 +1197,126 @@
}],
],
}],
- ],
- }, # DebugBaseCommon
- 'Debug': {
- 'inherit_from': ['DebugBaseCommon'],
- 'conditions': [
['v8_optimized_debug==0', {
- 'inherit_from': ['DebugBase0'],
+ 'msvs_settings': {
+ 'VCCLCompilerTool': {
+ 'Optimization': '0',
+ 'conditions': [
+ ['component=="shared_library" or force_dynamic_crt==1', {
+ 'RuntimeLibrary': '3', # /MDd
+ }, {
+ 'RuntimeLibrary': '1', # /MTd
+ }],
+ ],
+ },
+ 'VCLinkerTool': {
+ 'LinkIncremental': '2',
+ },
+ },
+ 'variables': {
+ 'v8_enable_slow_dchecks%': 1,
+ },
+ 'conditions': [
+ ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" or \
+ OS=="qnx" or OS=="aix"', {
+ 'cflags!': [
+ '-O3',
+ '-O2',
+ '-O1',
+ '-Os',
+ ],
+ 'cflags': [
+ '-fdata-sections',
+ '-ffunction-sections',
+ ],
+ }],
+ ['OS=="mac"', {
+ 'xcode_settings': {
+ 'GCC_OPTIMIZATION_LEVEL': '0', # -O0
+ },
+ }],
+ ['v8_enable_slow_dchecks==1', {
+ 'defines': [
+ 'ENABLE_SLOW_DCHECKS',
+ ],
+ }],
+ ],
}, {
- 'inherit_from': ['DebugBase1'],
+ 'msvs_settings': {
+ 'VCCLCompilerTool': {
+ 'Optimization': '2',
+ 'InlineFunctionExpansion': '2',
+ 'EnableIntrinsicFunctions': 'true',
+ 'FavorSizeOrSpeed': '0',
+ 'StringPooling': 'true',
+ 'BasicRuntimeChecks': '0',
+ 'conditions': [
+ ['component=="shared_library" or force_dynamic_crt==1', {
+ 'RuntimeLibrary': '3', #/MDd
+ }, {
+ 'RuntimeLibrary': '1', #/MTd
+ }],
+ ],
+ },
+ 'VCLinkerTool': {
+ 'LinkIncremental': '1',
+ 'OptimizeReferences': '2',
+ 'EnableCOMDATFolding': '2',
+ },
+ },
+ 'variables': {
+ 'v8_enable_slow_dchecks%': 0,
+ },
+ 'conditions': [
+ ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" or \
+ OS=="qnx" or OS=="aix"', {
+ 'cflags!': [
+ '-O0',
+ '-O1',
+ '-Os',
+ ],
+ 'cflags': [
+ '-fdata-sections',
+ '-ffunction-sections',
+ ],
+ 'conditions': [
+ # Don't use -O3 with sanitizers.
+ ['asan==0 and msan==0 and lsan==0 \
+ and tsan==0 and ubsan==0 and ubsan_vptr==0', {
+ 'cflags': ['-O3'],
+ 'cflags!': ['-O2'],
+ }, {
+ 'cflags': ['-O2'],
+ 'cflags!': ['-O3'],
+ }],
+ ],
+ }],
+ ['OS=="mac"', {
+ 'xcode_settings': {
+ 'GCC_OPTIMIZATION_LEVEL': '3', # -O3
+ 'GCC_STRICT_ALIASING': 'YES',
+ },
+ }],
+ ['v8_enable_slow_dchecks==1', {
+ 'defines': [
+ 'ENABLE_SLOW_DCHECKS',
+ ],
+ }],
+ ],
}],
# Temporary refs: /~https://github.com/nodejs/node/pull/23801
['v8_enable_handle_zapping==1', {
'defines': ['ENABLE_HANDLE_ZAPPING',],
}],
],
- }, # Debug
- 'ReleaseBase': {
- 'abstract': 1,
+
+ }, # DebugBaseCommon
+ 'Release': {
'variables': {
'v8_enable_slow_dchecks%': 0,
},
+ # Temporary refs: /~https://github.com/nodejs/node/pull/23801
+ 'defines!': ['ENABLE_HANDLE_ZAPPING',],
'conditions': [
['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" \
or OS=="aix"', {
@@ -1407,29 +1392,6 @@
}],
], # conditions
}, # Release
- 'Release': {
- 'inherit_from': ['ReleaseBase'],
- # Temporary refs: /~https://github.com/nodejs/node/pull/23801
- 'defines!': ['ENABLE_HANDLE_ZAPPING',],
- }, # Debug
- 'conditions': [
- [ 'OS=="win"', {
- # TODO(bradnelson): add a gyp mechanism to make this more graceful.
- 'Debug_x64': {
- 'inherit_from': ['DebugBaseCommon'],
- 'conditions': [
- ['v8_optimized_debug==0', {
- 'inherit_from': ['DebugBase0'],
- }, {
- 'inherit_from': ['DebugBase1'],
- }],
- ],
- },
- 'Release_x64': {
- 'inherit_from': ['ReleaseBase'],
- },
- }],
- ],
}, # configurations
'msvs_disabled_warnings': [
4245, # Conversion with signed/unsigned mismatch.
diff --git a/deps/v8/gypfiles/v8.gyp b/deps/v8/gypfiles/v8.gyp
index f47cf075bb63bf..0c257025caeae4 100644
--- a/deps/v8/gypfiles/v8.gyp
+++ b/deps/v8/gypfiles/v8.gyp
@@ -2539,23 +2539,10 @@
'_HAS_EXCEPTIONS=0',
'BUILDING_V8_SHARED=1',
],
- # This is defined trough `configurations` for GYP+ninja compatibility
- 'configurations': {
- 'Debug': {
- 'msvs_settings': {
- 'VCCLCompilerTool': {
- 'RuntimeTypeInfo': 'true',
- 'ExceptionHandling': 1,
- },
- }
- },
- 'Release': {
- 'msvs_settings': {
- 'VCCLCompilerTool': {
- 'RuntimeTypeInfo': 'true',
- 'ExceptionHandling': 1,
- },
- }
+ 'msvs_settings': {
+ 'VCCLCompilerTool': {
+ 'RuntimeTypeInfo': 'true',
+ 'ExceptionHandling': 1,
},
},
'sources': [
diff --git a/deps/v8/include/v8-profiler.h b/deps/v8/include/v8-profiler.h
index 9981061a44bf06..3689a122725f89 100644
--- a/deps/v8/include/v8-profiler.h
+++ b/deps/v8/include/v8-profiler.h
@@ -341,6 +341,12 @@ class V8_EXPORT CpuProfiler {
V8_DEPRECATED("Use Isolate::SetIdle(bool) instead.",
void SetIdle(bool is_idle));
+ /**
+ * Generate more detailed source positions to code objects. This results in
+ * better results when mapping profiling samples to script source.
+ */
+ static void UseDetailedSourcePositionsForProfiling(Isolate* isolate);
+
private:
CpuProfiler();
~CpuProfiler();
diff --git a/deps/v8/include/v8-version.h b/deps/v8/include/v8-version.h
index 360d80865ca427..63dc5e7a7bab0f 100644
--- a/deps/v8/include/v8-version.h
+++ b/deps/v8/include/v8-version.h
@@ -11,7 +11,7 @@
#define V8_MAJOR_VERSION 7
#define V8_MINOR_VERSION 0
#define V8_BUILD_NUMBER 276
-#define V8_PATCH_LEVEL 32
+#define V8_PATCH_LEVEL 38
// Use 1 for candidates and 0 otherwise.
// (Boolean macro values are not supported by all preprocessors.)
diff --git a/deps/v8/include/v8.h b/deps/v8/include/v8.h
index c48025871aa85b..e1951ec270597d 100644
--- a/deps/v8/include/v8.h
+++ b/deps/v8/include/v8.h
@@ -3779,6 +3779,12 @@ class V8_EXPORT Array : public Object {
*/
static Local New(Isolate* isolate, int length = 0);
+ /**
+ * Creates a JavaScript array out of a Local array in C++
+ * with a known length.
+ */
+ static Local New(Isolate* isolate, Local* elements,
+ size_t length);
V8_INLINE static Array* Cast(Value* obj);
private:
Array();
diff --git a/deps/v8/infra/testing/builders.pyl b/deps/v8/infra/testing/builders.pyl
index bf24d2c9954131..31aef9c3214d90 100644
--- a/deps/v8/infra/testing/builders.pyl
+++ b/deps/v8/infra/testing/builders.pyl
@@ -685,11 +685,6 @@
{'name': 'mozilla'},
],
},
- 'V8 Linux - presubmit': {
- 'tests': [
- {'name': 'presubmit'},
- ],
- },
'V8 Linux - shared': {
'tests': [
{'name': 'mozilla'},
@@ -1514,7 +1509,6 @@
},
'tests': [
{'name': 'mozilla'},
- {'name': 'presubmit'},
{'name': 'test262'},
{'name': 'v8testing'},
],
@@ -1527,7 +1521,6 @@
},
'tests': [
{'name': 'mozilla'},
- {'name': 'presubmit'},
{'name': 'test262'},
{'name': 'v8testing', 'shards': 3},
],
@@ -1540,7 +1533,6 @@
},
'tests': [
{'name': 'mozilla'},
- {'name': 'presubmit'},
{'name': 'test262'},
{'name': 'v8testing'},
],
@@ -1553,7 +1545,6 @@
},
'tests': [
{'name': 'mozilla'},
- {'name': 'presubmit'},
{'name': 'test262'},
{'name': 'v8testing', 'shards': 3},
],
diff --git a/deps/v8/src/api.cc b/deps/v8/src/api.cc
index 54d1ba1afc7099..8f8aaf7bc628ac 100644
--- a/deps/v8/src/api.cc
+++ b/deps/v8/src/api.cc
@@ -6981,6 +6981,23 @@ Local v8::Array::New(Isolate* isolate, int length) {
return Utils::ToLocal(obj);
}
+Local v8::Array::New(Isolate* isolate, Local* elements,
+ size_t length) {
+ i::Isolate* i_isolate = reinterpret_cast(isolate);
+ i::Factory* factory = i_isolate->factory();
+ LOG_API(i_isolate, Array, New);
+ ENTER_V8_NO_SCRIPT_NO_EXCEPTION(i_isolate);
+ int len = static_cast(length);
+
+ i::Handle result = factory->NewFixedArray(len);
+ for (int i = 0; i < len; i++) {
+ i::Handle element = Utils::OpenHandle(*elements[i]);
+ result->set(i, *element);
+ }
+
+ return Utils::ToLocal(
+ factory->NewJSArrayWithElements(result, i::PACKED_ELEMENTS, len));
+}
uint32_t v8::Array::Length() const {
i::Handle obj = Utils::OpenHandle(this);
@@ -10115,6 +10132,11 @@ void CpuProfiler::SetIdle(bool is_idle) {
isolate->SetIdle(is_idle);
}
+void CpuProfiler::UseDetailedSourcePositionsForProfiling(Isolate* isolate) {
+ reinterpret_cast(isolate)
+ ->set_detailed_source_positions_for_profiling(true);
+}
+
uintptr_t CodeEvent::GetCodeStartAddress() {
return reinterpret_cast(this)->code_start_address;
}
diff --git a/deps/v8/src/base/debug/stack_trace_win.cc b/deps/v8/src/base/debug/stack_trace_win.cc
index 6b221312332411..3fe66d97ada531 100644
--- a/deps/v8/src/base/debug/stack_trace_win.cc
+++ b/deps/v8/src/base/debug/stack_trace_win.cc
@@ -7,6 +7,13 @@
#include "src/base/debug/stack_trace.h"
+// This file can't use "src/base/win32-headers.h" because it defines symbols
+// that lead to compilation errors. But `NOMINMAX` should be defined to disable
+// defining of the `min` and `max` MACROS.
+#ifndef NOMINMAX
+#define NOMINMAX
+#endif
+
#include
#include
#include
diff --git a/deps/v8/src/isolate.cc b/deps/v8/src/isolate.cc
index 89fecce80431c5..eed52d9c19fb1a 100644
--- a/deps/v8/src/isolate.cc
+++ b/deps/v8/src/isolate.cc
@@ -3257,7 +3257,8 @@ bool Isolate::use_optimizer() {
}
bool Isolate::NeedsDetailedOptimizedCodeLineInfo() const {
- return NeedsSourcePositionsForProfiling() || FLAG_detailed_line_info;
+ return NeedsSourcePositionsForProfiling() ||
+ detailed_source_positions_for_profiling();
}
bool Isolate::NeedsSourcePositionsForProfiling() const {
diff --git a/deps/v8/src/isolate.h b/deps/v8/src/isolate.h
index e199a93ec47859..efd479c41ee4a5 100644
--- a/deps/v8/src/isolate.h
+++ b/deps/v8/src/isolate.h
@@ -553,7 +553,8 @@ typedef std::vector DebugObjectCache;
V(int, last_console_context_id, 0) \
V(v8_inspector::V8Inspector*, inspector, nullptr) \
V(bool, next_v8_call_is_safe_for_termination, false) \
- V(bool, only_terminate_in_safe_scope, false)
+ V(bool, only_terminate_in_safe_scope, false) \
+ V(bool, detailed_source_positions_for_profiling, FLAG_detailed_line_info)
#define THREAD_LOCAL_TOP_ACCESSOR(type, name) \
inline void set_##name(type v) { thread_local_top_.name##_ = v; } \
diff --git a/deps/v8/src/objects.cc b/deps/v8/src/objects.cc
index d4af74b2bd3983..811656ad9afa43 100644
--- a/deps/v8/src/objects.cc
+++ b/deps/v8/src/objects.cc
@@ -10266,15 +10266,22 @@ Handle DescriptorArray::CopyForFastObjectClone(
Name* key = src->GetKey(i);
PropertyDetails details = src->GetDetails(i);
- SLOW_DCHECK(!key->IsPrivateField() && details.IsEnumerable() &&
- details.kind() == kData);
+ DCHECK(!key->IsPrivateField());
+ DCHECK(details.IsEnumerable());
+ DCHECK_EQ(details.kind(), kData);
// Ensure the ObjectClone property details are NONE, and that all source
// details did not contain DONT_ENUM.
PropertyDetails new_details(kData, NONE, details.location(),
details.constness(), details.representation(),
details.field_index());
- descriptors->Set(i, key, src->GetValue(i), new_details);
+ // Do not propagate the field type of normal object fields from the
+ // original descriptors since FieldType changes don't create new maps.
+ MaybeObject* type = src->GetValue(i);
+ if (details.location() == PropertyLocation::kField) {
+ type = MaybeObject::FromObject(FieldType::Any());
+ }
+ descriptors->Set(i, key, type, new_details);
}
descriptors->Sort();
diff --git a/deps/v8/src/profiler/heap-profiler.cc b/deps/v8/src/profiler/heap-profiler.cc
index 71e297c4bf1501..3a1df29bd47b54 100644
--- a/deps/v8/src/profiler/heap-profiler.cc
+++ b/deps/v8/src/profiler/heap-profiler.cc
@@ -23,9 +23,14 @@ HeapProfiler::~HeapProfiler() = default;
void HeapProfiler::DeleteAllSnapshots() {
snapshots_.clear();
- names_.reset(new StringsStorage());
+ MaybeClearStringsStorage();
}
+void HeapProfiler::MaybeClearStringsStorage() {
+ if (snapshots_.empty() && !sampling_heap_profiler_ && !allocation_tracker_) {
+ names_.reset(new StringsStorage());
+ }
+}
void HeapProfiler::RemoveSnapshot(HeapSnapshot* snapshot) {
snapshots_.erase(
@@ -126,6 +131,7 @@ bool HeapProfiler::StartSamplingHeapProfiler(
void HeapProfiler::StopSamplingHeapProfiler() {
sampling_heap_profiler_.reset();
+ MaybeClearStringsStorage();
}
@@ -159,6 +165,7 @@ void HeapProfiler::StopHeapObjectsTracking() {
ids_->StopHeapObjectsTracking();
if (allocation_tracker_) {
allocation_tracker_.reset();
+ MaybeClearStringsStorage();
heap()->RemoveHeapObjectAllocationTracker(this);
}
}
diff --git a/deps/v8/src/profiler/heap-profiler.h b/deps/v8/src/profiler/heap-profiler.h
index 8ce379d59df6ca..099c0e24fad7d8 100644
--- a/deps/v8/src/profiler/heap-profiler.h
+++ b/deps/v8/src/profiler/heap-profiler.h
@@ -92,6 +92,8 @@ class HeapProfiler : public HeapObjectAllocationTracker {
v8::PersistentValueVector* objects);
private:
+ void MaybeClearStringsStorage();
+
Heap* heap() const;
// Mapping from HeapObject addresses to objects' uids.
diff --git a/deps/v8/src/runtime/runtime-array.cc b/deps/v8/src/runtime/runtime-array.cc
index 31b03f6bb75044..d72159b0acf926 100644
--- a/deps/v8/src/runtime/runtime-array.cc
+++ b/deps/v8/src/runtime/runtime-array.cc
@@ -145,7 +145,15 @@ Object* RemoveArrayHolesGeneric(Isolate* isolate, Handle receiver,
MAYBE_RETURN(delete_result, ReadOnlyRoots(isolate).exception());
}
- return *isolate->factory()->NewNumberFromUint(result);
+ // TODO(jgruber, szuend, chromium:897512): This is a workaround to prevent
+ // returning a number greater than array.length to Array.p.sort, which could
+ // trigger OOB accesses. There is still a correctness bug here though in
+ // how we shift around undefineds and delete elements in the two blocks above.
+ // This needs to be fixed soon.
+ const uint32_t number_of_non_undefined_elements = std::min(limit, result);
+
+ return *isolate->factory()->NewNumberFromUint(
+ number_of_non_undefined_elements);
}
// Collects all defined (non-hole) and non-undefined (array) elements at the
@@ -162,6 +170,7 @@ Object* RemoveArrayHoles(Isolate* isolate, Handle receiver,
Handle object = Handle::cast(receiver);
if (object->HasStringWrapperElements()) {
int len = String::cast(Handle::cast(object)->value())->length();
+ DCHECK_LE(len, limit);
return Smi::FromInt(len);
}
@@ -284,6 +293,7 @@ Object* RemoveArrayHoles(Isolate* isolate, Handle receiver,
}
}
+ DCHECK_LE(result, limit);
return *isolate->factory()->NewNumberFromUint(result);
}
diff --git a/deps/v8/src/wasm/module-compiler.cc b/deps/v8/src/wasm/module-compiler.cc
index b950c590b5c6b2..892a4e980e8b55 100644
--- a/deps/v8/src/wasm/module-compiler.cc
+++ b/deps/v8/src/wasm/module-compiler.cc
@@ -2329,12 +2329,6 @@ void AsyncCompileJob::CancelPendingForegroundTask() {
pending_foreground_task_ = nullptr;
}
-template
-void AsyncCompileJob::DoSync(Args&&... args) {
- NextStep(std::forward(args)...);
- StartForegroundTask();
-}
-
void AsyncCompileJob::StartBackgroundTask() {
auto task = base::make_unique(this, false);
@@ -2347,6 +2341,18 @@ void AsyncCompileJob::StartBackgroundTask() {
}
}
+template
+void AsyncCompileJob::DoSync(Args&&... args) {
+ NextStep(std::forward(args)...);
+ StartForegroundTask();
+}
+
+template
+void AsyncCompileJob::DoImmediately(Args&&... args) {
+ NextStep(std::forward(args)...);
+ ExecuteForegroundTaskImmediately();
+}
+
template
void AsyncCompileJob::DoAsync(Args&&... args) {
NextStep(std::forward(args)...);
@@ -2686,11 +2692,10 @@ bool AsyncStreamingProcessor::ProcessCodeSectionHeader(size_t functions_count,
FinishAsyncCompileJobWithError(decoder_.FinishDecoding(false));
return false;
}
- job_->NextStep(
- decoder_.shared_module(), false);
// Execute the PrepareAndStartCompile step immediately and not in a separate
// task.
- job_->ExecuteForegroundTaskImmediately();
+ job_->DoImmediately(
+ decoder_.shared_module(), false);
job_->native_module_->compilation_state()->SetNumberOfFunctionsToCompile(
functions_count);
@@ -2734,25 +2739,26 @@ void AsyncStreamingProcessor::OnFinishedChunk() {
// Finish the processing of the stream.
void AsyncStreamingProcessor::OnFinishedStream(OwnedVector bytes) {
TRACE_STREAMING("Finish stream...\n");
- if (job_->native_module_) {
- job_->wire_bytes_ = ModuleWireBytes(bytes.as_vector());
- job_->native_module_->set_wire_bytes(std::move(bytes));
- }
ModuleResult result = decoder_.FinishDecoding(false);
DCHECK(result.ok());
- if (job_->DecrementAndCheckFinisherCount()) {
- if (job_->native_module_ == nullptr) {
- // We are processing a WebAssembly module without code section. We need to
- // prepare compilation first before we can finish it.
- // {PrepareAndStartCompile} will call {FinishCompile} by itself if there
- // is no code section.
- job_->DoSync(result.val, true);
- } else {
- HandleScope scope(job_->isolate_);
- SaveContext saved_context(job_->isolate_);
- job_->isolate_->set_context(*job_->native_context_);
- job_->FinishCompile();
- }
+ bool needs_finish = job_->DecrementAndCheckFinisherCount();
+ if (job_->native_module_ == nullptr) {
+ // We are processing a WebAssembly module without code section. We need to
+ // prepare compilation first before we can finish it.
+ // {PrepareAndStartCompile} will call {FinishCompile} by itself if there
+ // is no code section.
+ DCHECK(needs_finish);
+ needs_finish = false;
+ job_->DoImmediately(result.val,
+ true);
+ }
+ job_->wire_bytes_ = ModuleWireBytes(bytes.as_vector());
+ job_->native_module_->set_wire_bytes(std::move(bytes));
+ if (needs_finish) {
+ HandleScope scope(job_->isolate_);
+ SaveContext saved_context(job_->isolate_);
+ job_->isolate_->set_context(*job_->native_context_);
+ job_->FinishCompile();
}
}
diff --git a/deps/v8/src/wasm/module-compiler.h b/deps/v8/src/wasm/module-compiler.h
index 57bbd883e21f30..934c978d491109 100644
--- a/deps/v8/src/wasm/module-compiler.h
+++ b/deps/v8/src/wasm/module-compiler.h
@@ -126,6 +126,10 @@ class AsyncCompileJob {
template
void DoSync(Args&&... args);
+ // Switches to the compilation step {Step} and immediately executes that step.
+ template
+ void DoImmediately(Args&&... args);
+
// Switches to the compilation step {Step} and starts a background task to
// execute it.
template
diff --git a/deps/v8/test/cctest/test-api.cc b/deps/v8/test/cctest/test-api.cc
index bf5aba2df66947..f7365c8f31a8c8 100644
--- a/deps/v8/test/cctest/test-api.cc
+++ b/deps/v8/test/cctest/test-api.cc
@@ -5247,6 +5247,22 @@ THREADED_TEST(Array) {
CHECK_EQ(27u, array->Length());
array = v8::Array::New(context->GetIsolate(), -27);
CHECK_EQ(0u, array->Length());
+
+ std::vector> vector = {v8_num(1), v8_num(2), v8_num(3)};
+ array = v8::Array::New(context->GetIsolate(), vector.data(), vector.size());
+ CHECK_EQ(vector.size(), array->Length());
+ CHECK_EQ(1, arr->Get(context.local(), 0)
+ .ToLocalChecked()
+ ->Int32Value(context.local())
+ .FromJust());
+ CHECK_EQ(2, arr->Get(context.local(), 1)
+ .ToLocalChecked()
+ ->Int32Value(context.local())
+ .FromJust());
+ CHECK_EQ(3, arr->Get(context.local(), 2)
+ .ToLocalChecked()
+ ->Int32Value(context.local())
+ .FromJust());
}
diff --git a/deps/v8/test/cctest/test-cpu-profiler.cc b/deps/v8/test/cctest/test-cpu-profiler.cc
index 75af3f6d98f127..851099607945e6 100644
--- a/deps/v8/test/cctest/test-cpu-profiler.cc
+++ b/deps/v8/test/cctest/test-cpu-profiler.cc
@@ -40,6 +40,7 @@
#include "src/objects-inl.h"
#include "src/profiler/cpu-profiler-inl.h"
#include "src/profiler/profiler-listener.h"
+#include "src/source-position-table.h"
#include "src/utils.h"
#include "test/cctest/cctest.h"
#include "test/cctest/profiler-extension.h"
@@ -2544,6 +2545,46 @@ TEST(MultipleProfilers) {
profiler2->StopProfiling("2");
}
+UNINITIALIZED_TEST(DetailedSourcePositionAPI) {
+ i::FLAG_detailed_line_info = false;
+ i::FLAG_allow_natives_syntax = true;
+ v8::Isolate::CreateParams create_params;
+ create_params.array_buffer_allocator = CcTest::array_buffer_allocator();
+ v8::Isolate* isolate = v8::Isolate::New(create_params);
+
+ const char* source =
+ "function fib(i) {"
+ " if (i <= 1) return 1; "
+ " return fib(i - 1) +"
+ " fib(i - 2);"
+ "}"
+ "fib(5);"
+ "%OptimizeFunctionOnNextCall(fib);"
+ "fib(5);"
+ "fib";
+ {
+ v8::Isolate::Scope isolate_scope(isolate);
+ v8::HandleScope handle_scope(isolate);
+ v8::Local context = v8::Context::New(isolate);
+ v8::Context::Scope context_scope(context);
+ i::Isolate* i_isolate = reinterpret_cast(isolate);
+
+ CHECK(!i_isolate->NeedsDetailedOptimizedCodeLineInfo());
+
+ int non_detailed_positions = GetSourcePositionEntryCount(i_isolate, source);
+
+ v8::CpuProfiler::UseDetailedSourcePositionsForProfiling(isolate);
+ CHECK(i_isolate->NeedsDetailedOptimizedCodeLineInfo());
+
+ int detailed_positions = GetSourcePositionEntryCount(i_isolate, source);
+
+ CHECK((non_detailed_positions == -1 && detailed_positions == -1) ||
+ non_detailed_positions < detailed_positions);
+ }
+
+ isolate->Dispose();
+}
+
} // namespace test_cpu_profiler
} // namespace internal
} // namespace v8
diff --git a/deps/v8/test/cctest/test-heap-profiler.cc b/deps/v8/test/cctest/test-heap-profiler.cc
index 5d8094d6351f6b..e4e5f4c8dc0845 100644
--- a/deps/v8/test/cctest/test-heap-profiler.cc
+++ b/deps/v8/test/cctest/test-heap-profiler.cc
@@ -3900,3 +3900,45 @@ TEST(WeakReference) {
const v8::HeapSnapshot* snapshot = heap_profiler->TakeHeapSnapshot();
CHECK(ValidateSnapshot(snapshot));
}
+
+TEST(Bug8373_1) {
+ LocalContext env;
+ v8::HandleScope scope(env->GetIsolate());
+ v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler();
+
+ heap_profiler->StartSamplingHeapProfiler(100);
+
+ heap_profiler->TakeHeapSnapshot();
+ // Causes the StringsStorage to be deleted.
+ heap_profiler->DeleteAllHeapSnapshots();
+
+ // Triggers an allocation sample that tries to use the StringsStorage.
+ for (int i = 0; i < 2 * 1024; ++i) {
+ CompileRun(
+ "new Array(64);"
+ "new Uint8Array(16);");
+ }
+
+ heap_profiler->StopSamplingHeapProfiler();
+}
+
+TEST(Bug8373_2) {
+ LocalContext env;
+ v8::HandleScope scope(env->GetIsolate());
+ v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler();
+
+ heap_profiler->StartTrackingHeapObjects(true);
+
+ heap_profiler->TakeHeapSnapshot();
+ // Causes the StringsStorage to be deleted.
+ heap_profiler->DeleteAllHeapSnapshots();
+
+ // Triggers an allocations that try to use the StringsStorage.
+ for (int i = 0; i < 2 * 1024; ++i) {
+ CompileRun(
+ "new Array(64);"
+ "new Uint8Array(16);");
+ }
+
+ heap_profiler->StopTrackingHeapObjects();
+}
diff --git a/deps/v8/test/mjsunit/regress/regress-897366.js b/deps/v8/test/mjsunit/regress/regress-897366.js
new file mode 100644
index 00000000000000..990e21590e5a7f
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-897366.js
@@ -0,0 +1,15 @@
+// Copyright 2018 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --gc-interval=100
+
+let xs = [];
+for (let i = 0; i < 205; ++i) {
+ xs.push(i);
+}
+xs.sort((a, b) => {
+ xs.shift();
+ xs[xs.length] = -246;
+ return a - b;
+});
diff --git a/deps/v8/test/mjsunit/regress/regress-897512.js b/deps/v8/test/mjsunit/regress/regress-897512.js
new file mode 100644
index 00000000000000..0e676a06c2a6d6
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-897512.js
@@ -0,0 +1,24 @@
+// Copyright 2018 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Fill up the Array prototype's elements.
+for (let i = 0; i < 100; i++) Array.prototype.unshift(3.14);
+
+// Create a holey double elements array.
+const o31 = [1.1];
+o31[37] = 2.2;
+
+// Concat converts to dictionary elements.
+const o51 = o31.concat(false);
+
+// Set one element to undefined to trigger the movement bug.
+o51[0] = undefined;
+
+assertEquals(o51.length, 39);
+
+// Sort triggers the bug.
+o51.sort();
+
+// TODO(chromium:897512): The length should be 39.
+assertEquals(o51.length, 101);
diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-881247.js b/deps/v8/test/mjsunit/regress/regress-crbug-881247.js
new file mode 100644
index 00000000000000..4605c3f51bc3b3
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-crbug-881247.js
@@ -0,0 +1,24 @@
+// Copyright 2018 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --allow-natives-syntax
+
+const resolvedPromise = Promise.resolve();
+
+function spread() {
+ const result = { ...resolvedPromise };
+ %HeapObjectVerify(result);
+ return result;
+}
+
+resolvedPromise[undefined] = {a:1};
+%HeapObjectVerify(resolvedPromise);
+
+spread();
+
+resolvedPromise[undefined] = undefined;
+%HeapObjectVerify(resolvedPromise);
+
+spread();
+%HeapObjectVerify(resolvedPromise);
diff --git a/deps/v8/test/mjsunit/wasm/async-compile.js b/deps/v8/test/mjsunit/wasm/async-compile.js
index e7f87c30e9e418..39a339aae63209 100644
--- a/deps/v8/test/mjsunit/wasm/async-compile.js
+++ b/deps/v8/test/mjsunit/wasm/async-compile.js
@@ -70,3 +70,10 @@ assertPromiseResult(async function badFunctionInTheMiddle() {
let buffer = builder.toBuffer();
await assertCompileError(buffer);
}());
+
+assertPromiseResult(async function importWithoutCode() {
+ // Regression test for https://crbug.com/898310.
+ let builder = new WasmModuleBuilder();
+ builder.addImport('m', 'q', kSig_i_i);
+ await builder.asyncInstantiate({'m': {'q': i => i}});
+}());
diff --git a/deps/v8/third_party/v8/builtins/array-sort.tq b/deps/v8/third_party/v8/builtins/array-sort.tq
index a94b432935074c..65d0b8348bd210 100644
--- a/deps/v8/third_party/v8/builtins/array-sort.tq
+++ b/deps/v8/third_party/v8/builtins/array-sort.tq
@@ -826,7 +826,7 @@ module array {
assert(i >= 0);
assert(i == stack_size - 2 || i == stack_size - 3);
- const elements: HeapObject = ReloadElements(sortState);
+ let elements: HeapObject = ReloadElements(sortState);
const Load: LoadFn = GetLoadFn(sortState);
const pending_runs: FixedArray =
@@ -859,6 +859,7 @@ module array {
const k: Smi = CallGallopRight(
context, sortState, Load, key_right, base_a, length_a, 0, False)
otherwise Bailout;
+ elements = ReloadElements(sortState);
assert(k >= 0);
base_a = base_a + k;
@@ -874,6 +875,7 @@ module array {
length_b = CallGallopLeft(
context, sortState, Load, key_left, base_b, length_b, length_b - 1,
False) otherwise Bailout;
+ elements = ReloadElements(sortState);
assert(length_b >= 0);
if (length_b == 0) return kSuccess;
@@ -893,6 +895,12 @@ module array {
}
}
+ macro LoadElementsOrTempArray(
+ useTempArray: Boolean, sortState: FixedArray): HeapObject {
+ return useTempArray == True ? GetTempArray(sortState) :
+ ReloadElements(sortState);
+ }
+
// Locates the proper position of key in a sorted array; if the array contains
// an element equal to key, return the position immediately to the left of
// the leftmost equal element. (GallopRight does the same except returns the
@@ -916,25 +924,17 @@ module array {
assert(length > 0 && base >= 0);
assert(0 <= hint && hint < length);
- // We cannot leave a pointer to elements on the stack (see comment at
- // ReloadElements). For this reason we pass a flag whether to reload
- // and which array to use.
- let elements: HeapObject = useTempArray == True ? GetTempArray(sortState) :
- ReloadElements(sortState);
-
let last_ofs: Smi = 0;
let offset: Smi = 1;
try {
- const base_hint_element: Object =
- CallLoad(context, sortState, Load, elements, base + hint)
+ const base_hint_element: Object = CallLoad(
+ context, sortState, Load,
+ LoadElementsOrTempArray(useTempArray, sortState), base + hint)
otherwise Bailout;
let order: Number =
CallCompareFn(context, sortState, base_hint_element, key)
otherwise Bailout;
- if (useTempArray == False) {
- elements = ReloadElements(sortState);
- }
if (order < 0) {
// a[base + hint] < key: gallop right, until
@@ -943,14 +943,13 @@ module array {
// a[base + length - 1] is highest.
let max_ofs: Smi = length - hint;
while (offset < max_ofs) {
- const offset_element: Object =
- CallLoad(context, sortState, Load, elements, base + hint + offset)
+ const offset_element: Object = CallLoad(
+ context, sortState, Load,
+ LoadElementsOrTempArray(useTempArray, sortState),
+ base + hint + offset)
otherwise Bailout;
order = CallCompareFn(context, sortState, offset_element, key)
otherwise Bailout;
- if (useTempArray == False) {
- elements = ReloadElements(sortState);
- }
// a[base + hint + offset] >= key? Break.
if (order >= 0) break;
@@ -975,14 +974,13 @@ module array {
// a[base + hint] is lowest.
let max_ofs: Smi = hint + 1;
while (offset < max_ofs) {
- const offset_element: Object =
- CallLoad(context, sortState, Load, elements, base + hint - offset)
+ const offset_element: Object = CallLoad(
+ context, sortState, Load,
+ LoadElementsOrTempArray(useTempArray, sortState),
+ base + hint - offset)
otherwise Bailout;
order = CallCompareFn(context, sortState, offset_element, key)
otherwise Bailout;
- if (useTempArray == False) {
- elements = ReloadElements(sortState);
- }
if (order < 0) break;
@@ -1011,14 +1009,12 @@ module array {
while (last_ofs < offset) {
const m: Smi = last_ofs + ((offset - last_ofs) >>> 1);
- const base_m_element: Object =
- CallLoad(context, sortState, Load, elements, base + m)
+ const base_m_element: Object = CallLoad(
+ context, sortState, Load,
+ LoadElementsOrTempArray(useTempArray, sortState), base + m)
otherwise Bailout;
order = CallCompareFn(context, sortState, base_m_element, key)
otherwise Bailout;
- if (useTempArray == False) {
- elements = ReloadElements(sortState);
- }
if (order < 0) {
last_ofs = m + 1; // a[base + m] < key.
@@ -1051,25 +1047,17 @@ module array {
assert(length > 0 && base >= 0);
assert(0 <= hint && hint < length);
- // We cannot leave a pointer to elements on the stack (see comment at
- // ReloadElements). For this reason we pass a flag whether to reload
- // and which array to use.
- let elements: HeapObject = useTempArray == True ? GetTempArray(sortState) :
- ReloadElements(sortState);
-
let last_ofs: Smi = 0;
let offset: Smi = 1;
try {
- const base_hint_element: Object =
- CallLoad(context, sortState, Load, elements, base + hint)
+ const base_hint_element: Object = CallLoad(
+ context, sortState, Load,
+ LoadElementsOrTempArray(useTempArray, sortState), base + hint)
otherwise Bailout;
let order: Number =
CallCompareFn(context, sortState, key, base_hint_element)
otherwise Bailout;
- if (useTempArray == False) {
- elements = ReloadElements(sortState);
- }
if (order < 0) {
// key < a[base + hint]: gallop left, until
@@ -1078,14 +1066,13 @@ module array {
// a[base + hint] is lowest.
let max_ofs: Smi = hint + 1;
while (offset < max_ofs) {
- const offset_element: Object =
- CallLoad(context, sortState, Load, elements, base + hint - offset)
+ const offset_element: Object = CallLoad(
+ context, sortState, Load,
+ LoadElementsOrTempArray(useTempArray, sortState),
+ base + hint - offset)
otherwise Bailout;
order = CallCompareFn(context, sortState, key, offset_element)
otherwise Bailout;
- if (useTempArray == False) {
- elements = ReloadElements(sortState);
- }
if (order >= 0) break;
@@ -1109,14 +1096,13 @@ module array {
// a[base + length - 1] is highest.
let max_ofs: Smi = length - hint;
while (offset < max_ofs) {
- const offset_element: Object =
- CallLoad(context, sortState, Load, elements, base + hint + offset)
+ const offset_element: Object = CallLoad(
+ context, sortState, Load,
+ LoadElementsOrTempArray(useTempArray, sortState),
+ base + hint + offset)
otherwise Bailout;
order = CallCompareFn(context, sortState, key, offset_element)
otherwise Bailout;
- if (useTempArray == False) {
- elements = ReloadElements(sortState);
- }
// a[base + hint + ofs] <= key.
if (order < 0) break;
@@ -1144,14 +1130,12 @@ module array {
while (last_ofs < offset) {
const m: Smi = last_ofs + ((offset - last_ofs) >>> 1);
- const base_m_element: Object =
- CallLoad(context, sortState, Load, elements, base + m)
+ const base_m_element: Object = CallLoad(
+ context, sortState, Load,
+ LoadElementsOrTempArray(useTempArray, sortState), base + m)
otherwise Bailout;
order = CallCompareFn(context, sortState, key, base_m_element)
otherwise Bailout;
- if (useTempArray == False) {
- elements = ReloadElements(sortState);
- }
if (order < 0) {
offset = m; // key < a[base + m].
@@ -1288,6 +1272,7 @@ module array {
nof_wins_a = CallGallopRight(
context, sortState, Load, key_right,
cursor_temp, length_a, 0, True) otherwise Bailout;
+ elements = ReloadElements(sortState);
assert(nof_wins_a >= 0);
if (nof_wins_a > 0) {
@@ -1313,6 +1298,7 @@ module array {
context, sortState, LoadF, temp_array[cursor_temp], cursor_b,
length_b, 0, False)
otherwise Bailout;
+ elements = ReloadElements(sortState);
assert(nof_wins_b >= 0);
if (nof_wins_b > 0) {
CallCopyWithinSortArray(
@@ -1461,6 +1447,7 @@ module array {
context, sortState, LoadF, temp_array[cursor_temp], baseA,
length_a, length_a - 1, False)
otherwise Bailout;
+ elements = ReloadElements(sortState);
assert(k >= 0);
nof_wins_a = length_a - k;
@@ -1487,6 +1474,7 @@ module array {
k = CallGallopLeft(
context, sortState, Load, key, 0, length_b,
length_b - 1, True) otherwise Bailout;
+ elements = ReloadElements(sortState);
assert(k >= 0);
nof_wins_b = length_b - k;
@@ -1742,35 +1730,35 @@ module array {
// 2. Let obj be ? ToObject(this value).
const obj: JSReceiver = ToObject(context, receiver);
- let map: Map = obj.map;
- const sort_state: FixedArray =
- AllocateZeroedFixedArray(kSortStateSize);
+ const sort_state: FixedArray = AllocateZeroedFixedArray(kSortStateSize);
FillFixedArrayWithSmiZero(sort_state, SmiTag(kSortStateSize));
sort_state[kReceiverIdx] = obj;
sort_state[kUserCmpFnIdx] = comparefnObj;
sort_state[kSortComparePtrIdx] =
comparefnObj != Undefined ? SortCompareUserFn : SortCompareDefault;
- sort_state[kInitialReceiverMapIdx] = map;
sort_state[kBailoutStatusIdx] = kSuccess;
+ // 3. Let len be ? ToLength(? Get(obj, "length")).
+ const len: Number =
+ ToLength_Inline(context, GetProperty(context, obj, 'length'));
+ if (len < 2) return receiver;
+
+ // TODO(szuend): Investigate performance tradeoff of skipping this step
+ // for PACKED_* and handling Undefineds during sorting.
+ const nofNonUndefined: Smi = PrepareElementsForSort(context, obj, len);
+ assert(nofNonUndefined <= len);
+
+ let map: Map = obj.map;
+ sort_state[kInitialReceiverMapIdx] = map;
+ sort_state[kInitialReceiverLengthIdx] = len;
+
try {
const a: JSArray = cast(obj) otherwise slow;
const elementsKind: ElementsKind = map.elements_kind;
if (!IsFastElementsKind(elementsKind)) goto slow;
- // 3. Let len be ? ToLength(? Get(obj, "length")).
- const len: Smi = a.length_fast;
- if (len < 2) return receiver;
-
- // TODO(szuend): Investigate performance tradeoff of skipping this step
- // for PACKED_* and handling Undefineds during sorting.
- const nofNonUndefined: Smi = PrepareElementsForSort(context, obj, len);
- assert(a.map == map);
-
- sort_state[kInitialReceiverLengthIdx] = len;
-
if (IsDoubleElementsKind(elementsKind)) {
InitializeSortStateAccessor(sort_state);
} else if (elementsKind == PACKED_SMI_ELEMENTS) {
@@ -1781,19 +1769,6 @@ module array {
ArrayTimSort(context, sort_state, nofNonUndefined);
}
label slow {
- // 3. Let len be ? ToLength(? Get(obj, "length")).
- const len: Number =
- ToLength_Inline(context, GetProperty(context, obj, 'length'));
-
- if (len < 2) return receiver;
- const nofNonUndefined: Smi = PrepareElementsForSort(context, obj, len);
-
- sort_state[kInitialReceiverLengthIdx] = len;
-
- // Reload the map, PrepareElementsForSort might have changed the
- // elements kind.
- map = obj.map;
-
if (map.elements_kind == DICTIONARY_ELEMENTS && IsExtensibleMap(map) &&
!IsCustomElementsReceiverInstanceType(map.instance_type)) {
InitializeSortStateAccessor(sort_state);
diff --git a/deps/v8/tools/presubmit.py b/deps/v8/tools/v8_presubmit.py
similarity index 100%
rename from deps/v8/tools/presubmit.py
rename to deps/v8/tools/v8_presubmit.py
diff --git a/doc/api/addons.md b/doc/api/addons.md
index 757f24c5194271..d993c72d346495 100644
--- a/doc/api/addons.md
+++ b/doc/api/addons.md
@@ -63,13 +63,15 @@ namespace demo {
using v8::FunctionCallbackInfo;
using v8::Isolate;
using v8::Local;
+using v8::NewStringType;
using v8::Object;
using v8::String;
using v8::Value;
void Method(const FunctionCallbackInfo& args) {
Isolate* isolate = args.GetIsolate();
- args.GetReturnValue().Set(String::NewFromUtf8(isolate, "world"));
+ args.GetReturnValue().Set(String::NewFromUtf8(
+ isolate, "world", NewStringType::kNormal).ToLocalChecked());
}
void Initialize(Local exports) {
@@ -464,6 +466,7 @@ using v8::Exception;
using v8::FunctionCallbackInfo;
using v8::Isolate;
using v8::Local;
+using v8::NewStringType;
using v8::Number;
using v8::Object;
using v8::String;
@@ -479,14 +482,18 @@ void Add(const FunctionCallbackInfo& args) {
if (args.Length() < 2) {
// Throw an Error that is passed back to JavaScript
isolate->ThrowException(Exception::TypeError(
- String::NewFromUtf8(isolate, "Wrong number of arguments")));
+ String::NewFromUtf8(isolate,
+ "Wrong number of arguments",
+ NewStringType::kNormal).ToLocalChecked()));
return;
}
// Check the argument types
if (!args[0]->IsNumber() || !args[1]->IsNumber()) {
isolate->ThrowException(Exception::TypeError(
- String::NewFromUtf8(isolate, "Wrong arguments")));
+ String::NewFromUtf8(isolate,
+ "Wrong arguments",
+ NewStringType::kNormal).ToLocalChecked()));
return;
}
@@ -530,10 +537,12 @@ to invoke such callbacks:
namespace demo {
+using v8::Context;
using v8::Function;
using v8::FunctionCallbackInfo;
using v8::Isolate;
using v8::Local;
+using v8::NewStringType;
using v8::Null;
using v8::Object;
using v8::String;
@@ -541,10 +550,14 @@ using v8::Value;
void RunCallback(const FunctionCallbackInfo& args) {
Isolate* isolate = args.GetIsolate();
+ Local context = isolate->GetCurrentContext();
Local cb = Local::Cast(args[0]);
const unsigned argc = 1;
- Local argv[argc] = { String::NewFromUtf8(isolate, "hello world") };
- cb->Call(Null(isolate), argc, argv);
+ Local argv[argc] = {
+ String::NewFromUtf8(isolate,
+ "hello world",
+ NewStringType::kNormal).ToLocalChecked() };
+ cb->Call(context, Null(isolate), argc, argv).ToLocalChecked();
}
void Init(Local exports, Local module) {
@@ -591,6 +604,7 @@ using v8::Context;
using v8::FunctionCallbackInfo;
using v8::Isolate;
using v8::Local;
+using v8::NewStringType;
using v8::Object;
using v8::String;
using v8::Value;
@@ -600,8 +614,12 @@ void CreateObject(const FunctionCallbackInfo& args) {
Local context = isolate->GetCurrentContext();
Local obj = Object::New(isolate);
- obj->Set(String::NewFromUtf8(isolate, "msg"),
- args[0]->ToString(context).ToLocalChecked());
+ obj->Set(context,
+ String::NewFromUtf8(isolate,
+ "msg",
+ NewStringType::kNormal).ToLocalChecked(),
+ args[0]->ToString(context).ToLocalChecked())
+ .FromJust();
args.GetReturnValue().Set(obj);
}
@@ -644,13 +662,15 @@ using v8::FunctionCallbackInfo;
using v8::FunctionTemplate;
using v8::Isolate;
using v8::Local;
+using v8::NewStringType;
using v8::Object;
using v8::String;
using v8::Value;
void MyFunction(const FunctionCallbackInfo& args) {
Isolate* isolate = args.GetIsolate();
- args.GetReturnValue().Set(String::NewFromUtf8(isolate, "hello world"));
+ args.GetReturnValue().Set(String::NewFromUtf8(
+ isolate, "hello world", NewStringType::kNormal).ToLocalChecked());
}
void CreateFunction(const FunctionCallbackInfo& args) {
@@ -661,7 +681,8 @@ void CreateFunction(const FunctionCallbackInfo& args) {
Local fn = tpl->GetFunction(context).ToLocalChecked();
// omit this to make it anonymous
- fn->SetName(String::NewFromUtf8(isolate, "theFunction"));
+ fn->SetName(String::NewFromUtf8(
+ isolate, "theFunction", NewStringType::kNormal).ToLocalChecked());
args.GetReturnValue().Set(fn);
}
@@ -757,6 +778,7 @@ using v8::FunctionCallbackInfo;
using v8::FunctionTemplate;
using v8::Isolate;
using v8::Local;
+using v8::NewStringType;
using v8::Number;
using v8::Object;
using v8::Persistent;
@@ -776,7 +798,8 @@ void MyObject::Init(Local exports) {
// Prepare constructor template
Local tpl = FunctionTemplate::New(isolate, New);
- tpl->SetClassName(String::NewFromUtf8(isolate, "MyObject"));
+ tpl->SetClassName(String::NewFromUtf8(
+ isolate, "MyObject", NewStringType::kNormal).ToLocalChecked());
tpl->InstanceTemplate()->SetInternalFieldCount(1);
// Prototype
@@ -784,8 +807,9 @@ void MyObject::Init(Local exports) {
Local context = isolate->GetCurrentContext();
constructor.Reset(isolate, tpl->GetFunction(context).ToLocalChecked());
- exports->Set(String::NewFromUtf8(isolate, "MyObject"),
- tpl->GetFunction(context).ToLocalChecked());
+ exports->Set(context, String::NewFromUtf8(
+ isolate, "MyObject", NewStringType::kNormal).ToLocalChecked(),
+ tpl->GetFunction(context).ToLocalChecked()).FromJust();
}
void MyObject::New(const FunctionCallbackInfo& args) {
@@ -952,6 +976,7 @@ using v8::FunctionCallbackInfo;
using v8::FunctionTemplate;
using v8::Isolate;
using v8::Local;
+using v8::NewStringType;
using v8::Number;
using v8::Object;
using v8::Persistent;
@@ -969,7 +994,8 @@ MyObject::~MyObject() {
void MyObject::Init(Isolate* isolate) {
// Prepare constructor template
Local tpl = FunctionTemplate::New(isolate, New);
- tpl->SetClassName(String::NewFromUtf8(isolate, "MyObject"));
+ tpl->SetClassName(String::NewFromUtf8(
+ isolate, "MyObject", NewStringType::kNormal).ToLocalChecked());
tpl->InstanceTemplate()->SetInternalFieldCount(1);
// Prototype
@@ -1167,6 +1193,7 @@ using v8::FunctionCallbackInfo;
using v8::FunctionTemplate;
using v8::Isolate;
using v8::Local;
+using v8::NewStringType;
using v8::Object;
using v8::Persistent;
using v8::String;
@@ -1183,7 +1210,8 @@ MyObject::~MyObject() {
void MyObject::Init(Isolate* isolate) {
// Prepare constructor template
Local tpl = FunctionTemplate::New(isolate, New);
- tpl->SetClassName(String::NewFromUtf8(isolate, "MyObject"));
+ tpl->SetClassName(String::NewFromUtf8(
+ isolate, "MyObject", NewStringType::kNormal).ToLocalChecked());
tpl->InstanceTemplate()->SetInternalFieldCount(1);
Local context = isolate->GetCurrentContext();
diff --git a/doc/api/async_hooks.md b/doc/api/async_hooks.md
index ff3e14b96c250e..1529e33e474084 100644
--- a/doc/api/async_hooks.md
+++ b/doc/api/async_hooks.md
@@ -63,7 +63,7 @@ function init(asyncId, type, triggerAsyncId, resource) { }
// before is called just before the resource's callback is called. It can be
// called 0-N times for handles (e.g. TCPWrap), and will be called exactly 1
-// time for requests (e.g. FSReqWrap).
+// time for requests (e.g. FSReqCallback).
function before(asyncId) { }
// after is called just after the resource's callback has finished.
@@ -236,9 +236,9 @@ The `type` is a string identifying the type of resource that caused
resource's constructor.
```text
-FSEVENTWRAP, FSREQWRAP, GETADDRINFOREQWRAP, GETNAMEINFOREQWRAP, HTTPPARSER,
+FSEVENTWRAP, FSREQCALLBACK, GETADDRINFOREQWRAP, GETNAMEINFOREQWRAP, HTTPPARSER,
JSSTREAM, PIPECONNECTWRAP, PIPEWRAP, PROCESSWRAP, QUERYWRAP, SHUTDOWNWRAP,
-SIGNALWRAP, STATWATCHER, TCPCONNECTWRAP, TCPSERVER, TCPWRAP, TTYWRAP,
+SIGNALWRAP, STATWATCHER, TCPCONNECTWRAP, TCPSERVERWRAP, TCPWRAP, TTYWRAP,
UDPSENDWRAP, UDPWRAP, WRITEWRAP, ZLIB, SSLCONNECTION, PBKDF2REQUEST,
RANDOMBYTESREQUEST, TLSWRAP, Microtask, Timeout, Immediate, TickObject
```
@@ -276,8 +276,8 @@ require('net').createServer((conn) => {}).listen(8080);
Output when hitting the server with `nc localhost 8080`:
```console
-TCPSERVERWRAP(2): trigger: 1 execution: 1
-TCPWRAP(4): trigger: 2 execution: 0
+TCPSERVERWRAP(5): trigger: 1 execution: 1
+TCPWRAP(7): trigger: 5 execution: 0
```
The `TCPSERVERWRAP` is the server which receives the connections.
@@ -296,7 +296,7 @@ of propagating what resource is responsible for the new resource's existence.
been initialized. This can contain useful information that can vary based on
the value of `type`. For instance, for the `GETADDRINFOREQWRAP` resource type,
`resource` provides the hostname used when looking up the IP address for the
-hostname in `net.Server.listen()`. The API for accessing this information is
+host in `net.Server.listen()`. The API for accessing this information is
currently not considered public, but using the Embedder API, users can provide
and document their own resource objects. For example, such a resource object
could contain the SQL query being executed.
@@ -355,27 +355,18 @@ require('net').createServer(() => {}).listen(8080, () => {
Output from only starting the server:
```console
-TCPSERVERWRAP(2): trigger: 1 execution: 1
-TickObject(3): trigger: 2 execution: 1
-before: 3
- Timeout(4): trigger: 3 execution: 3
- TIMERWRAP(5): trigger: 3 execution: 3
-after: 3
-destroy: 3
-before: 5
- before: 4
- TTYWRAP(6): trigger: 4 execution: 4
- SIGNALWRAP(7): trigger: 4 execution: 4
- TTYWRAP(8): trigger: 4 execution: 4
->>> 4
- TickObject(9): trigger: 4 execution: 4
- after: 4
-after: 5
-before: 9
-after: 9
-destroy: 4
-destroy: 9
-destroy: 5
+TCPSERVERWRAP(5): trigger: 1 execution: 1
+TickObject(6): trigger: 5 execution: 1
+before: 6
+ Timeout(7): trigger: 6 execution: 6
+after: 6
+destroy: 6
+before: 7
+>>> 7
+ TickObject(8): trigger: 7 execution: 7
+after: 7
+before: 8
+after: 8
```
As illustrated in the example, `executionAsyncId()` and `execution` each specify
@@ -385,7 +376,7 @@ the value of the current execution context; which is delineated by calls to
Only using `execution` to graph resource allocation results in the following:
```console
-TTYWRAP(6) -> Timeout(4) -> TIMERWRAP(5) -> TickObject(3) -> root(1)
+Timeout(7) -> TickObject(6) -> root(1)
```
The `TCPSERVERWRAP` is not part of this graph, even though it was the reason for
@@ -704,6 +695,8 @@ alternative.
#### asyncResource.emitDestroy()
+* Returns: {AsyncResource} A reference to `asyncResource`.
+
Call all `destroy` hooks. This should only ever be called once. An error will
be thrown if it is called more than once. This **must** be manually called. If
the resource is left to be collected by the GC then the `destroy` hooks will
diff --git a/doc/api/child_process.md b/doc/api/child_process.md
index b2a6e443f964e0..7ba83b3528f8ef 100644
--- a/doc/api/child_process.md
+++ b/doc/api/child_process.md
@@ -131,9 +131,6 @@ exec('"my script.cmd" a b', (err, stdout, stderr) => {
* `spkac` {string | Buffer | TypedArray | DataView}
-* `encoding` {string}
+* `encoding` {string} The [encoding][] of the `spkac` string.
* Returns: {Buffer} The public key component of the `spkac` data structure,
which includes a public key and a challenge.
@@ -231,9 +231,9 @@ console.log(encrypted);
-* `outputEncoding` {string}
+* `outputEncoding` {string} The [encoding][] of the return value.
* Returns: {Buffer | string} Any remaining enciphered contents.
- If `outputEncoding` is one of `'latin1'`, `'base64'` or `'hex'`, a string is
+ If `outputEncoding` is specified, a string is
returned. If an `outputEncoding` is not provided, a [`Buffer`][] is returned.
Once the `cipher.final()` method has been called, the `Cipher` object can no
@@ -299,19 +299,19 @@ changes:
description: The default `inputEncoding` changed from `binary` to `utf8`.
-->
* `data` {string | Buffer | TypedArray | DataView}
-* `inputEncoding` {string}
-* `outputEncoding` {string}
+* `inputEncoding` {string} The [encoding][] of the data.
+* `outputEncoding` {string} The [encoding][] of the return value.
* Returns: {Buffer | string}
Updates the cipher with `data`. If the `inputEncoding` argument is given,
-its value must be one of `'utf8'`, `'ascii'`, or `'latin1'` and the `data`
+the `data`
argument is a string using the specified encoding. If the `inputEncoding`
argument is not given, `data` must be a [`Buffer`][], `TypedArray`, or
`DataView`. If `data` is a [`Buffer`][], `TypedArray`, or `DataView`, then
`inputEncoding` is ignored.
The `outputEncoding` specifies the output format of the enciphered
-data, and can be `'latin1'`, `'base64'` or `'hex'`. If the `outputEncoding`
+data. If the `outputEncoding`
is specified, a string using the specified encoding is returned. If no
`outputEncoding` is provided, a [`Buffer`][] is returned.
@@ -390,9 +390,9 @@ console.log(decrypted);
-* `outputEncoding` {string}
+* `outputEncoding` {string} The [encoding][] of the return value.
* Returns: {Buffer | string} Any remaining deciphered contents.
- If `outputEncoding` is one of `'latin1'`, `'ascii'` or `'utf8'`, a string is
+ If `outputEncoding` is specified, a string is
returned. If an `outputEncoding` is not provided, a [`Buffer`][] is returned.
Once the `decipher.final()` method has been called, the `Decipher` object can
@@ -473,18 +473,18 @@ changes:
description: The default `inputEncoding` changed from `binary` to `utf8`.
-->
* `data` {string | Buffer | TypedArray | DataView}
-* `inputEncoding` {string}
-* `outputEncoding` {string}
+* `inputEncoding` {string} The [encoding][] of the `data` string.
+* `outputEncoding` {string} The [encoding][] of the return value.
* Returns: {Buffer | string}
Updates the decipher with `data`. If the `inputEncoding` argument is given,
-its value must be one of `'latin1'`, `'base64'`, or `'hex'` and the `data`
+the `data`
argument is a string using the specified encoding. If the `inputEncoding`
argument is not given, `data` must be a [`Buffer`][]. If `data` is a
[`Buffer`][] then `inputEncoding` is ignored.
The `outputEncoding` specifies the output format of the enciphered
-data, and can be `'latin1'`, `'ascii'` or `'utf8'`. If the `outputEncoding`
+data. If the `outputEncoding`
is specified, a string using the specified encoding is returned. If no
`outputEncoding` is provided, a [`Buffer`][] is returned.
@@ -528,15 +528,15 @@ assert.strictEqual(aliceSecret.toString('hex'), bobSecret.toString('hex'));
added: v0.5.0
-->
* `otherPublicKey` {string | Buffer | TypedArray | DataView}
-* `inputEncoding` {string}
-* `outputEncoding` {string}
+* `inputEncoding` {string} The [encoding][] of an `otherPublicKey` string.
+* `outputEncoding` {string} The [encoding][] of the return value.
* Returns: {Buffer | string}
Computes the shared secret using `otherPublicKey` as the other
party's public key and returns the computed shared secret. The supplied
key is interpreted using the specified `inputEncoding`, and secret is
-encoded using specified `outputEncoding`. Encodings can be
-`'latin1'`, `'hex'`, or `'base64'`. If the `inputEncoding` is not
+encoded using specified `outputEncoding`.
+If the `inputEncoding` is not
provided, `otherPublicKey` is expected to be a [`Buffer`][],
`TypedArray`, or `DataView`.
@@ -547,57 +547,57 @@ If `outputEncoding` is given a string is returned; otherwise, a
-* `encoding` {string}
+* `encoding` {string} The [encoding][] of the return value.
* Returns: {Buffer | string}
Generates private and public Diffie-Hellman key values, and returns
the public key in the specified `encoding`. This key should be
-transferred to the other party. Encoding can be `'latin1'`, `'hex'`,
-or `'base64'`. If `encoding` is provided a string is returned; otherwise a
+transferred to the other party.
+If `encoding` is provided a string is returned; otherwise a
[`Buffer`][] is returned.
### diffieHellman.getGenerator([encoding])
-* `encoding` {string}
+* `encoding` {string} The [encoding][] of the return value.
* Returns: {Buffer | string}
-Returns the Diffie-Hellman generator in the specified `encoding`, which can
-be `'latin1'`, `'hex'`, or `'base64'`. If `encoding` is provided a string is
+Returns the Diffie-Hellman generator in the specified `encoding`.
+If `encoding` is provided a string is
returned; otherwise a [`Buffer`][] is returned.
### diffieHellman.getPrime([encoding])
-* `encoding` {string}
+* `encoding` {string} The [encoding][] of the return value.
* Returns: {Buffer | string}
-Returns the Diffie-Hellman prime in the specified `encoding`, which can
-be `'latin1'`, `'hex'`, or `'base64'`. If `encoding` is provided a string is
+Returns the Diffie-Hellman prime in the specified `encoding`.
+If `encoding` is provided a string is
returned; otherwise a [`Buffer`][] is returned.
### diffieHellman.getPrivateKey([encoding])
-* `encoding` {string}
+* `encoding` {string} The [encoding][] of the return value.
* Returns: {Buffer | string}
-Returns the Diffie-Hellman private key in the specified `encoding`,
-which can be `'latin1'`, `'hex'`, or `'base64'`. If `encoding` is provided a
+Returns the Diffie-Hellman private key in the specified `encoding`.
+If `encoding` is provided a
string is returned; otherwise a [`Buffer`][] is returned.
### diffieHellman.getPublicKey([encoding])
-* `encoding` {string}
+* `encoding` {string} The [encoding][] of the return value.
* Returns: {Buffer | string}
-Returns the Diffie-Hellman public key in the specified `encoding`, which
-can be `'latin1'`, `'hex'`, or `'base64'`. If `encoding` is provided a
+Returns the Diffie-Hellman public key in the specified `encoding`.
+If `encoding` is provided a
string is returned; otherwise a [`Buffer`][] is returned.
### diffieHellman.setPrivateKey(privateKey[, encoding])
@@ -605,10 +605,10 @@ string is returned; otherwise a [`Buffer`][] is returned.
added: v0.5.0
-->
* `privateKey` {string | Buffer | TypedArray | DataView}
-* `encoding` {string}
+* `encoding` {string} The [encoding][] of the `privateKey` string.
-Sets the Diffie-Hellman private key. If the `encoding` argument is provided
-and is either `'latin1'`, `'hex'`, or `'base64'`, `privateKey` is expected
+Sets the Diffie-Hellman private key. If the `encoding` argument is provided,
+`privateKey` is expected
to be a string. If no `encoding` is provided, `privateKey` is expected
to be a [`Buffer`][], `TypedArray`, or `DataView`.
@@ -617,10 +617,10 @@ to be a [`Buffer`][], `TypedArray`, or `DataView`.
added: v0.5.0
-->
* `publicKey` {string | Buffer | TypedArray | DataView}
-* `encoding` {string}
+* `encoding` {string} The [encoding][] of the `publicKey` string.
-Sets the Diffie-Hellman public key. If the `encoding` argument is provided
-and is either `'latin1'`, `'hex'` or `'base64'`, `publicKey` is expected
+Sets the Diffie-Hellman public key. If the `encoding` argument is provided,
+`publicKey` is expected
to be a string. If no `encoding` is provided, `publicKey` is expected
to be a [`Buffer`][], `TypedArray`, or `DataView`.
@@ -678,8 +678,8 @@ added: v10.0.0
* `key` {string | Buffer | TypedArray | DataView}
* `curve` {string}
-* `inputEncoding` {string}
-* `outputEncoding` {string}
+* `inputEncoding` {string} The [encoding][] of the `key` string.
+* `outputEncoding` {string} The [encoding][] of the return value.
* `format` {string} **Default:** `'uncompressed'`
* Returns: {Buffer | string}
@@ -687,8 +687,7 @@ Converts the EC Diffie-Hellman public key specified by `key` and `curve` to the
format specified by `format`. The `format` argument specifies point encoding
and can be `'compressed'`, `'uncompressed'` or `'hybrid'`. The supplied key is
interpreted using the specified `inputEncoding`, and the returned key is encoded
-using the specified `outputEncoding`. Encodings can be `'latin1'`, `'hex'`,
-or `'base64'`.
+using the specified `outputEncoding`.
Use [`crypto.getCurves()`][] to obtain a list of available curve names.
On recent OpenSSL releases, `openssl ecparam -list_curves` will also display
@@ -733,15 +732,15 @@ changes:
error
-->
* `otherPublicKey` {string | Buffer | TypedArray | DataView}
-* `inputEncoding` {string}
-* `outputEncoding` {string}
+* `inputEncoding` {string} The [encoding][] of the `otherPublicKey` string.
+* `outputEncoding` {string} The [encoding][] of the return value.
* Returns: {Buffer | string}
Computes the shared secret using `otherPublicKey` as the other
party's public key and returns the computed shared secret. The supplied
key is interpreted using specified `inputEncoding`, and the returned secret
-is encoded using the specified `outputEncoding`. Encodings can be
-`'latin1'`, `'hex'`, or `'base64'`. If the `inputEncoding` is not
+is encoded using the specified `outputEncoding`.
+If the `inputEncoding` is not
provided, `otherPublicKey` is expected to be a [`Buffer`][], `TypedArray`, or
`DataView`.
@@ -758,7 +757,7 @@ its recommended for developers to handle this exception accordingly.
-* `encoding` {string}
+* `encoding` {string} The [encoding][] of the return value.
* `format` {string} **Default:** `'uncompressed'`
* Returns: {Buffer | string}
@@ -770,24 +769,24 @@ The `format` argument specifies point encoding and can be `'compressed'` or
`'uncompressed'`. If `format` is not specified, the point will be returned in
`'uncompressed'` format.
-The `encoding` argument can be `'latin1'`, `'hex'`, or `'base64'`. If
-`encoding` is provided a string is returned; otherwise a [`Buffer`][]
+If `encoding` is provided a string is returned; otherwise a [`Buffer`][]
is returned.
### ecdh.getPrivateKey([encoding])
-* `encoding` {string}
-* Returns: {Buffer | string} The EC Diffie-Hellman private key in the specified
- `encoding`, which can be `'latin1'`, `'hex'`, or `'base64'`. If `encoding`
- is provided a string is returned; otherwise a [`Buffer`][] is returned.
+* `encoding` {string} The [encoding][] of the return value.
+* Returns: {Buffer | string} The EC Diffie-Hellman in the specified `encoding`.
+
+If `encoding` is specified, a string is returned; otherwise a [`Buffer`][] is
+returned.
### ecdh.getPublicKey([encoding][, format])
-* `encoding` {string}
+* `encoding` {string} The [encoding][] of the return value.
* `format` {string} **Default:** `'uncompressed'`
* Returns: {Buffer | string} The EC Diffie-Hellman public key in the specified
`encoding` and `format`.
@@ -796,8 +795,7 @@ The `format` argument specifies point encoding and can be `'compressed'` or
`'uncompressed'`. If `format` is not specified the point will be returned in
`'uncompressed'` format.
-The `encoding` argument can be `'latin1'`, `'hex'`, or `'base64'`. If
-`encoding` is specified, a string is returned; otherwise a [`Buffer`][] is
+If `encoding` is specified, a string is returned; otherwise a [`Buffer`][] is
returned.
### ecdh.setPrivateKey(privateKey[, encoding])
@@ -805,10 +803,10 @@ returned.
added: v0.11.14
-->
* `privateKey` {string | Buffer | TypedArray | DataView}
-* `encoding` {string}
+* `encoding` {string} The [encoding][] of the `privateKey` string.
-Sets the EC Diffie-Hellman private key. The `encoding` can be `'latin1'`,
-`'hex'` or `'base64'`. If `encoding` is provided, `privateKey` is expected
+Sets the EC Diffie-Hellman private key.
+If `encoding` is provided, `privateKey` is expected
to be a string; otherwise `privateKey` is expected to be a [`Buffer`][],
`TypedArray`, or `DataView`.
@@ -825,10 +823,10 @@ deprecated: v5.2.0
> Stability: 0 - Deprecated
* `publicKey` {string | Buffer | TypedArray | DataView}
-* `encoding` {string}
+* `encoding` {string} The [encoding][] of the `publicKey` string.
-Sets the EC Diffie-Hellman public key. Key encoding can be `'latin1'`,
-`'hex'` or `'base64'`. If `encoding` is provided `publicKey` is expected to
+Sets the EC Diffie-Hellman public key.
+If `encoding` is provided `publicKey` is expected to
be a string; otherwise a [`Buffer`][], `TypedArray`, or `DataView` is expected.
Note that there is not normally a reason to call this method because `ECDH`
@@ -925,12 +923,12 @@ console.log(hash.digest('hex'));
-* `encoding` {string}
+* `encoding` {string} The [encoding][] of the return value.
* Returns: {Buffer | string}
Calculates the digest of all of the data passed to be hashed (using the
-[`hash.update()`][] method). The `encoding` can be `'hex'`, `'latin1'` or
-`'base64'`. If `encoding` is provided a string will be returned; otherwise
+[`hash.update()`][] method).
+If `encoding` is provided a string will be returned; otherwise
a [`Buffer`][] is returned.
The `Hash` object can not be used again after `hash.digest()` method has been
@@ -945,11 +943,11 @@ changes:
description: The default `inputEncoding` changed from `binary` to `utf8`.
-->
* `data` {string | Buffer | TypedArray | DataView}
-* `inputEncoding` {string}
+* `inputEncoding` {string} The [encoding][] of the `data` string.
Updates the hash content with the given `data`, the encoding of which
-is given in `inputEncoding` and can be `'utf8'`, `'ascii'` or
-`'latin1'`. If `encoding` is not provided, and the `data` is a string, an
+is given in `inputEncoding`.
+If `encoding` is not provided, and the `data` is a string, an
encoding of `'utf8'` is enforced. If `data` is a [`Buffer`][], `TypedArray`, or
`DataView`, then `inputEncoding` is ignored.
@@ -1017,11 +1015,11 @@ console.log(hmac.digest('hex'));
-* `encoding` {string}
+* `encoding` {string} The [encoding][] of the return value.
* Returns: {Buffer | string}
Calculates the HMAC digest of all of the data passed using [`hmac.update()`][].
-The `encoding` can be `'hex'`, `'latin1'` or `'base64'`. If `encoding` is
+If `encoding` is
provided a string is returned; otherwise a [`Buffer`][] is returned;
The `Hmac` object can not be used again after `hmac.digest()` has been
@@ -1036,11 +1034,11 @@ changes:
description: The default `inputEncoding` changed from `binary` to `utf8`.
-->
* `data` {string | Buffer | TypedArray | DataView}
-* `inputEncoding` {string}
+* `inputEncoding` {string} The [encoding][] of the `data` string.
Updates the `Hmac` content with the given `data`, the encoding of which
-is given in `inputEncoding` and can be `'utf8'`, `'ascii'` or
-`'latin1'`. If `encoding` is not provided, and the `data` is a string, an
+is given in `inputEncoding`.
+If `encoding` is not provided, and the `data` is a string, an
encoding of `'utf8'` is enforced. If `data` is a [`Buffer`][], `TypedArray`, or
`DataView`, then `inputEncoding` is ignored.
@@ -1110,7 +1108,7 @@ console.log(sign.sign(privateKey, 'hex'));
// Prints: the calculated signature
```
-### sign.sign(privateKey[, outputFormat])
+### sign.sign(privateKey[, outputEncoding])
* `data` {string | Buffer | TypedArray | DataView}
-* `inputEncoding` {string}
+* `inputEncoding` {string} The [encoding][] of the `data` string.
Updates the `Sign` content with the given `data`, the encoding of which
-is given in `inputEncoding` and can be `'utf8'`, `'ascii'` or
-`'latin1'`. If `encoding` is not provided, and the `data` is a string, an
+is given in `inputEncoding`.
+If `encoding` is not provided, and the `data` is a string, an
encoding of `'utf8'` is enforced. If `data` is a [`Buffer`][], `TypedArray`, or
`DataView`, then `inputEncoding` is ignored.
@@ -1227,17 +1224,17 @@ changes:
description: The default `inputEncoding` changed from `binary` to `utf8`.
-->
* `data` {string | Buffer | TypedArray | DataView}
-* `inputEncoding` {string}
+* `inputEncoding` {string} The [encoding][] of the `data` string.
Updates the `Verify` content with the given `data`, the encoding of which
-is given in `inputEncoding` and can be `'utf8'`, `'ascii'` or
-`'latin1'`. If `encoding` is not provided, and the `data` is a string, an
+is given in `inputEncoding`.
+If `inputEncoding` is not provided, and the `data` is a string, an
encoding of `'utf8'` is enforced. If `data` is a [`Buffer`][], `TypedArray`, or
`DataView`, then `inputEncoding` is ignored.
This can be called many times with new data as it is streamed.
-### verify.verify(object, signature[, signatureFormat])
+### verify.verify(object, signature[, signatureEncoding])
* `object` {string | Object}
* `signature` {string | Buffer | TypedArray | DataView}
-* `signatureFormat` {string}
+* `signatureEncoding` {string} The [encoding][] of the `signature` string.
* Returns: {boolean} `true` or `false` depending on the validity of the
signature for the data and public key.
@@ -1270,8 +1267,8 @@ or an object with one or more of the following properties:
determined automatically.
The `signature` argument is the previously calculated signature for the data, in
-the `signatureFormat` which can be `'latin1'`, `'hex'` or `'base64'`.
-If a `signatureFormat` is specified, the `signature` is expected to be a
+the `signatureEncoding`.
+If a `signatureEncoding` is specified, the `signature` is expected to be a
string; otherwise `signature` is expected to be a [`Buffer`][],
`TypedArray`, or `DataView`.
@@ -1382,6 +1379,9 @@ Adversaries][] for details.
* `prime` {string | Buffer | TypedArray | DataView}
-* `primeEncoding` {string}
+* `primeEncoding` {string} The [encoding][] of the `prime` string.
* `generator` {number | string | Buffer | TypedArray | DataView} **Default:**
`2`
-* `generatorEncoding` {string}
+* `generatorEncoding` {string} The [encoding][] of the `generator` string.
+* Returns: {DiffieHellman}
Creates a `DiffieHellman` key exchange object using the supplied `prime` and an
optional specific `generator`.
@@ -1540,9 +1544,6 @@ optional specific `generator`.
The `generator` argument can be a number, string, or [`Buffer`][]. If
`generator` is not specified, the value `2` is used.
-The `primeEncoding` and `generatorEncoding` arguments can be `'latin1'`,
-`'hex'`, or `'base64'`.
-
If `primeEncoding` is specified, `prime` is expected to be a string; otherwise
a [`Buffer`][], `TypedArray`, or `DataView` is expected.
@@ -1556,6 +1557,7 @@ added: v0.5.0
* `primeLength` {number}
* `generator` {number | string | Buffer | TypedArray | DataView} **Default:**
`2`
+* Returns: {DiffieHellman}
Creates a `DiffieHellman` key exchange object and generates a prime of
`primeLength` bits using an optional specific numeric `generator`.
@@ -1566,6 +1568,7 @@ If `generator` is not specified, the value `2` is used.
added: v0.11.14
-->
* `curveName` {string}
+* Returns: {ECDH}
Creates an Elliptic Curve Diffie-Hellman (`ECDH`) key exchange object using a
predefined curve specified by the `curveName` string. Use
@@ -1818,7 +1821,7 @@ console.log(curves); // ['Oakley-EC2N-3', 'Oakley-EC2N-4', ...]
added: v0.7.5
-->
* `groupName` {string}
-* Returns: {Object}
+* Returns: {DiffieHellman}
Creates a predefined `DiffieHellman` key exchange object. The
supported groups are: `'modp1'`, `'modp2'`, `'modp5'` (defined in
@@ -2885,13 +2888,13 @@ the `crypto`, `tls`, and `https` modules and are generally specific to OpenSSL.
[`hash.update()`]: #crypto_hash_update_data_inputencoding
[`hmac.digest()`]: #crypto_hmac_digest_encoding
[`hmac.update()`]: #crypto_hmac_update_data_inputencoding
-[`sign.sign()`]: #crypto_sign_sign_privatekey_outputformat
+[`sign.sign()`]: #crypto_sign_sign_privatekey_outputencoding
[`sign.update()`]: #crypto_sign_update_data_inputencoding
[`stream.transform` options]: stream.html#stream_new_stream_transform_options
[`stream.Writable` options]: stream.html#stream_constructor_new_stream_writable_options
[`util.promisify()`]: util.html#util_util_promisify_original
[`verify.update()`]: #crypto_verify_update_data_inputencoding
-[`verify.verify()`]: #crypto_verify_verify_object_signature_signatureformat
+[`verify.verify()`]: #crypto_verify_verify_object_signature_signatureencoding
[AEAD algorithms]: https://en.wikipedia.org/wiki/Authenticated_encryption
[Caveats]: #crypto_support_for_weak_or_compromised_algorithms
[CCM mode]: #crypto_ccm_mode
@@ -2907,6 +2910,7 @@ the `crypto`, `tls`, and `https` modules and are generally specific to OpenSSL.
[RFC 3526]: https://www.rfc-editor.org/rfc/rfc3526.txt
[RFC 3610]: https://www.rfc-editor.org/rfc/rfc3610.txt
[RFC 4055]: https://www.rfc-editor.org/rfc/rfc4055.txt
+[encoding]: buffer.html#buffer_buffers_and_character_encodings
[initialization vector]: https://en.wikipedia.org/wiki/Initialization_vector
[scrypt]: https://en.wikipedia.org/wiki/Scrypt
[stream-writable-write]: stream.html#stream_writable_write_chunk_encoding_callback
diff --git a/doc/api/errors.md b/doc/api/errors.md
index bdabc48a7ddd72..500fb7801b61fd 100644
--- a/doc/api/errors.md
+++ b/doc/api/errors.md
@@ -260,7 +260,10 @@ not capture any frames.
* {string}
The `error.code` property is a string label that identifies the kind of error.
-See [Node.js Error Codes][] for details about specific codes.
+`error.code` is the most stable way to identify an error. It will only change
+between major versions of Node.js. In contrast, `error.message` strings may
+change between any versions of Node.js. See [Node.js Error Codes][] for details
+about specific codes.
### error.message
@@ -441,86 +444,94 @@ checks or `abort()` calls in the C++ layer.
## System Errors
-System errors are generated when exceptions occur within the Node.js
-runtime environment. Typically, these are operational errors that occur
-when an application violates an operating system constraint such as attempting
-to read a file that does not exist or when the user does not have sufficient
-permissions.
+Node.js generates system errors when exceptions occur within its runtime
+environment. These usually occur when an application violates an operating
+system constraint. For example, a system error will occur if an application
+attempts to read a file that does not exist.
-System errors are typically generated at the syscall level: an exhaustive list
-of error codes and their meanings is available by running `man 2 intro` or
-`man 3 errno` on most Unices; or [online][].
+System errors are usually generated at the syscall level. For a comprehensive
+list, see the [`errno`(3) man page][].
-In Node.js, system errors are represented as augmented `Error` objects with
-added properties.
+In Node.js, system errors are `Error` objects with extra properties.
### Class: SystemError
-#### error.info
+* `address` {string} If present, the address to which a network connection
+ failed
+* `code` {string} The string error code
+* `dest` {string} If present, the file path destination when reporting a file
+ system error
+* `errno` {number|string} The system-provided error number
+* `info` {Object} If present, extra details about the error condition
+* `message` {string} A system-provided human-readable description of the error
+* `path` {string} If present, the file path when reporting a file system error
+* `port` {number} If present, the network connection port that is not available
+* `syscall` {string} The name of the system call that triggered the error
-`SystemError` instances may have an additional `info` property whose
-value is an object with additional details about the error conditions.
+#### error.address
-The following properties are provided:
+* {string}
-* `code` {string} The string error code
-* `errno` {number} The system-provided error number
-* `message` {string} A system-provided human readable description of the error
-* `syscall` {string} The name of the system call that triggered the error
-* `path` {Buffer} When reporting a file system error, the `path` will identify
- the file path.
-* `dest` {Buffer} When reporting a file system error, the `dest` will identify
- the file path destination (if any).
+If present, `error.address` is a string describing the address to which a
+network connection failed.
#### error.code
* {string}
-The `error.code` property is a string representing the error code, which is
-typically `E` followed by a sequence of capital letters.
+The `error.code` property is a string representing the error code.
+
+#### error.dest
+
+* {string}
+
+If present, `error.dest` is the file path destination when reporting a file
+system error.
#### error.errno
* {string|number}
-The `error.errno` property is a number or a string.
-The number is a **negative** value which corresponds to the error code defined
-in [`libuv Error handling`]. See `uv-errno.h` header file
-(`deps/uv/include/uv-errno.h` in the Node.js source tree) for details. In case
+The `error.errno` property is a number or a string. If it is a number, it is a
+negative value which corresponds to the error code defined in
+[`libuv Error handling`]. See the libuv `errno.h` header file
+(`deps/uv/include/uv/errno.h` in the Node.js source tree) for details. In case
of a string, it is the same as `error.code`.
-#### error.syscall
+#### error.info
-* {string}
+* {Object}
-The `error.syscall` property is a string describing the [syscall][] that failed.
+If present, `error.info` is an object with details about the error condition.
-#### error.path
+#### error.message
* {string}
-When present (e.g. in `fs` or `child_process`), the `error.path` property is a
-string containing a relevant invalid pathname.
+`error.message` is a system-provided human-readable description of the error.
-#### error.address
+#### error.path
* {string}
-When present (e.g. in `net` or `dgram`), the `error.address` property is a
-string describing the address to which the connection failed.
+If present, `error.path` is a string containing a relevant invalid pathname.
#### error.port
* {number}
-When present (e.g. in `net` or `dgram`), the `error.port` property is a number
-representing the connection's port that is not available.
+If present, `error.port` is the network connection port that is not available.
+
+#### error.syscall
+
+* {string}
+
+The `error.syscall` property is a string describing the [syscall][] that failed.
### Common System Errors
-This list is **not exhaustive**, but enumerates many of the common system
-errors encountered when writing a Node.js program. An exhaustive list may be
-found [here][online].
+This is a list of system errors commonly-encountered when writing a Node.js
+program. For a comprehensive list, see the [`errno`(3) man page][].
- `EACCES` (Permission denied): An attempt was made to access a file in a way
forbidden by its file access permissions.
@@ -613,6 +624,19 @@ An attempt was made to register something that is not a function as an
The type of an asynchronous resource was invalid. Note that users are also able
to define their own types if using the public embedder API.
+
+### ERR_BUFFER_CONTEXT_NOT_AVAILABLE
+
+An attempt was made to create a Node.js `Buffer` instance from addon or embedder
+code, while in a JS engine Context that is not associated with a Node.js
+instance. The data passed to the `Buffer` method will have been released
+by the time the method returns.
+
+When encountering this error, a possible alternative to creating a `Buffer`
+instance is to create a normal `Uint8Array`, which only differs in the
+prototype of the resulting object. `Uint8Array`s are generally accepted in all
+Node.js core APIs where `Buffer`s are; they are available in all Contexts.
+
### ERR_BUFFER_OUT_OF_BOUNDS
@@ -2113,6 +2137,7 @@ such as `process.stdout.on('data')`.
[`crypto.scryptSync()`]: crypto.html#crypto_crypto_scryptsync_password_salt_keylen_options
[`crypto.timingSafeEqual()`]: crypto.html#crypto_crypto_timingsafeequal_a_b
[`dgram.createSocket()`]: dgram.html#dgram_dgram_createsocket_options_callback
+[`errno`(3) man page]: http://man7.org/linux/man-pages/man3/errno.3.html
[`fs.readFileSync`]: fs.html#fs_fs_readfilesync_path_options
[`fs.readdir`]: fs.html#fs_fs_readdir_path_options_callback
[`fs.symlink()`]: fs.html#fs_fs_symlink_target_path_type_callback
@@ -2134,7 +2159,7 @@ such as `process.stdout.on('data')`.
[`require()`]: modules.html#modules_require
[`server.close()`]: net.html#net_server_close_callback
[`server.listen()`]: net.html#net_server_listen
-[`sign.sign()`]: crypto.html#crypto_sign_sign_privatekey_outputformat
+[`sign.sign()`]: crypto.html#crypto_sign_sign_privatekey_outputencoding
[`stream.pipe()`]: stream.html#stream_readable_pipe_destination_options
[`stream.push()`]: stream.html#stream_readable_push_chunk_encoding
[`stream.unshift()`]: stream.html#stream_readable_unshift_chunk
@@ -2152,7 +2177,6 @@ such as `process.stdout.on('data')`.
[domains]: domain.html
[event emitter-based]: events.html#events_class_eventemitter
[file descriptors]: https://en.wikipedia.org/wiki/File_descriptor
-[online]: http://man7.org/linux/man-pages/man3/errno.3.html
[stream-based]: stream.html
[syscall]: http://man7.org/linux/man-pages/man2/syscalls.2.html
[try-catch]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/try...catch
diff --git a/doc/api/fs.md b/doc/api/fs.md
index 9de798c6ff7ca2..ce054230e6dba7 100644
--- a/doc/api/fs.md
+++ b/doc/api/fs.md
@@ -488,6 +488,16 @@ argument to `fs.createReadStream()`. If `path` is passed as a string, then
`readStream.path` will be a string. If `path` is passed as a `Buffer`, then
`readStream.path` will be a `Buffer`.
+### readStream.pending
+
+
+* {boolean}
+
+This property is `true` if the underlying file has not been opened yet,
+i.e. before the `'ready'` event is emitted.
+
## Class: fs.Stats
+
+* {boolean}
+
+This property is `true` if the underlying file has not been opened yet,
+i.e. before the `'ready'` event is emitted.
+
## fs.access(path[, mode], callback)
* `path` {string|Buffer|URL}
* `flags` {string|number} See [support of file system `flags`][].
+ **Default:** `'r'`.
* `mode` {integer} **Default:** `0o666` (readable and writable)
* Returns: {Promise}
diff --git a/doc/api/http.md b/doc/api/http.md
index ff948cd9f5d6a6..1c6b5717e0049c 100644
--- a/doc/api/http.md
+++ b/doc/api/http.md
@@ -368,7 +368,7 @@ proxy.listen(1337, '127.0.0.1', () => {
// make a request to a tunneling proxy
const options = {
port: 1337,
- hostname: '127.0.0.1',
+ host: '127.0.0.1',
method: 'CONNECT',
path: 'www.google.com:80'
};
@@ -415,7 +415,7 @@ event is emitted with a callback containing an object with a status code.
const http = require('http');
const options = {
- hostname: '127.0.0.1',
+ host: '127.0.0.1',
port: 8080,
path: '/length_request'
};
@@ -502,7 +502,7 @@ srv.listen(1337, '127.0.0.1', () => {
// make a request
const options = {
port: 1337,
- hostname: '127.0.0.1',
+ host: '127.0.0.1',
headers: {
'Connection': 'Upgrade',
'Upgrade': 'websocket'
@@ -575,6 +575,17 @@ If `data` is specified, it is equivalent to calling
If `callback` is specified, it will be called when the request stream
is finished.
+### request.finished
+
+
+* {boolean}
+
+The `request.finished` property will be `true` if [`request.end()`][]
+has been called. `request.end()` will automatically be called if the
+request was initiated via [`http.get()`][].
+
### request.flushHeaders()
+* {number}
+
+This property shows the number of characters currently buffered to be written.
+See [`net.Socket.bufferSize`][] for details.
+
#### http2stream.close(code[, callback])
* `callback` {Function}
+* Returns: {https.Server}
See [`server.close()`][`http.close()`] from the HTTP module for details.
@@ -49,6 +50,7 @@ added: v0.11.2
-->
* `msecs` {number} **Default:** `120000` (2 minutes)
* `callback` {Function}
+* Returns: {https.Server}
See [`http.Server#setTimeout()`][].
@@ -75,6 +77,7 @@ added: v0.3.4
* `options` {Object} Accepts `options` from [`tls.createServer()`][],
[`tls.createSecureContext()`][] and [`http.createServer()`][].
* `requestListener` {Function} A listener to be added to the `'request'` event.
+* Returns: {https.Server}
```js
// curl -k https://localhost:8000/
diff --git a/doc/api/inspector.md b/doc/api/inspector.md
index 02aa1ac1416acd..7406e36e73ce7e 100644
--- a/doc/api/inspector.md
+++ b/doc/api/inspector.md
@@ -43,6 +43,9 @@ started.
If wait is `true`, will block until a client has connected to the inspect port
and flow control has been passed to the debugger client.
+See the [security warning](cli.html#inspector_security) regarding the `host`
+parameter usage.
+
## inspector.url()
* Returns: {string|undefined}
diff --git a/doc/api/net.md b/doc/api/net.md
index eb48ab8d00c87f..b925245e7a338b 100644
--- a/doc/api/net.md
+++ b/doc/api/net.md
@@ -167,7 +167,7 @@ The number of concurrent connections on the server.
This becomes `null` when sending a socket to a child with
[`child_process.fork()`][]. To poll forks and get current number of active
-connections use asynchronous [`server.getConnections()`][] instead.
+connections, use asynchronous [`server.getConnections()`][] instead.
### server.getConnections(callback)
-If `true` -
+If `true`,
[`socket.connect(options[, connectListener])`][`socket.connect(options)`]
-was called and haven't yet finished. Will be set to `false` before emitting
+was called and has not yet finished. Will be set to `true` before emitting
`'connect'` event and/or calling
[`socket.connect(options[, connectListener])`][`socket.connect(options)`]'s
callback.
@@ -724,6 +724,17 @@ The numeric representation of the local port. For example, `80` or `21`.
Pauses the reading of data. That is, [`'data'`][] events will not be emitted.
Useful to throttle back an upload.
+### socket.pending
+
+
+* {boolean}
+
+This is `true` if the socket is not connected yet, either because `.connect()`
+has not yet been called or because it is still in the process of connecting
+(see [`socket.connecting`][]).
+
### socket.ref()
* `options` {Object}
* `connectListener` {Function}
+
Alias to
[`net.createConnection(options[, connectListener])`][`net.createConnection(options)`].
@@ -1028,10 +1040,6 @@ then returns the `net.Socket` that starts the connection.
-* `options` {Object}
-* `connectionListener` {Function}
-
-Creates a new TCP or [IPC][] server.
* `options` {Object}
* `allowHalfOpen` {boolean} Indicates whether half-opened TCP
@@ -1042,6 +1050,8 @@ Creates a new TCP or [IPC][] server.
[`'connection'`][] event.
* Returns: {net.Server}
+Creates a new TCP or [IPC][] server.
+
If `allowHalfOpen` is set to `true`, when the other end of the socket
sends a FIN packet, the server will only send a FIN packet back when
[`socket.end()`][] is explicitly called, until then the connection is
@@ -1168,6 +1178,7 @@ Returns `true` if input is a version 6 IP address, otherwise returns `false`.
[`socket.connect(options)`]: #net_socket_connect_options_connectlistener
[`socket.connect(path)`]: #net_socket_connect_path_connectlistener
[`socket.connect(port, host)`]: #net_socket_connect_port_host_connectlistener
+[`socket.connecting`]: #net_socket_connecting
[`socket.destroy()`]: #net_socket_destroy_exception
[`socket.end()`]: #net_socket_end_data_encoding_callback
[`socket.pause()`]: #net_socket_pause
diff --git a/doc/api/path.md b/doc/api/path.md
index a5cd310690e5cc..4cfa4fa8ae37d5 100644
--- a/doc/api/path.md
+++ b/doc/api/path.md
@@ -288,7 +288,7 @@ added: v0.1.16
* Returns: {string}
The `path.join()` method joins all given `path` segments together using the
-platform specific separator as a delimiter, then normalizes the resulting path.
+platform-specific separator as a delimiter, then normalizes the resulting path.
Zero-length `path` segments are ignored. If the joined path string is a
zero-length string then `'.'` will be returned, representing the current
@@ -317,7 +317,7 @@ The `path.normalize()` method normalizes the given `path`, resolving `'..'` and
When multiple, sequential path segment separation characters are found (e.g.
`/` on POSIX and either `\` or `/` on Windows), they are replaced by a single
-instance of the platform specific path segment separator (`/` on POSIX and
+instance of the platform-specific path segment separator (`/` on POSIX and
`\` on Windows). Trailing separators are preserved.
If the `path` is a zero-length string, `'.'` is returned, representing the
@@ -543,7 +543,7 @@ On Windows systems only, returns an equivalent [namespace-prefixed path][] for
the given `path`. If `path` is not a string, `path` will be returned without
modifications.
-This method is meaningful only on Windows system. On posix systems, the
+This method is meaningful only on Windows system. On POSIX systems, the
method is non-operational and always returns `path` without modifications.
## path.win32
diff --git a/doc/api/process.md b/doc/api/process.md
index 3907271bbfa26c..d555e54caeeac9 100644
--- a/doc/api/process.md
+++ b/doc/api/process.md
@@ -429,7 +429,7 @@ process.on('SIGTERM', handle);
removed (Node.js will no longer exit).
* `'SIGPIPE'` is ignored by default. It can have a listener installed.
* `'SIGHUP'` is generated on Windows when the console window is closed, and on
- other platforms under various similar conditions, see signal(7). It can have a
+ other platforms under various similar conditions. See signal(7). It can have a
listener installed, however Node.js will be unconditionally terminated by
Windows about 10 seconds later. On non-Windows platforms, the default
behavior of `SIGHUP` is to terminate Node.js, but once a listener has been
@@ -1382,7 +1382,7 @@ process.kill(process.pid, 'SIGHUP');
```
When `SIGUSR1` is received by a Node.js process, Node.js will start the
-debugger, see [Signal Events][].
+debugger. See [Signal Events][].
## process.mainModule
* `options` {Object}
@@ -1521,6 +1526,8 @@ changes:
[`stream._destroy()`][writable-_destroy] method.
* `final` {Function} Implementation for the
[`stream._final()`][stream-_final] method.
+ * `autoDestroy` {boolean} Whether this stream should automatically call
+ `.destroy()` on itself after ending. **Default:** `false`.
```js
const { Writable } = require('stream');
@@ -1756,6 +1763,14 @@ Custom `Readable` streams *must* call the `new stream.Readable([options])`
constructor and implement the `readable._read()` method.
#### new stream.Readable([options])
+
* `options` {Object}
* `highWaterMark` {number} The maximum [number of bytes][hwm-gotcha] to store
@@ -1770,6 +1785,8 @@ constructor and implement the `readable._read()` method.
method.
* `destroy` {Function} Implementation for the
[`stream._destroy()`][readable-_destroy] method.
+ * `autoDestroy` {boolean} Whether this stream should automatically call
+ `.destroy()` on itself after ending. **Default:** `false`.
```js
const { Readable } = require('stream');
@@ -1875,7 +1892,7 @@ changes:
any JavaScript value.
* `encoding` {string} Encoding of string chunks. Must be a valid
`Buffer` encoding, such as `'utf8'` or `'ascii'`.
-* Returns: {boolean} `true` if additional chunks of data may continued to be
+* Returns: {boolean} `true` if additional chunks of data may continue to be
pushed; `false` otherwise.
When `chunk` is a `Buffer`, `Uint8Array` or `string`, the `chunk` of data will
@@ -2288,7 +2305,7 @@ The `callback` function must be called only when the current chunk is completely
consumed. The first argument passed to the `callback` must be an `Error` object
if an error occurred while processing the input or `null` otherwise. If a second
argument is passed to the `callback`, it will be forwarded on to the
-`readable.push()` method. In other words the following are equivalent:
+`readable.push()` method. In other words, the following are equivalent:
```js
transform.prototype._transform = function(data, encoding, callback) {
@@ -2335,7 +2352,7 @@ less powerful and less useful.
guaranteed. This meant that it was still necessary to be prepared to receive
[`'data'`][] events *even when the stream was in a paused state*.
-In Node.js 0.10, the [`Readable`][] class was added. For backwards
+In Node.js 0.10, the [`Readable`][] class was added. For backward
compatibility with older Node.js programs, `Readable` streams switch into
"flowing mode" when a [`'data'`][] event handler is added, or when the
[`stream.resume()`][stream-resume] method is called. The effect is that, even
diff --git a/doc/api/tls.md b/doc/api/tls.md
index 8700839c400b38..392052986e3208 100644
--- a/doc/api/tls.md
+++ b/doc/api/tls.md
@@ -378,6 +378,7 @@ added: v0.3.2
* `callback` {Function} A listener callback that will be registered to listen
for the server instance's `'close'` event.
+* Returns: {tls.Server}
The `server.close()` method stops the server from accepting new connections.
@@ -565,6 +566,22 @@ added: v0.11.4
Always returns `true`. This may be used to distinguish TLS sockets from regular
`net.Socket` instances.
+### tlsSocket.getCertificate()
+
+
+* Returns: {Object}
+
+Returns an object representing the local certificate. The returned object has
+some properties corresponding to the fields of the certificate.
+
+See [`tls.TLSSocket.getPeerCertificate()`][] for an example of the certificate
+structure.
+
+If there is no local certificate, an empty object will be returned. If the
+socket has been destroyed, `null` will be returned.
+
### tlsSocket.getCipher()
-* `hostname` {string} The hostname to verify the certificate against
+* `hostname` {string} The host name or IP address to verify the certificate
+ against.
* `cert` {Object} An object representing the peer's certificate. The returned
object has some properties corresponding to the fields of the certificate.
* Returns: {Error|undefined}
Verifies the certificate `cert` is issued to `hostname`.
-Returns {Error} object, populating it with the reason, host, and cert on
+Returns {Error} object, populating it with `reason`, `host`, and `cert` on
failure. On success, returns {undefined}.
This function can be overwritten by providing alternative function as part of
@@ -901,11 +920,15 @@ changes:
An array of strings, `Buffer`s or `TypedArray`s or `DataView`s, or a
single `Buffer` or `TypedArray` or `DataView` containing the supported ALPN
protocols. `Buffer`s should have the format `[len][name][len][name]...`
- e.g. `0x05hello0x05world`, where the first byte is the length of the next
- protocol name. Passing an array is usually much simpler, e.g.
- `['hello', 'world']`.
+ e.g. `'\x08http/1.1\x08http/1.0'`, where the `len` byte is the length of the
+ next protocol name. Passing an array is usually much simpler, e.g.
+ `['http/1.1', 'http/1.0']`. Protocols earlier in the list have higher
+ preference than those later.
* `servername`: {string} Server name for the SNI (Server Name Indication) TLS
- extension. It must be a host name, and not an IP address.
+ extension. It is the name of the host being connected to, and must be a host
+ name, and not an IP address. It can be used by a multi-homed server to
+ choose the correct certificate to present to the client, see the
+ `SNICallback` option to [`tls.createServer()`][].
* `checkServerIdentity(servername, cert)` {Function} A callback function
to be used (instead of the builtin `tls.checkServerIdentity()` function)
when checking the server's hostname (or the provided `servername` when
@@ -926,55 +949,31 @@ changes:
* ...: [`tls.createSecureContext()`][] options that are used if the
`secureContext` option is missing, otherwise they are ignored.
* `callback` {Function}
+* Returns: {tls.TLSSocket}
The `callback` function, if specified, will be added as a listener for the
[`'secureConnect'`][] event.
`tls.connect()` returns a [`tls.TLSSocket`][] object.
-Here is an example of a client of echo server as described in
+The following illustrates a client for the echo server example from
[`tls.createServer()`][]:
```js
-// This example assumes that you have created an echo server that is
-// listening on port 8000.
+// Assumes an echo server that is listening on port 8000.
const tls = require('tls');
const fs = require('fs');
const options = {
- // Necessary only if using the client certificate authentication
+ // Necessary only if the server requires client certificate authentication.
key: fs.readFileSync('client-key.pem'),
cert: fs.readFileSync('client-cert.pem'),
- // Necessary only if the server uses the self-signed certificate
- ca: [ fs.readFileSync('server-cert.pem') ]
-};
+ // Necessary only if the server uses a self-signed certificate.
+ ca: [ fs.readFileSync('server-cert.pem') ],
-const socket = tls.connect(8000, options, () => {
- console.log('client connected',
- socket.authorized ? 'authorized' : 'unauthorized');
- process.stdin.pipe(socket);
- process.stdin.resume();
-});
-socket.setEncoding('utf8');
-socket.on('data', (data) => {
- console.log(data);
-});
-socket.on('end', () => {
- console.log('client ends');
-});
-```
-
-Or
-
-```js
-// This example assumes that you have created an echo server that is
-// listening on port 8000.
-const tls = require('tls');
-const fs = require('fs');
-
-const options = {
- pfx: fs.readFileSync('client.pfx')
+ // Necessary only if the server's cert isn't for "localhost".
+ checkServerIdentity: () => { return null; },
};
const socket = tls.connect(8000, options, () => {
@@ -988,7 +987,7 @@ socket.on('data', (data) => {
console.log(data);
});
socket.on('end', () => {
- console.log('client ends');
+ console.log('server ends connection');
});
```
@@ -1000,6 +999,7 @@ added: v0.11.3
* `path` {string} Default value for `options.path`.
* `options` {Object} See [`tls.connect()`][].
* `callback` {Function} See [`tls.connect()`][].
+* Returns: {tls.TLSSocket}
Same as [`tls.connect()`][] except that `path` can be provided
as an argument instead of an option.
@@ -1015,6 +1015,7 @@ added: v0.11.3
* `host` {string} Default value for `options.host`.
* `options` {Object} See [`tls.connect()`][].
* `callback` {Function} See [`tls.connect()`][].
+* Returns: {tls.TLSSocket}
Same as [`tls.connect()`][] except that `port` and `host` can be provided
as arguments instead of options.
@@ -1191,6 +1192,7 @@ changes:
* ...: Any [`tls.createSecureContext()`][] option can be provided. For
servers, the identity options (`pfx` or `key`/`cert`) are usually required.
* `secureConnectionListener` {Function}
+* Returns: {tls.Server}
Creates a new [`tls.Server`][]. The `secureConnectionListener`, if provided, is
automatically set as a listener for the [`'secureConnection'`][] event.
@@ -1208,10 +1210,10 @@ const options = {
key: fs.readFileSync('server-key.pem'),
cert: fs.readFileSync('server-cert.pem'),
- // This is necessary only if using the client certificate authentication.
+ // This is necessary only if using client certificate authentication.
requestCert: true,
- // This is necessary only if the client uses the self-signed certificate.
+ // This is necessary only if the client uses a self-signed certificate.
ca: [ fs.readFileSync('client-cert.pem') ]
};
@@ -1227,36 +1229,8 @@ server.listen(8000, () => {
});
```
-Or
-
-```js
-const tls = require('tls');
-const fs = require('fs');
-
-const options = {
- pfx: fs.readFileSync('server.pfx'),
-
- // This is necessary only if using the client certificate authentication.
- requestCert: true,
-};
-
-const server = tls.createServer(options, (socket) => {
- console.log('server connected',
- socket.authorized ? 'authorized' : 'unauthorized');
- socket.write('welcome!\n');
- socket.setEncoding('utf8');
- socket.pipe(socket);
-});
-server.listen(8000, () => {
- console.log('server bound');
-});
-```
-
-This server can be tested by connecting to it using `openssl s_client`:
-
-```sh
-openssl s_client -connect 127.0.0.1:8000
-```
+The server can be tested by connecting to it using the example client from
+[`tls.connect()`][].
## tls.getCiphers()
-* `buffer` {Buffer|Uint8Array} A buffer returned by [`serialize()`][].
+* `buffer` {Buffer|TypedArray|DataView} A buffer returned by [`serialize()`][].
Uses a [`DefaultDeserializer`][] with default options to read a JS value
from a buffer.
@@ -252,7 +252,7 @@ For use inside of a custom [`serializer._writeHostObject()`][].
#### serializer.writeRawBytes(buffer)
-* `buffer` {Buffer|Uint8Array}
+* `buffer` {Buffer|TypedArray|DataView}
Write raw bytes into the serializer’s internal buffer. The deserializer
will require a way to compute the length of the buffer.
@@ -308,7 +308,7 @@ added: v8.0.0
#### new Deserializer(buffer)
-* `buffer` {Buffer|Uint8Array} A buffer returned by
+* `buffer` {Buffer|TypedArray|DataView} A buffer returned by
[`serializer.releaseBuffer()`][].
Creates a new `Deserializer` object.
diff --git a/doc/api/vm.md b/doc/api/vm.md
index c4b7e3f9b381ed..1058e16d19dae7 100644
--- a/doc/api/vm.md
+++ b/doc/api/vm.md
@@ -246,9 +246,9 @@ in the ECMAScript specification.
### module.evaluate([options])
* `options` {Object}
- * `timeout` {number} Specifies the number of milliseconds to evaluate
+ * `timeout` {integer} Specifies the number of milliseconds to evaluate
before terminating execution. If execution is interrupted, an [`Error`][]
- will be thrown.
+ will be thrown. This value must be a strictly positive integer.
* `breakOnSigint` {boolean} If `true`, the execution will be terminated when
`SIGINT` (Ctrl+C) is received. Existing handlers for the event that have
been attached via `process.on('SIGINT')` will be disabled during script
@@ -434,10 +434,10 @@ changes:
in stack traces produced by this script.
* `columnOffset` {number} Specifies the column number offset that is displayed
in stack traces produced by this script.
- * `cachedData` {Buffer} Provides an optional `Buffer` with V8's code cache
- data for the supplied source. When supplied, the `cachedDataRejected` value
- will be set to either `true` or `false` depending on acceptance of the data
- by V8.
+ * `cachedData` {Buffer|TypedArray|DataView} Provides an optional `Buffer` or
+ `TypedArray`, or `DataView` with V8's code cache data for the supplied
+ source. When supplied, the `cachedDataRejected` value will be set to
+ either `true` or `false` depending on acceptance of the data by V8.
* `produceCachedData` {boolean} When `true` and no `cachedData` is present, V8
will attempt to produce code cache data for `code`. Upon success, a
`Buffer` with V8's code cache data will be produced and stored in the
@@ -507,9 +507,9 @@ changes:
* `displayErrors` {boolean} When `true`, if an [`Error`][] error occurs
while compiling the `code`, the line of code causing the error is attached
to the stack trace.
- * `timeout` {number} Specifies the number of milliseconds to execute `code`
+ * `timeout` {integer} Specifies the number of milliseconds to execute `code`
before terminating execution. If execution is terminated, an [`Error`][]
- will be thrown.
+ will be thrown. This value must be a strictly positive integer.
* `breakOnSigint`: if `true`, the execution will be terminated when
`SIGINT` (Ctrl+C) is received. Existing handlers for the
event that have been attached via `process.on('SIGINT')` will be disabled
@@ -570,9 +570,9 @@ changes:
* `displayErrors` {boolean} When `true`, if an [`Error`][] error occurs
while compiling the `code`, the line of code causing the error is attached
to the stack trace.
- * `timeout` {number} Specifies the number of milliseconds to execute `code`
+ * `timeout` {integer} Specifies the number of milliseconds to execute `code`
before terminating execution. If execution is terminated, an [`Error`][]
- will be thrown.
+ will be thrown. This value must be a strictly positive integer.
* `contextName` {string} Human-readable name of the newly created context.
**Default:** `'VM Context i'`, where `i` is an ascending numerical index of
the created context.
@@ -628,9 +628,9 @@ added: v0.3.1
* `displayErrors` {boolean} When `true`, if an [`Error`][] error occurs
while compiling the `code`, the line of code causing the error is attached
to the stack trace.
- * `timeout` {number} Specifies the number of milliseconds to execute `code`
+ * `timeout` {integer} Specifies the number of milliseconds to execute `code`
before terminating execution. If execution is terminated, an [`Error`][]
- will be thrown.
+ will be thrown. This value must be a strictly positive integer.
Runs the compiled code contained by the `vm.Script` within the context of the
current `global` object. Running code does not have access to local scope, but
@@ -669,8 +669,9 @@ added: v10.10.0
in stack traces produced by this script. **Default:** `0`.
* `columnOffset` {number} Specifies the column number offset that is displayed
in stack traces produced by this script. **Default:** `0`.
- * `cachedData` {Buffer} Provides an optional `Buffer` with V8's code cache
- data for the supplied source.
+ * `cachedData` {Buffer|TypedArray|DataView} Provides an optional `Buffer` or
+ `TypedArray`, or `DataView` with V8's code cache data for the supplied
+ source.
* `produceCachedData` {boolean} Specifies whether to produce new cache data.
**Default:** `false`.
* `parsingContext` {Object} The [contextified][] sandbox in which the said
@@ -775,9 +776,9 @@ Returns `true` if the given `sandbox` object has been [contextified][] using
* `displayErrors` {boolean} When `true`, if an [`Error`][] error occurs
while compiling the `code`, the line of code causing the error is attached
to the stack trace.
- * `timeout` {number} Specifies the number of milliseconds to execute `code`
+ * `timeout` {integer} Specifies the number of milliseconds to execute `code`
before terminating execution. If execution is terminated, an [`Error`][]
- will be thrown.
+ will be thrown. This value must be a strictly positive integer.
The `vm.runInContext()` method compiles `code`, runs it within the context of
the `contextifiedSandbox`, then returns the result. Running code does not have
@@ -822,9 +823,9 @@ added: v0.3.1
* `displayErrors` {boolean} When `true`, if an [`Error`][] error occurs
while compiling the `code`, the line of code causing the error is attached
to the stack trace.
- * `timeout` {number} Specifies the number of milliseconds to execute `code`
+ * `timeout` {integer} Specifies the number of milliseconds to execute `code`
before terminating execution. If execution is terminated, an [`Error`][]
- will be thrown.
+ will be thrown. This value must be a strictly positive integer.
* `contextName` {string} Human-readable name of the newly created context.
**Default:** `'VM Context i'`, where `i` is an ascending numerical index of
the created context.
@@ -876,9 +877,9 @@ added: v0.3.1
* `displayErrors` {boolean} When `true`, if an [`Error`][] error occurs
while compiling the `code`, the line of code causing the error is attached
to the stack trace.
- * `timeout` {number} Specifies the number of milliseconds to execute `code`
+ * `timeout` {integer} Specifies the number of milliseconds to execute `code`
before terminating execution. If execution is terminated, an [`Error`][]
- will be thrown.
+ will be thrown. This value must be a strictly positive integer.
`vm.runInThisContext()` compiles `code`, runs it within the context of the
current `global` and returns the result. Running code does not have access to
diff --git a/doc/changelogs/CHANGELOG_V11.md b/doc/changelogs/CHANGELOG_V11.md
index e16ea1b0ad2543..afd930d13b476b 100644
--- a/doc/changelogs/CHANGELOG_V11.md
+++ b/doc/changelogs/CHANGELOG_V11.md
@@ -9,6 +9,7 @@