Skip to content

Commit b68aea9

Browse files
committed
add lentient-host-header test and rename HOST lentient flag
1 parent c903dff commit b68aea9

4 files changed

Lines changed: 8 additions & 8 deletions

File tree

src/llhttp/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export const LENIENT_FLAGS = {
8383
OPTIONAL_CR_BEFORE_LF: 1 << 8,
8484
SPACES_AFTER_CHUNK_SIZE: 1 << 9,
8585
HEADER_VALUE_RELAXED: 1 << 10,
86-
HOST_RELAXED: 1 << 11,
86+
HOST_HEADER: 1 << 11,
8787
} as const;
8888

8989
export const STATUSES = {

src/llhttp/http.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -551,11 +551,11 @@ export class HTTP {
551551
}
552552

553553
private buildHostCheck(next: Node): Node {
554-
// Check if the lentient flag given is not set to HOST_RELAXED
554+
// Check if the lentient flag given is not set to HOST_HEADER
555555
// This will reject repetative versions of the host header
556556
const p = this.llparse;
557557
return this.testLenientFlags(
558-
~LENIENT_FLAGS.HOST_RELAXED,
558+
~LENIENT_FLAGS.HOST_HEADER,
559559
{1: next},
560560
this.testFlags(
561561
FLAGS.HOST_SEEN,
@@ -1189,7 +1189,7 @@ export class HTTP {
11891189
// before leaving header state if Host is not set to being
11901190
// relaxed see if no host has been provided at all...
11911191
return this.testLenientFlags(
1192-
~LENIENT_FLAGS.HOST_RELAXED,
1192+
~LENIENT_FLAGS.HOST_HEADER,
11931193
{1:this.testFlags(
11941194
FLAGS.HOST_SEEN,
11951195
{1: beforeHeadersComplete},

src/native/api.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -324,11 +324,11 @@ 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) {
327+
void llhttp_set_lenient_host_header(llhttp_t* parser, int enabled) {
328328
if (enabled) {
329-
parser->lenient_flags |= LENIENT_HOST_RELAXED;
329+
parser->lenient_flags |= LENIENT_HOST_HEADER;
330330
} else {
331-
parser->lenient_flags &= ~LENIENT_HOST_RELAXED;
331+
parser->lenient_flags &= ~LENIENT_HOST_HEADER;
332332
}
333333
}
334334

src/native/api.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ void llhttp_set_lenient_header_value_relaxed(llhttp_t* parser, int enabled);
376376
* from being accepted.
377377
*/
378378
LLHTTP_EXPORT
379-
void llhttp_set_lenient_host_relaxed(llhttp_t* parser, int enabled);
379+
void llhttp_set_lenient_host_header(llhttp_t* parser, int enabled);
380380

381381

382382
#ifdef __cplusplus

0 commit comments

Comments
 (0)