Skip to content

Commit c903dff

Browse files
committed
add lentient flag that probiting multiple host headers or none at all.
1 parent 2090cc3 commit c903dff

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

src/native/api.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,14 @@ void llhttp_set_lenient_header_value_relaxed(llhttp_t* parser, int enabled) {
324324
}
325325
}
326326

327+
void llhttp_set_lenient_host_relaxed(llhttp_t* parser, int enabled) {
328+
if (enabled) {
329+
parser->lenient_flags |= LENIENT_HOST_RELAXED;
330+
} else {
331+
parser->lenient_flags &= ~LENIENT_HOST_RELAXED;
332+
}
333+
}
334+
327335
/* Callbacks */
328336

329337

src/native/api.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,15 @@ void llhttp_set_lenient_spaces_after_chunk_size(llhttp_t* parser, int enabled);
370370
LLHTTP_EXPORT
371371
void llhttp_set_lenient_header_value_relaxed(llhttp_t* parser, int enabled);
372372

373+
374+
/* Enables/disables relaxed handling of the host header, which can allow multiple
375+
* or no host headers, when disabled it strictly prohibits these form of requests
376+
* from being accepted.
377+
*/
378+
LLHTTP_EXPORT
379+
void llhttp_set_lenient_host_relaxed(llhttp_t* parser, int enabled);
380+
381+
373382
#ifdef __cplusplus
374383
} /* extern "C" */
375384
#endif

0 commit comments

Comments
 (0)