Skip to content
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

deps: update llhttp to 6.0.1 #38359

Closed
wants to merge 1 commit into from
Closed
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
6 changes: 4 additions & 2 deletions deps/llhttp/include/llhttp.h
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@

#define LLHTTP_VERSION_MAJOR 6
#define LLHTTP_VERSION_MINOR 0
#define LLHTTP_VERSION_PATCH 0
#define LLHTTP_VERSION_PATCH 1

#ifndef LLHTTP_STRICT_MODE
# define LLHTTP_STRICT_MODE 0
@@ -231,7 +231,6 @@ typedef enum llhttp_method llhttp_method_t;
XX(31, LINK, LINK) \
XX(32, UNLINK, UNLINK) \
XX(33, SOURCE, SOURCE) \
XX(34, PRI, PRI) \


#define RTSP_METHOD_MAP(XX) \
@@ -328,6 +327,7 @@ struct llhttp_settings_s {
/* Possible return values 0, -1, `HPE_PAUSED` */
llhttp_cb on_message_begin;

/* Possible return values 0, -1, HPE_USER */
llhttp_data_cb on_url;
llhttp_data_cb on_status;
llhttp_data_cb on_header_field;
@@ -344,6 +344,7 @@ struct llhttp_settings_s {
*/
llhttp_cb on_headers_complete;

/* Possible return values 0, -1, HPE_USER */
llhttp_data_cb on_body;

/* Possible return values 0, -1, `HPE_PAUSED` */
@@ -356,6 +357,7 @@ struct llhttp_settings_s {
llhttp_cb on_chunk_header;
llhttp_cb on_chunk_complete;

/* Information-only callbacks, return value is ignored */
llhttp_cb on_url_complete;
llhttp_cb on_status_complete;
llhttp_cb on_header_field_complete;
49 changes: 32 additions & 17 deletions deps/llhttp/src/api.c
Original file line number Diff line number Diff line change
@@ -4,15 +4,30 @@

#include "llhttp.h"

#define CALLBACK_MAYBE(PARSER, NAME, ...) \
#define CALLBACK_MAYBE(PARSER, NAME) \
do { \
const llhttp_settings_t* settings; \
settings = (const llhttp_settings_t*) (PARSER)->settings; \
if (settings == NULL || settings->NAME == NULL) { \
err = 0; \
break; \
} \
err = settings->NAME(__VA_ARGS__); \
err = settings->NAME((PARSER)); \
} while (0)

#define SPAN_CALLBACK_MAYBE(PARSER, NAME, START, LEN) \
do { \
const llhttp_settings_t* settings; \
settings = (const llhttp_settings_t*) (PARSER)->settings; \
if (settings == NULL || settings->NAME == NULL) { \
err = 0; \
break; \
} \
err = settings->NAME((PARSER), (START), (LEN)); \
if (err == -1) { \
err = HPE_USER; \
llhttp_set_error_reason((PARSER), "Span callback error in " #NAME); \
} \
} while (0)

void llhttp_init(llhttp_t* parser, llhttp_type_t type,
@@ -123,7 +138,7 @@ llhttp_errno_t llhttp_finish(llhttp_t* parser) {

switch (parser->finish) {
case HTTP_FINISH_SAFE_WITH_CB:
CALLBACK_MAYBE(parser, on_message_complete, parser);
CALLBACK_MAYBE(parser, on_message_complete);
if (err != HPE_OK) return err;

/* FALLTHROUGH */
@@ -237,98 +252,98 @@ void llhttp_set_lenient_keep_alive(llhttp_t* parser, int enabled) {

int llhttp__on_message_begin(llhttp_t* s, const char* p, const char* endp) {
int err;
CALLBACK_MAYBE(s, on_message_begin, s);
CALLBACK_MAYBE(s, on_message_begin);
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);
SPAN_CALLBACK_MAYBE(s, on_url, p, endp - p);
return err;
}


int llhttp__on_url_complete(llhttp_t* s, const char* p, const char* endp) {
int err;
CALLBACK_MAYBE(s, on_url_complete, s);
CALLBACK_MAYBE(s, on_url_complete);
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);
SPAN_CALLBACK_MAYBE(s, on_status, p, endp - p);
return err;
}


int llhttp__on_status_complete(llhttp_t* s, const char* p, const char* endp) {
int err;
CALLBACK_MAYBE(s, on_status_complete, s);
CALLBACK_MAYBE(s, on_status_complete);
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);
SPAN_CALLBACK_MAYBE(s, on_header_field, p, endp - p);
return err;
}


int llhttp__on_header_field_complete(llhttp_t* s, const char* p, const char* endp) {
int err;
CALLBACK_MAYBE(s, on_header_field_complete, s);
CALLBACK_MAYBE(s, on_header_field_complete);
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);
SPAN_CALLBACK_MAYBE(s, on_header_value, p, endp - p);
return err;
}


int llhttp__on_header_value_complete(llhttp_t* s, const char* p, const char* endp) {
int err;
CALLBACK_MAYBE(s, on_header_value_complete, s);
CALLBACK_MAYBE(s, on_header_value_complete);
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);
CALLBACK_MAYBE(s, on_headers_complete);
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);
CALLBACK_MAYBE(s, on_message_complete);
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);
SPAN_CALLBACK_MAYBE(s, on_body, 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);
CALLBACK_MAYBE(s, on_chunk_header);
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);
CALLBACK_MAYBE(s, on_chunk_complete);
return err;
}

1 change: 0 additions & 1 deletion test/parallel/test-http-methods.js
Original file line number Diff line number Diff line change
@@ -48,7 +48,6 @@ const methods = [
'OPTIONS',
'PATCH',
'POST',
'PRI',
'PROPFIND',
'PROPPATCH',
'PURGE',