Skip to content

Commit c168e8e

Browse files
committed
add tests and run linter
1 parent fff80b9 commit c168e8e

2 files changed

Lines changed: 37 additions & 0 deletions

File tree

test/fixtures/extra.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,12 @@ void llhttp__test_init_response_lenient_header_value_relaxed(llparse_t* s) {
201201
s->lenient_flags |= LENIENT_HEADER_VALUE_RELAXED;
202202
}
203203

204+
void llhttp__test_init_request_lenient_host_header_relaxed(llparse_t* s) {
205+
llhttp__test_init_request(s);
206+
s->lenient_flags |= LENIENT_HOST_HEADER;
207+
}
208+
209+
204210

205211
void llhttp__test_finish(llparse_t* s) {
206212
llparse__print(NULL, NULL, "finish=%d", s->finish);
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
Relaxed host header
2+
===================
3+
4+
Relaxed host header mode: accepts multiple host headers
5+
this is meant to stop redirection or injection attacks
6+
and other unusual behaviors.
7+
8+
## multiple host headers (relaxed)
9+
HOST_HEADER if set should allow multiple hosts to be set.
10+
11+
<!-- meta={"type": "request_lenient_host_header_relaxed"} -->
12+
13+
```http
14+
GET /url HTTP/1.1
15+
host: www.python.org
16+
host: llhttp.org
17+
18+
```
19+
20+
21+
## Multiple Host
22+
23+
HOST_HEADER if disabled should not allow multiple headers to be set.
24+
25+
```http
26+
GET /url HTTP/1.1
27+
host: www.python.org
28+
host: llhttp.org
29+
30+
```
31+

0 commit comments

Comments
 (0)