|
| 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 | +When HOST_HEADER is not set, it should allow multiple hosts to be set. |
| 10 | + |
| 11 | +<!-- meta={"type": "request"} --> |
| 12 | + |
| 13 | +```http |
| 14 | +GET / HTTP/1.1 |
| 15 | +host: www.python.org |
| 16 | +host: llhttp.org |
| 17 | +
|
| 18 | +
|
| 19 | +``` |
| 20 | +```log |
| 21 | +off=0 message begin |
| 22 | +off=0 len=3 span[method]="GET" |
| 23 | +off=3 method complete |
| 24 | +off=4 len=4 span[url]="/url" |
| 25 | +off=9 url complete |
| 26 | +off=9 len=4 span[protocol]="HTTP" |
| 27 | +off=13 protocol complete |
| 28 | +off=14 len=3 span[version]="1.1" |
| 29 | +off=17 version complete |
| 30 | +off=19 len=4 span[header_field] = "host" |
| 31 | +off=24 len=10 span[header_value] = "www.python.org" |
| 32 | +off=35 len=4 span[header_field] = "host" |
| 33 | +off=40 len=10 span[header_field] = "llhttp.org" |
| 34 | +``` |
| 35 | + |
| 36 | + |
| 37 | +## Invalid Hosts (strict) |
| 38 | + |
| 39 | +HOST_HEADER if enabled this will not allow multiple headers to be set. |
| 40 | + |
| 41 | +<!-- meta={"type": "request-lenient-host-header"} --> |
| 42 | + |
| 43 | +```http |
| 44 | +GET /url HTTP/1.1 |
| 45 | +host: www.python.org |
| 46 | +host: llhttp.org |
| 47 | +
|
| 48 | +
|
| 49 | +``` |
| 50 | + |
| 51 | +```log |
| 52 | +off=0 message begin |
| 53 | +off=0 len=3 span[method]="GET" |
| 54 | +off=3 method complete |
| 55 | +off=4 len=4 span[url]="/url" |
| 56 | +off=9 url complete |
| 57 | +off=9 len=4 span[protocol]="HTTP" |
| 58 | +off=13 protocol complete |
| 59 | +off=14 len=3 span[version]="1.1" |
| 60 | +off=17 version complete |
| 61 | +off=19 len=4 span[header_field] = "host" |
| 62 | +off=24 len=10 span[header_value] = "www.python.org" |
| 63 | +off=19 len=4 error code=40 |
| 64 | +``` |
0 commit comments