Yagiz Nizipli
e46fb17ecb
http: remove unused functions and add todos
...
PR-URL: https://github.com/nodejs/node/pull/58143
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Paolo Insogna <paolo@cowtech.it >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev >
2025-05-09 02:07:04 +00:00
Fedor Indutny
4454d09e8f
deps: update llhttp to 9.3.0
...
llhttp@9.3.0 optimizes header value parsing on ARM Neon/WASM, and adds
support for a protocol callback for use outside of the typical HTTP
setting (RTSP/ICE).
PR-URL: https://github.com/nodejs/node/pull/58144
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com >
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
2025-05-07 14:21:52 +00:00
James M Snell
3641d339b9
src: improve error handling in multiple files
...
* node_http_parser
* node_http2
* node_builtins
PR-URL: https://github.com/nodejs/node/pull/57507
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com >
2025-03-20 12:43:16 -07:00
James M Snell
98d4ebc6d4
src: use v8::LocalVector consistently with other minor cleanups
...
V8 introduced `v8::LocalVector` somewhat recently as an alternative
to using `std::vector<v8::Local<T>>` to help ensure that Local handles
are handled correctly. This updates most (but not all) of our uses
of `std::vector<v8::Local<T>>` to use `v8::LocalVector<T>` with a few
other minor cleanups encountered along the way.
PR-URL: https://github.com/nodejs/node/pull/56417
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
2025-01-01 16:27:39 -08:00
Joyee Cheung
503cf160ad
src: refactor http parser binding initialization
...
- Use the per-isolate template to build constants and functions
which is faster
- Use Array::New() with prebuilt vectors which is faster
- Register external references so the binding can be included
in the snapshot
PR-URL: https://github.com/nodejs/node/pull/54276
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Paolo Insogna <paolo@cowtech.it >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Robert Nagy <ronagy@icloud.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev >
2024-08-14 21:21:59 +00:00
Michaël Zasso
c93e256ee7
src: use args.This() instead of Holder
...
The latter is deprecated in V8.
Refs: http://crbug.com/333672197
PR-URL: https://github.com/nodejs/node/pull/53474
Reviewed-By: Robert Nagy <ronagy@icloud.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Paolo Insogna <paolo@cowtech.it >
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com >
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com >
2024-06-18 16:02:42 +00:00
Paolo Insogna
65c8380a5a
http: correctly translate HTTP method
...
PR-URL: https://github.com/nodejs/node/pull/52701
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Robert Nagy <ronagy@icloud.com >
Reviewed-By: Filip Skokan <panva.ip@gmail.com >
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2024-05-04 08:56:28 -07:00
Node.js GitHub Bot
25a6fb6a07
deps: update llhttp to 9.2.0
...
PR-URL: https://github.com/nodejs/node/pull/51719
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev >
2024-03-13 15:56:24 +00:00
Paolo Insogna
03a5c34a82
http: add maximum chunk extension size
...
PR-URL: https://github.com/nodejs-private/node-private/pull/518
Fixes: https://hackerone.com/reports/2233486
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com >
CVE-ID: CVE-2024-22019
2024-02-14 14:27:34 -03:00
Paolo Insogna
e9ff81016d
deps: update llhttp to 9.1.2
...
PR-URL: https://github.com/nodejs/node/pull/48981
Reviewed-By: Robert Nagy <ronagy@icloud.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com >
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
2023-09-16 11:08:18 +00:00
Joyee Cheung
faefe560ef
src: remove ContextEmbedderIndex::kBindingDataStoreIndex
...
We can now get the binding data through the reference to the
realm directly, so remove it from the context embedder data
slot.
PR-URL: https://github.com/nodejs/node/pull/48836
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
2023-07-26 13:26:08 +00:00
Franciszek Koltuniuk
8e710c95f0
http: fix for handling on boot timers headers and request
...
This change is a fix for handling headersTimeout and requestTimeout
that causes unexpected behavior if the HTTP server is started on boot:
- the connections to the server can be closed immediately
with the status HTTP 408
This issue usually happens on IoT or embedded devices where
the reference timestamp (returned by uv_hrtime()) is counted since boot
and can be smaller than the headersTimeout or the requestTimeout value.
Additionally added performance improvement to process the list of
connection only if one of the timers should be processed
PR-URL: https://github.com/nodejs/node/pull/48291
Reviewed-By: Robert Nagy <ronagy@icloud.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Paolo Insogna <paolo@cowtech.it >
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2023-06-19 09:33:02 +00:00
Joyee Cheung
f32aa19400
src: use an array for faster binding data lookup
...
Locally the hashing of the binding names sometimes has significant
presence in the profile of bindings, because there can be collisions,
which makes the cost of adding a new binding data non-trivial,
but it's wasteful to spend time on hashing them or dealing with
collisions at all, since we can just use the EmbedderObjectType
enum as the key, as the string names are not actually used beyond
debugging purposes and can be easily matched with a macro.
And since we can just use the enum as the key, we do not even
need the map and can just use an array with the enum as indices
for the lookup.
PR-URL: https://github.com/nodejs/node/pull/46620
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
2023-02-22 19:03:03 +01:00
Chengzhong Wu
ca07abab53
src: per-realm binding data
...
Binding data is inherited from BaseObject and created in a specific
realm. They need to be tracked on a per-realm basis so that they can
be released properly when a realm is disposed.
PR-URL: https://github.com/nodejs/node/pull/46556
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2023-02-21 22:43:25 +00:00
Joyee Cheung
a5ede9ccf5
http: use v8::Array::New() with a prebuilt vector
...
Avoid using v8::Array::Set() which results in JS execution and is
thus slow. Prebuild the vector in C++ land and build the
JS array directly with that vector whereever possible.
PR-URL: https://github.com/nodejs/node/pull/46447
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Robert Nagy <ronagy@icloud.com >
Reviewed-By: Darshan Sen <raisinten@gmail.com >
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
2023-02-08 09:58:44 +00:00
legendecas
71ff89f929
src: rename internal module declaration as internal bindings
...
This is a continuation of the name reification on the internal bindings.
Renames NODE_MODULE_CONTEXT_AWARE_INTERNAL and
NODE_MODULE_EXTERNAL_REFERENCE to NODE_BINDING_CONTEXT_AWARE_INTERNAL
and NODE_BINDING_EXTERNAL_REFERENCE respectively.
PR-URL: https://github.com/nodejs/node/pull/45551
Refs: https://github.com/nodejs/node/issues/44036
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com >
Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com >
Reviewed-By: Jacob Smith <jacob@frende.me >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
2022-11-29 00:23:08 +08:00
Paolo Insogna
fd36a8dadb
deps: update llhttp to 8.1.0
...
PR-URL: https://github.com/nodejs/node/pull/44967
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com >
Reviewed-By: Darshan Sen <raisinten@gmail.com >
Reviewed-By: Beth Griggs <bethanyngriggs@gmail.com >
2022-10-12 15:36:23 +02:00
Anna Henningsen
ee75ad7a38
src: use if constexpr where appropriate
...
Doesn't change much but communicates to readers that these
are compile-time conditionals.
PR-URL: https://github.com/nodejs/node/pull/44291
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Feng Yu <F3n67u@outlook.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2022-08-27 09:51:35 +00:00
legendecas
a7e5b413ef
src: split property helpers from node::Environment
...
PR-URL: https://github.com/nodejs/node/pull/44056
Refs: https://github.com/nodejs/node/issues/42528
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Feng Yu <F3n67u@outlook.com >
2022-08-02 00:01:02 +08:00
theanarkh
da3949cfd7
http: fix http server connection list when close
...
PR-URL: https://github.com/nodejs/node/pull/43949
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Paolo Insogna <paolo@cowtech.it >
Reviewed-By: Feng Yu <F3n67u@outlook.com >
2022-07-24 15:06:24 +01:00
Paolo Insogna
b970634cfe
http: defer reentrant execution of Parser::Execute
...
PR-URL: https://github.com/nodejs/node/pull/43369
Fixes: https://github.com/nodejs/node/issues/39671
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2022-06-22 10:55:18 +02:00
Shogun
f714a0fa6e
http: added connection closing methods
...
Fixes: https://github.com/nodejs/node/issues/41578
PR-URL: https://github.com/nodejs/node/pull/42812
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2022-05-03 14:04:07 +02:00
Paolo Insogna
3caa2c1a00
http: refactor headersTimeout and requestTimeout logic
...
PR-URL: https://github.com/nodejs/node/pull/41263
Fixes: https://github.com/nodejs/node/issues/33440
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Robert Nagy <ronagy@icloud.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Darshan Sen <raisinten@gmail.com >
2022-04-13 15:47:59 +01:00
Anna Henningsen
b51eba422f
src: remove separate definitions for static constexpr members
...
This is no longer necessary (and actually deprecated) since C++17.
PR-URL: https://github.com/nodejs/node/pull/41755
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Mestery <mestery@protonmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Darshan Sen <raisinten@gmail.com >
2022-02-11 16:42:09 +00:00
Fedor Indutny
6a1986d50a
deps: update llhttp to 5.1.0
...
PR-URL: https://github.com/nodejs/node/pull/38146
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Robert Nagy <ronagy@icloud.com >
Reviewed-By: Jiawen Geng <technicalcute@gmail.com >
Reviewed-By: Daniele Belardi <dwon.dnl@gmail.com >
2021-04-10 14:31:34 -07:00
Joyee Cheung
1b7531cdeb
src: rename binding_data_name to type_name in BindingData
...
Previously, this was a per-class string constant for BindingData
which is used as keys for identifying these objects in the binding
data map. These are just type names of the BindingData.
This patch renames the variable to type_name so that
we can generalize this constant for other BaseObjects and use
it for debugging and logging the types of other BaseObjects.
PR-URL: https://github.com/nodejs/node/pull/37112
Refs: https://github.com/nodejs/node/pull/36943
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com >
2021-02-08 14:00:31 +08:00
Michaël Zasso
b346cd1760
src: avoid implicit type conversions
...
This fixes a bunch of C4244 ('conversion' conversion from 'type1' to
'type2', possible loss of data) MSVC warnings in the code base.
PR-URL: https://github.com/nodejs/node/pull/37149
Reviewed-By: Darshan Sen <raisinten@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-02-07 17:51:41 -08:00
James M Snell
28fe1ef635
src: reduce duplicated boilerplate with new env utility fn
...
Signed-off-by: James M Snell <jasnell@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/36536
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2021-01-03 12:58:09 -08:00
Anna Henningsen
40364b181d
src: add check against non-weak BaseObjects at process exit
...
When a process exits cleanly, i.e. because the event loop ends up
without things to wait for, the Node.js objects that are left on
the heap should be:
1. weak, i.e. ready for garbage collection once no longer
referenced, or
2. detached, i.e. scheduled for destruction once no longer
referenced, or
3. an unrefed libuv handle, i.e. does not keep the event loop
alive, or
4. an inactive libuv handle (essentially the same here)
There are a few exceptions to this rule, but generally,
if there are C++-backed Node.js objects on the heap
that do not fall into the above categories, we may be looking
at a potential memory leak. Most likely, the cause is a missing
`MakeWeak()` call on the corresponding object.
In order to avoid this kind of problem, we check the list
of BaseObjects for these criteria. In this commit, we only do so
when explicitly instructed to or when in debug mode
(where --verify-base-objects is always-on).
In particular, this avoids the kinds of memory leak issues
that were fixed in the PRs referenced below.
Refs: https://github.com/nodejs/node/pull/35488
Refs: https://github.com/nodejs/node/pull/35487
Refs: https://github.com/nodejs/node/pull/35481
PR-URL: https://github.com/nodejs/node/pull/35490
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2020-10-07 10:54:34 +02:00
Matteo Collina
df08d527c2
http: add requestTimeout
...
This commits introduces a new http.Server option called requestTimeout
with a default value in milliseconds of 0.
If requestTimeout is set to a positive value, the server will start a new
timer set to expire in requestTimeout milliseconds when a new connection
is established. The timer is also set again if new requests after the
first are received on the socket (this handles pipelining and keep-alive
cases).
The timer is cancelled when:
1. the request body is completely received by the server.
2. the response is completed. This handles the case where the
application responds to the client without consuming the request body.
3. the connection is upgraded, like in the WebSocket case.
If the timer expires, then the server responds with status code 408 and
closes the connection.
CVE-2020-8251
PR-URL: https://github.com/nodejs-private/node-private/pull/208
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Robert Nagy <ronagy@icloud.com >
Reviewed-By: Mary Marchini <oss@mmarchini.me >
Co-Authored-By: Paolo Insogna <paolo@cowtech.it >
Co-Authored-By: Robert Nagy <ronagy@icloud.com >
2020-09-15 15:39:54 -04:00
Robert Nagy
da4d8de9d0
http: reset headers timeout on headers complete
...
headers timeout should not occur *after* headers have been
received.
Fixes: https://github.com/nodejs/node/issues/34576
PR-URL: https://github.com/nodejs/node/pull/34578
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Pranshu Srivastava <rexagod@gmail.com >
2020-08-02 09:35:18 +02:00
Joyee Cheung
86fdaa7455
src: retrieve binding data from the context
...
Instead of passing them through the data bound to function
templates, store references to them in a list embedded inside
the context.
This makes the function templates more context-independent,
and makes it possible to embed binding data in non-main contexts.
Co-authored-by: Anna Henningsen <anna@addaleax.net >
PR-URL: https://github.com/nodejs/node/pull/33139
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2020-05-06 06:44:04 +02:00
Anna Henningsen
1216e8f777
src: move http parser state out of Environment
...
Moves state that is specific to HTTP/1 into the HTTP/1 implementation
as a cleanup.
PR-URL: https://github.com/nodejs/node/pull/32538
Reviewed-By: James M Snell <jasnell@gmail.com >
2020-04-06 02:06:41 +02:00
Alex R
b149eefa82
http: fix incorrect headersTimeout measurement
...
For keep-alive connections, the headersTimeout may fire during
subsequent request because the measurement was reset after
a request and not before a request.
PR-URL: https://github.com/nodejs/node/pull/32329
Fixes: https://github.com/nodejs/node/issues/27363
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2020-04-02 14:50:20 +02:00
James M Snell
0fac393d26
src: improve handling of internal field counting
...
Change suggested by bnoordhuis.
Improve handing of internal field counting by using enums.
Helps protect against future possible breakage if field
indexes are ever changed or added to.
Signed-off-by: James M Snell <jasnell@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/31960
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2020-03-02 10:58:36 -08:00
Anna Henningsen
fab3eff2e5
src: inform callback scopes about exceptions in HTTP parser
...
Refs: 4aca277f16
Refs: https://github.com/nodejs/node/pull/30236
Fixes: https://github.com/nodejs/node/issues/31796
PR-URL: https://github.com/nodejs/node/pull/31801
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: David Carlier <devnexen@gmail.com >
2020-02-18 02:50:02 +01:00
Sam Roberts
fe3975783c
http: strip trailing OWS from header values
...
HTTP header values can have trailing OWS, but it should be stripped. It
is not semantically part of the header's value, and if treated as part
of the value, it can cause spurious inequality between expected and
actual header values.
Note that a single SPC of leading OWS is common before the field-value,
and it is already handled by the HTTP parser by stripping all leading
OWS. It is only the trailing OWS that must be stripped by the parser
user.
header-field = field-name ":" OWS field-value OWS
; https://tools.ietf.org/html/rfc7230#section-3.2
OWS = *( SP / HTAB )
; https://tools.ietf.org/html/rfc7230#section-3.2.3
Fixes: https://hackerone.com/reports/730779
PR-URL: https://github.com/nodejs-private/node-private/pull/189
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: James M Snell <jasnell@gmail.com >
2020-02-06 15:22:50 +01:00
Sam Roberts
02a0c74861
http: llhttp opt-in insecure HTTP header parsing
...
Allow insecure HTTP header parsing. Make clear it is insecure.
See:
- https://github.com/nodejs/node/pull/30553
- https://github.com/nodejs/node/issues/27711#issuecomment-556265881
- https://github.com/nodejs/node/issues/30515
PR-URL: https://github.com/nodejs/node/pull/30567
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Denys Otrishko <shishugi@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-12-09 09:56:16 -08:00
Anna Henningsen
6bf5a1d691
http: make maximum header size configurable per-stream or per-server
...
Make `maxHeaderSize` a.k.a. `--max-header-size` configurable now that
the legacy parser is gone (which only supported a single global value).
Refs: https://github.com/nodejs/node/pull/30567
PR-URL: https://github.com/nodejs/node/pull/30570
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: David Carlier <devnexen@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Sam Roberts <vieuxtech@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Denys Otrishko <shishugi@gmail.com >
2019-12-01 03:00:46 +01:00
Anna Henningsen
6072e01c93
src: do not use std::function for OnScopeLeave
...
Using `std::function` adds an extra layer of indirection, and in
particular, heap allocations that are not necessary in our use case
here.
PR-URL: https://github.com/nodejs/node/pull/30134
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: David Carlier <devnexen@gmail.com >
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-11-07 10:39:40 +01:00
Anna Henningsen
4aca277f16
src: remove AsyncScope and AsyncCallbackScope
...
Reduce the number of different scopes we use for async callbacks.
PR-URL: https://github.com/nodejs/node/pull/30236
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: David Carlier <devnexen@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-11-06 13:57:57 +01:00
Anna Henningsen
ac59dc42ed
http: remove legacy parser
...
Remove the legacy `http_parser` implementation as a dependency
and all code that uses it in favor of llhttp, given that the latter
has been the default for all of Node 12 with no outstanding issues.
PR-URL: https://github.com/nodejs/node/pull/29589
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Jiawen Geng <technicalcute@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Minwoo Jung <minwoo@nodesource.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
2019-09-20 20:18:35 +02:00
Anna Henningsen
aa943d098e
http: make parser choice a runtime flag
...
Add a `--http-parser=llhttp` vs `--http-parser=traditional`
command line switch, to make testing and comparing the new
llhttp-based implementation easier.
PR-URL: https://github.com/nodejs/node/pull/24739
Refs: https://github.com/nodejs/node/issues/24730
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Matheus Marchini <mat@mmarchini.me >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com >
2018-12-06 05:21:36 +01:00
Fedor Indutny
175164e5d1
http: fix error return in Finish()
...
`http_parser_execute(..., nullptr, 0)` returns either `0` or `1`. The
expectation is that no error must be returned if it is `0`, and if
it is `1` - a `Error` object must be returned back to user.
The introduction of `llhttp` and the refactor that happened during it
accidentally removed the error-returning code. This commit reverts it
back to its original state.
Fix : #24585
PR-URL: https://github.com/nodejs/node/pull/24738
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-12-02 12:51:32 -05:00
Rod Vagg
7bfcfc2ffe
http: reset headers_nread_ on llhttp parser reuse
...
PR-URL: https://github.com/nodejs-private/node-private/pull/149
Reviewed-By: Fedor Indutny <fedor@indutny.com >
2018-11-28 11:36:34 +11:00
Fedor Indutny
af8d9e3972
http: fix header limit errors and test for llhttp
...
Ref: https://github.com/nodejs-private/node-private/pull/143
PR-URL: https://github.com/nodejs-private/node-private/pull/149
Reviewed-By: Rod Vagg <rod@vagg.org >
2018-11-28 11:36:34 +11:00
Rod Vagg
f413f7c9cf
deps,http: llhttp set max header size to 8KB
...
CVE-2018-12121
As per nodejs-private/node-private#149 for http_parse but for llhttp
Ref: https://github.com/nodejs-private/node-private/pull/143
PR-URL: https://github.com/nodejs-private/node-private/pull/149
Reviewed-By: Matteo Collina <hello@matteocollina.com >
2018-11-28 11:36:34 +11:00
Joyee Cheung
83c6067ac6
http: remove pushValueToArray in Parser::CreateHeaders()
...
Instead of calling into JS from C++ to push values into an array,
use the new Array::New API that takes a pointer and a length
directly.
PR-URL: https://github.com/nodejs/node/pull/24264
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com >
Reviewed-By: Refael Ackermann <refack@gmail.com >
2018-11-14 02:58:22 +08:00
Daniel Bevenius
344d33eef1
src: fix v8 compiler warnings in src
...
This commit changes the code to use the maybe version.
PR-URL: https://github.com/nodejs/node/pull/24246
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Refael Ackermann <refack@gmail.com >
2018-11-11 08:02:30 +01:00
Fedor Indutny
d4654d89be
deps: introduce llhttp
...
llhttp is modern, written in human-readable TypeScript, verifiable, and
is very easy to maintain.
See: https://github.com/indutny/llhttp
PR-URL: https://github.com/nodejs/node/pull/24059
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Refael Ackermann <refack@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Rod Vagg <rod@vagg.org >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
2018-11-10 17:54:21 -05:00