Skip to content

Commit dd61a26

Browse files
indutnytargos
authored andcommitted
deps: update llhttp to 6.0.1
PR-URL: #38359 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Robert Nagy <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Beth Griggs <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Jiawen Geng <[email protected]>
1 parent 6ac0275 commit dd61a26

File tree

3 files changed

+36
-20
lines changed

3 files changed

+36
-20
lines changed

deps/llhttp/include/llhttp.h

+4-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
#define LLHTTP_VERSION_MAJOR 6
55
#define LLHTTP_VERSION_MINOR 0
6-
#define LLHTTP_VERSION_PATCH 0
6+
#define LLHTTP_VERSION_PATCH 1
77

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

236235

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

330+
/* Possible return values 0, -1, HPE_USER */
331331
llhttp_data_cb on_url;
332332
llhttp_data_cb on_status;
333333
llhttp_data_cb on_header_field;
@@ -344,6 +344,7 @@ struct llhttp_settings_s {
344344
*/
345345
llhttp_cb on_headers_complete;
346346

347+
/* Possible return values 0, -1, HPE_USER */
347348
llhttp_data_cb on_body;
348349

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

360+
/* Information-only callbacks, return value is ignored */
359361
llhttp_cb on_url_complete;
360362
llhttp_cb on_status_complete;
361363
llhttp_cb on_header_field_complete;

deps/llhttp/src/api.c

+32-17
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,30 @@
44

55
#include "llhttp.h"
66

7-
#define CALLBACK_MAYBE(PARSER, NAME, ...) \
7+
#define CALLBACK_MAYBE(PARSER, NAME) \
88
do { \
99
const llhttp_settings_t* settings; \
1010
settings = (const llhttp_settings_t*) (PARSER)->settings; \
1111
if (settings == NULL || settings->NAME == NULL) { \
1212
err = 0; \
1313
break; \
1414
} \
15-
err = settings->NAME(__VA_ARGS__); \
15+
err = settings->NAME((PARSER)); \
16+
} while (0)
17+
18+
#define SPAN_CALLBACK_MAYBE(PARSER, NAME, START, LEN) \
19+
do { \
20+
const llhttp_settings_t* settings; \
21+
settings = (const llhttp_settings_t*) (PARSER)->settings; \
22+
if (settings == NULL || settings->NAME == NULL) { \
23+
err = 0; \
24+
break; \
25+
} \
26+
err = settings->NAME((PARSER), (START), (LEN)); \
27+
if (err == -1) { \
28+
err = HPE_USER; \
29+
llhttp_set_error_reason((PARSER), "Span callback error in " #NAME); \
30+
} \
1631
} while (0)
1732

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

124139
switch (parser->finish) {
125140
case HTTP_FINISH_SAFE_WITH_CB:
126-
CALLBACK_MAYBE(parser, on_message_complete, parser);
141+
CALLBACK_MAYBE(parser, on_message_complete);
127142
if (err != HPE_OK) return err;
128143

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

238253
int llhttp__on_message_begin(llhttp_t* s, const char* p, const char* endp) {
239254
int err;
240-
CALLBACK_MAYBE(s, on_message_begin, s);
255+
CALLBACK_MAYBE(s, on_message_begin);
241256
return err;
242257
}
243258

244259

245260
int llhttp__on_url(llhttp_t* s, const char* p, const char* endp) {
246261
int err;
247-
CALLBACK_MAYBE(s, on_url, s, p, endp - p);
262+
SPAN_CALLBACK_MAYBE(s, on_url, p, endp - p);
248263
return err;
249264
}
250265

251266

252267
int llhttp__on_url_complete(llhttp_t* s, const char* p, const char* endp) {
253268
int err;
254-
CALLBACK_MAYBE(s, on_url_complete, s);
269+
CALLBACK_MAYBE(s, on_url_complete);
255270
return err;
256271
}
257272

258273

259274
int llhttp__on_status(llhttp_t* s, const char* p, const char* endp) {
260275
int err;
261-
CALLBACK_MAYBE(s, on_status, s, p, endp - p);
276+
SPAN_CALLBACK_MAYBE(s, on_status, p, endp - p);
262277
return err;
263278
}
264279

265280

266281
int llhttp__on_status_complete(llhttp_t* s, const char* p, const char* endp) {
267282
int err;
268-
CALLBACK_MAYBE(s, on_status_complete, s);
283+
CALLBACK_MAYBE(s, on_status_complete);
269284
return err;
270285
}
271286

272287

273288
int llhttp__on_header_field(llhttp_t* s, const char* p, const char* endp) {
274289
int err;
275-
CALLBACK_MAYBE(s, on_header_field, s, p, endp - p);
290+
SPAN_CALLBACK_MAYBE(s, on_header_field, p, endp - p);
276291
return err;
277292
}
278293

279294

280295
int llhttp__on_header_field_complete(llhttp_t* s, const char* p, const char* endp) {
281296
int err;
282-
CALLBACK_MAYBE(s, on_header_field_complete, s);
297+
CALLBACK_MAYBE(s, on_header_field_complete);
283298
return err;
284299
}
285300

286301

287302
int llhttp__on_header_value(llhttp_t* s, const char* p, const char* endp) {
288303
int err;
289-
CALLBACK_MAYBE(s, on_header_value, s, p, endp - p);
304+
SPAN_CALLBACK_MAYBE(s, on_header_value, p, endp - p);
290305
return err;
291306
}
292307

293308

294309
int llhttp__on_header_value_complete(llhttp_t* s, const char* p, const char* endp) {
295310
int err;
296-
CALLBACK_MAYBE(s, on_header_value_complete, s);
311+
CALLBACK_MAYBE(s, on_header_value_complete);
297312
return err;
298313
}
299314

300315

301316
int llhttp__on_headers_complete(llhttp_t* s, const char* p, const char* endp) {
302317
int err;
303-
CALLBACK_MAYBE(s, on_headers_complete, s);
318+
CALLBACK_MAYBE(s, on_headers_complete);
304319
return err;
305320
}
306321

307322

308323
int llhttp__on_message_complete(llhttp_t* s, const char* p, const char* endp) {
309324
int err;
310-
CALLBACK_MAYBE(s, on_message_complete, s);
325+
CALLBACK_MAYBE(s, on_message_complete);
311326
return err;
312327
}
313328

314329

315330
int llhttp__on_body(llhttp_t* s, const char* p, const char* endp) {
316331
int err;
317-
CALLBACK_MAYBE(s, on_body, s, p, endp - p);
332+
SPAN_CALLBACK_MAYBE(s, on_body, p, endp - p);
318333
return err;
319334
}
320335

321336

322337
int llhttp__on_chunk_header(llhttp_t* s, const char* p, const char* endp) {
323338
int err;
324-
CALLBACK_MAYBE(s, on_chunk_header, s);
339+
CALLBACK_MAYBE(s, on_chunk_header);
325340
return err;
326341
}
327342

328343

329344
int llhttp__on_chunk_complete(llhttp_t* s, const char* p, const char* endp) {
330345
int err;
331-
CALLBACK_MAYBE(s, on_chunk_complete, s);
346+
CALLBACK_MAYBE(s, on_chunk_complete);
332347
return err;
333348
}
334349

test/parallel/test-http-methods.js

-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ const methods = [
4848
'OPTIONS',
4949
'PATCH',
5050
'POST',
51-
'PRI',
5251
'PROPFIND',
5352
'PROPPATCH',
5453
'PURGE',

0 commit comments

Comments
 (0)