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>
This commit is contained in:
parent
c96e96c765
commit
4454d09e8f
7
deps/llhttp/CMakeLists.txt
vendored
7
deps/llhttp/CMakeLists.txt
vendored
@ -1,7 +1,7 @@
|
||||
cmake_minimum_required(VERSION 3.5.1)
|
||||
cmake_minimum_required(VERSION 3.25.0)
|
||||
cmake_policy(SET CMP0069 NEW)
|
||||
|
||||
project(llhttp VERSION 9.2.1)
|
||||
project(llhttp VERSION 9.3.0)
|
||||
include(GNUInstallDirs)
|
||||
|
||||
set(CMAKE_C_STANDARD 99)
|
||||
@ -49,7 +49,7 @@ function(config_library target)
|
||||
|
||||
target_include_directories(${target} PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
$<INSTALL_INTERFACE:include>
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
||||
)
|
||||
|
||||
set_target_properties(${target} PROPERTIES
|
||||
@ -61,6 +61,7 @@ function(config_library target)
|
||||
|
||||
install(TARGETS ${target}
|
||||
EXPORT llhttp
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||
|
22
deps/llhttp/LICENSE
vendored
Normal file
22
deps/llhttp/LICENSE
vendored
Normal file
@ -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.
|
9
deps/llhttp/README.md
vendored
9
deps/llhttp/README.md
vendored
@ -94,7 +94,7 @@ int main() {
|
||||
if (err == HPE_OK) {
|
||||
fprintf(stdout, "Successfully parsed!\n");
|
||||
} else {
|
||||
fprintf(stderr, "Parse error: %s %s\n", llhttp_errno_name(err), parser.reason);
|
||||
fprintf(stderr, "Parse error: %s %s\n", llhttp_errno_name(err), llhttp_get_error_reason(&parser));
|
||||
}
|
||||
}
|
||||
```
|
||||
@ -112,6 +112,7 @@ The following callbacks can return `0` (proceed normally), `-1` (error) or `HPE_
|
||||
* `on_message_complete`: Invoked when a request/response has been completedly parsed.
|
||||
* `on_url_complete`: Invoked after the URL has been parsed.
|
||||
* `on_method_complete`: Invoked after the HTTP method has been parsed.
|
||||
* `on_protocol_complete`: Invoked after the HTTP version has been parsed.
|
||||
* `on_version_complete`: Invoked after the HTTP version has been parsed.
|
||||
* `on_status_complete`: Invoked after the status code has been parsed.
|
||||
* `on_header_field_complete`: Invoked after a header name has been parsed.
|
||||
@ -130,6 +131,7 @@ The following callbacks can return `0` (proceed normally), `-1` (error) or `HPE_
|
||||
* `on_method`: Invoked when another character of the method is received.
|
||||
When parser is created with `HTTP_BOTH` and the input is a response, this also invoked for the sequence `HTTP/`
|
||||
of the first message.
|
||||
* `on_protocol`: Invoked when another character of the protocol is received.
|
||||
* `on_version`: Invoked when another character of the version is received.
|
||||
* `on_header_field`: Invoked when another character of a header name is received.
|
||||
* `on_header_value`: Invoked when another character of a header value is received.
|
||||
@ -187,7 +189,8 @@ 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.
|
||||
the execution can be resumed with `llhttp_resume()` call. In that case the input should be advanced
|
||||
to the last processed byte from the parser, which can be obtained via `llhttp_get_error_pos()`.
|
||||
|
||||
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,
|
||||
@ -196,6 +199,8 @@ they need to invoke `llhttp_resume_after_upgrade()`.
|
||||
**if this function ever returns a non-pause type error, it will continue to return
|
||||
the same error upon each successive call up until `llhttp_init()` is called.**
|
||||
|
||||
If this function returns `HPE_OK`, it means all the input has been consumed and parsed.
|
||||
|
||||
### `llhttp_errno_t llhttp_finish(llhttp_t* parser)`
|
||||
|
||||
This method should be called when the other side has no further bytes to
|
||||
|
10
deps/llhttp/include/llhttp.h
vendored
10
deps/llhttp/include/llhttp.h
vendored
@ -3,8 +3,8 @@
|
||||
#define INCLUDE_LLHTTP_H_
|
||||
|
||||
#define LLHTTP_VERSION_MAJOR 9
|
||||
#define LLHTTP_VERSION_MINOR 2
|
||||
#define LLHTTP_VERSION_PATCH 1
|
||||
#define LLHTTP_VERSION_MINOR 3
|
||||
#define LLHTTP_VERSION_PATCH 0
|
||||
|
||||
#ifndef INCLUDE_LLHTTP_ITSELF_H_
|
||||
#define INCLUDE_LLHTTP_ITSELF_H_
|
||||
@ -90,7 +90,8 @@ enum llhttp_errno {
|
||||
HPE_CB_HEADER_VALUE_COMPLETE = 29,
|
||||
HPE_CB_CHUNK_EXTENSION_NAME_COMPLETE = 34,
|
||||
HPE_CB_CHUNK_EXTENSION_VALUE_COMPLETE = 35,
|
||||
HPE_CB_RESET = 31
|
||||
HPE_CB_RESET = 31,
|
||||
HPE_CB_PROTOCOL_COMPLETE = 38
|
||||
};
|
||||
typedef enum llhttp_errno llhttp_errno_t;
|
||||
|
||||
@ -326,6 +327,7 @@ typedef enum llhttp_status llhttp_status_t;
|
||||
XX(34, CB_CHUNK_EXTENSION_NAME_COMPLETE, CB_CHUNK_EXTENSION_NAME_COMPLETE) \
|
||||
XX(35, CB_CHUNK_EXTENSION_VALUE_COMPLETE, CB_CHUNK_EXTENSION_VALUE_COMPLETE) \
|
||||
XX(31, CB_RESET, CB_RESET) \
|
||||
XX(38, CB_PROTOCOL_COMPLETE, CB_PROTOCOL_COMPLETE) \
|
||||
|
||||
|
||||
#define HTTP_METHOD_MAP(XX) \
|
||||
@ -567,6 +569,7 @@ struct llhttp_settings_s {
|
||||
llhttp_cb on_message_begin;
|
||||
|
||||
/* Possible return values 0, -1, HPE_USER */
|
||||
llhttp_data_cb on_protocol;
|
||||
llhttp_data_cb on_url;
|
||||
llhttp_data_cb on_status;
|
||||
llhttp_data_cb on_method;
|
||||
@ -592,6 +595,7 @@ struct llhttp_settings_s {
|
||||
|
||||
/* Possible return values 0, -1, `HPE_PAUSED` */
|
||||
llhttp_cb on_message_complete;
|
||||
llhttp_cb on_protocol_complete;
|
||||
llhttp_cb on_url_complete;
|
||||
llhttp_cb on_status_complete;
|
||||
llhttp_cb on_method_complete;
|
||||
|
8
deps/llhttp/libllhttp.pc.in
vendored
8
deps/llhttp/libllhttp.pc.in
vendored
@ -1,10 +1,10 @@
|
||||
prefix=@CMAKE_INSTALL_PREFIX@
|
||||
exec_prefix=@CMAKE_INSTALL_PREFIX@
|
||||
libdir=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@
|
||||
includedir=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@
|
||||
exec_prefix=@CMAKE_INSTALL_FULL_BINDIR@
|
||||
libdir=@CMAKE_INSTALL_FULL_LIBDIR@
|
||||
includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
|
||||
|
||||
Name: libllhttp
|
||||
Description: Node.js llhttp Library
|
||||
Version: @PROJECT_VERSION@
|
||||
Libs: -L${libdir} -lllhttp
|
||||
Cflags: -I${includedir}
|
||||
Cflags: -I${includedir}
|
||||
|
45
deps/llhttp/src/api.c
vendored
45
deps/llhttp/src/api.c
vendored
@ -57,29 +57,14 @@ static int wasm_on_headers_complete_wrap(llhttp_t* p) {
|
||||
}
|
||||
|
||||
const llhttp_settings_t wasm_settings = {
|
||||
wasm_on_message_begin,
|
||||
wasm_on_url,
|
||||
wasm_on_status,
|
||||
NULL,
|
||||
NULL,
|
||||
wasm_on_header_field,
|
||||
wasm_on_header_value,
|
||||
NULL,
|
||||
NULL,
|
||||
wasm_on_headers_complete_wrap,
|
||||
wasm_on_body,
|
||||
wasm_on_message_complete,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
.on_message_begin = wasm_on_message_begin,
|
||||
.on_url = wasm_on_url,
|
||||
.on_status = wasm_on_status,
|
||||
.on_header_field = wasm_on_header_field,
|
||||
.on_header_value = wasm_on_header_value,
|
||||
.on_headers_complete = wasm_on_headers_complete_wrap,
|
||||
.on_body = wasm_on_body,
|
||||
.on_message_complete = wasm_on_message_complete,
|
||||
};
|
||||
|
||||
|
||||
@ -341,6 +326,20 @@ int llhttp__on_message_begin(llhttp_t* s, const char* p, const char* endp) {
|
||||
}
|
||||
|
||||
|
||||
int llhttp__on_protocol(llhttp_t* s, const char* p, const char* endp) {
|
||||
int err;
|
||||
SPAN_CALLBACK_MAYBE(s, on_protocol, p, endp - p);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
int llhttp__on_protocol_complete(llhttp_t* s, const char* p, const char* endp) {
|
||||
int err;
|
||||
CALLBACK_MAYBE(s, on_protocol_complete);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
int llhttp__on_url(llhttp_t* s, const char* p, const char* endp) {
|
||||
int err;
|
||||
SPAN_CALLBACK_MAYBE(s, on_url, p, endp - p);
|
||||
|
3019
deps/llhttp/src/llhttp.c
vendored
3019
deps/llhttp/src/llhttp.c
vendored
File diff suppressed because it is too large
Load Diff
@ -1204,6 +1204,10 @@ void ConnectionsList::Expired(const FunctionCallbackInfo<Value>& args) {
|
||||
|
||||
const llhttp_settings_t Parser::settings = {
|
||||
Proxy<Call, &Parser::on_message_begin>::Raw,
|
||||
|
||||
// on_protocol
|
||||
nullptr,
|
||||
|
||||
Proxy<DataCall, &Parser::on_url>::Raw,
|
||||
Proxy<DataCall, &Parser::on_status>::Raw,
|
||||
|
||||
@ -1223,6 +1227,8 @@ const llhttp_settings_t Parser::settings = {
|
||||
Proxy<DataCall, &Parser::on_body>::Raw,
|
||||
Proxy<Call, &Parser::on_message_complete>::Raw,
|
||||
|
||||
// on_protocol_complete
|
||||
nullptr,
|
||||
// on_url_complete
|
||||
nullptr,
|
||||
// on_status_complete
|
||||
|
@ -47,7 +47,7 @@ server.listen(0, common.mustCall(() => {
|
||||
assert.strictEqual(req.socket.listenerCount('end'), 1);
|
||||
common.expectsError({
|
||||
code: 'HPE_INVALID_CONSTANT',
|
||||
message: 'Parse Error: Expected HTTP/'
|
||||
message: 'Parse Error: Expected HTTP/, RTSP/ or ICE/'
|
||||
})(e);
|
||||
countdown.dec();
|
||||
}));
|
||||
|
Loading…
x
Reference in New Issue
Block a user