Skip to content

Commit 3cbea60

Browse files
MDA2AVclaude
andcommitted
Add exact HTTP request code blocks to all 101 glossary pages
Each test's "What it sends" section now shows the exact wire-format request sent by the probe, with visible \r\n markers, hex escapes for control/NUL bytes, and truncated representations for oversized payloads. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent aa7c7a4 commit 3cbea60

101 files changed

Lines changed: 1058 additions & 6 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/content/docs/content-length/cl-non-numeric.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@ weight: 1
1616

1717
A request with a non-numeric `Content-Length` value, e.g., `Content-Length: abc`.
1818

19+
```http
20+
POST / HTTP/1.1\r\n
21+
Host: localhost:8080\r\n
22+
Content-Length: abc\r\n
23+
\r\n
24+
```
25+
26+
1927
## What the RFC says
2028

2129
Content-Length is defined as `1*DIGIT`. A value containing non-digit characters does not match this grammar.

docs/content/docs/content-length/cl-plus-sign.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,15 @@ weight: 2
1616

1717
A request with a plus sign in the Content-Length value: `Content-Length: +42`.
1818

19+
```http
20+
POST / HTTP/1.1\r\n
21+
Host: localhost:8080\r\n
22+
Content-Length: +5\r\n
23+
\r\n
24+
hello
25+
```
26+
27+
1928
## What the RFC says
2029

2130
The `+` character is not in the DIGIT set (`%x30-39`), so `+42` does not match `1*DIGIT`. This is an invalid Content-Length and MUST be treated as an unrecoverable error.

docs/content/docs/headers/empty-header-name.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,16 @@ weight: 3
1616

1717
A header line starting with a colon — effectively an empty field name: `: value`.
1818

19+
```http
20+
GET / HTTP/1.1\r\n
21+
Host: localhost:8080\r\n
22+
: empty-name\r\n
23+
\r\n
24+
```
25+
26+
A header line starting with `:` — the header name is empty.
27+
28+
1929
## What the RFC says
2030

2131
Field names are defined as `token = 1*tchar`, requiring at least one valid token character. An empty string does not match `1*tchar`. While there is no explicit "MUST reject empty field names with 400" statement, a line starting with `:` fails to match the `field-line` grammar entirely.

docs/content/docs/headers/expect-unknown.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,16 @@ weight: 7
1616

1717
`Expect: 200-ok` — an Expect header with a value the server cannot fulfill.
1818

19+
```http
20+
GET / HTTP/1.1\r\n
21+
Host: localhost:8080\r\n
22+
Expect: 200-ok\r\n
23+
\r\n
24+
```
25+
26+
The `Expect` header contains an unknown expectation value (not `100-continue`).
27+
28+
1929
## What the RFC says
2030

2131
> "A server that receives an Expect field value containing a member other than 100-continue MAY respond with a 417 (Expectation Failed) status code to indicate that the unexpected expectation cannot be met." — RFC 9110 Section 10.1.1

docs/content/docs/headers/header-no-colon.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,16 @@ weight: 5
1616

1717
A header line with no colon: `InvalidHeaderNoColon`.
1818

19+
```http
20+
GET / HTTP/1.1\r\n
21+
Host: localhost:8080\r\n
22+
NoColonHere\r\n
23+
\r\n
24+
```
25+
26+
A header line without any colon separator.
27+
28+
1929
## What the RFC says
2030

2131
The field-line grammar is `field-name ":" OWS field-value OWS`. A line without a colon does not match this grammar. It could be misinterpreted as a continuation line, a new request, or garbage — any of which is dangerous.

docs/content/docs/headers/invalid-header-name.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,16 @@ weight: 4
1616

1717
A header with non-token characters in the field name (e.g., characters outside the `tchar` set defined in RFC 9110 Section 5.6.2).
1818

19+
```http
20+
GET / HTTP/1.1\r\n
21+
Host: localhost:8080\r\n
22+
Bad[Name: value\r\n
23+
\r\n
24+
```
25+
26+
The header name contains `[` which is not a valid token character.
27+
28+
1929
## What the RFC says
2030

2131
The `tchar` set is: `"!" / "#" / "$" / "%" / "&" / "'" / "*" / "+" / "-" / "." / "^" / "_" / "`" / "|" / "~" / DIGIT / ALPHA`. Characters outside this set in a field name violate the grammar.

docs/content/docs/headers/obs-fold.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,14 @@ A request with an obsolete line-folded header value — a continuation line that
1818

1919
```http
2020
GET / HTTP/1.1\r\n
21-
Host: localhost\r\n
22-
X-Test: value1\r\n
23-
continuation\r\n
21+
Host: localhost:8080\r\n
22+
X-Test: value\r\n
23+
continued\r\n
2424
\r\n
2525
```
2626

27-
The ` continuation` line (starting with a space) is "obs-fold" — it was valid in older HTTP but is deprecated.
27+
The `X-Test` header value is split across two lines. The second line starts with a space (obs-fold / line folding).
28+
2829

2930
## What the RFC says
3031

docs/content/docs/headers/sp-before-colon.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,16 @@ weight: 1
1616

1717
A request with a space between the header field name and the colon: `Host : localhost`.
1818

19+
```http
20+
GET / HTTP/1.1\r\n
21+
Host: localhost:8080\r\n
22+
X-Test : value\r\n
23+
\r\n
24+
```
25+
26+
Note the space between `X-Test` and the colon.
27+
28+
1929
## What the RFC says
2030

2131
> "No whitespace is allowed between the field name and colon. In the past, differences in the handling of such whitespace have led to security vulnerabilities in request routing and response handling. A server **MUST** reject, with a response status code of 400 (Bad Request), any received request message that contains whitespace between a header field name and colon."

docs/content/docs/headers/whitespace-before-headers.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,16 @@ weight: 6
1616

1717
A request with whitespace (SP) before the first header line, between the request-line and the headers.
1818

19+
```http
20+
GET / HTTP/1.1\r\n
21+
\r\n
22+
Host: localhost:8080\r\n
23+
\r\n
24+
```
25+
26+
A line with a single space appears between the request-line and the first header.
27+
28+
1929
## What the RFC says
2030

2131
> "A recipient that receives whitespace between the start-line and the first header field MUST either reject the message as invalid or consume each whitespace-preceded line without further processing of it." — RFC 9112 Section 2.2

docs/content/docs/host-header/duplicate-host-same.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,16 @@ weight: 3
1616

1717
A request with two identical Host headers.
1818

19+
```http
20+
GET / HTTP/1.1\r\n
21+
Host: localhost:8080\r\n
22+
Host: localhost:8080\r\n
23+
\r\n
24+
```
25+
26+
Two `Host` headers with identical values.
27+
28+
1929
## What the RFC says
2030

2131
> "A server MUST respond with a 400 (Bad Request) status code to any HTTP/1.1 request message that... contains more than one Host header field line..." — RFC 9112 Section 3.2

0 commit comments

Comments
 (0)