Skip to content

deps: update llhttp to 9.2.1 #58271

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions deps/llhttp/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
libllhttp.pc
7 changes: 3 additions & 4 deletions deps/llhttp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.25.0)
cmake_minimum_required(VERSION 3.5.1)
cmake_policy(SET CMP0069 NEW)

project(llhttp VERSION 9.3.0)
project(llhttp VERSION 9.2.1)
include(GNUInstallDirs)

set(CMAKE_C_STANDARD 99)
Expand Down Expand Up @@ -49,7 +49,7 @@ function(config_library target)

target_include_directories(${target} PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
$<INSTALL_INTERFACE:include>
)

set_target_properties(${target} PROPERTIES
Expand All @@ -61,7 +61,6 @@ 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}
Expand Down
22 changes: 0 additions & 22 deletions deps/llhttp/LICENSE

This file was deleted.

9 changes: 2 additions & 7 deletions deps/llhttp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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), llhttp_get_error_reason(&parser));
fprintf(stderr, "Parse error: %s %s\n", llhttp_errno_name(err), parser.reason);
}
}
```
Expand All @@ -112,7 +112,6 @@ 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.
Expand All @@ -131,7 +130,6 @@ 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.
Expand Down Expand Up @@ -189,8 +187,7 @@ 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 that case the input should be advanced
to the last processed byte from the parser, which can be obtained via `llhttp_get_error_pos()`.
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,
Expand All @@ -199,8 +196,6 @@ 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
Expand Down
10 changes: 3 additions & 7 deletions deps/llhttp/include/llhttp.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
#define INCLUDE_LLHTTP_H_

#define LLHTTP_VERSION_MAJOR 9
#define LLHTTP_VERSION_MINOR 3
#define LLHTTP_VERSION_PATCH 0
#define LLHTTP_VERSION_MINOR 2
#define LLHTTP_VERSION_PATCH 1

#ifndef INCLUDE_LLHTTP_ITSELF_H_
#define INCLUDE_LLHTTP_ITSELF_H_
Expand Down Expand Up @@ -90,8 +90,7 @@ 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_PROTOCOL_COMPLETE = 38
HPE_CB_RESET = 31
};
typedef enum llhttp_errno llhttp_errno_t;

Expand Down Expand Up @@ -327,7 +326,6 @@ 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) \
Expand Down Expand Up @@ -569,7 +567,6 @@ 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;
Expand All @@ -595,7 +592,6 @@ 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;
Expand Down
8 changes: 4 additions & 4 deletions deps/llhttp/libllhttp.pc.in
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=@CMAKE_INSTALL_FULL_BINDIR@
libdir=@CMAKE_INSTALL_FULL_LIBDIR@
includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
exec_prefix=@CMAKE_INSTALL_PREFIX@
libdir=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@
includedir=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@

Name: libllhttp
Description: Node.js llhttp Library
Version: @PROJECT_VERSION@
Libs: -L${libdir} -lllhttp
Cflags: -I${includedir}
Cflags: -I${includedir}
45 changes: 23 additions & 22 deletions deps/llhttp/src/api.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,29 @@ static int wasm_on_headers_complete_wrap(llhttp_t* p) {
}

const llhttp_settings_t wasm_settings = {
.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,
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,
};


Expand Down Expand Up @@ -326,20 +341,6 @@ 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);
Expand Down
Loading
Loading