summaryrefslogtreecommitdiffstats
path: root/llhttp/test/response/invalid.md
blob: 034fc4d9e30097b8e1165aa34266c0a9e0310e63 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
Invalid responses
=================

### Incomplete HTTP protocol

<!-- meta={"type": "response"} -->
```http
HTP/1.1 200 OK


```

```log
off=0 message begin
off=2 error code=8 reason="Expected HTTP/"
```

### Extra digit in HTTP major version

<!-- meta={"type": "response"} -->
```http
HTTP/01.1 200 OK


```

```log
off=0 message begin
off=5 len=1 span[version]="0"
off=6 error code=9 reason="Expected dot"
```

### Extra digit in HTTP major version #2

<!-- meta={"type": "response"} -->
```http
HTTP/11.1 200 OK


```

```log
off=0 message begin
off=5 len=1 span[version]="1"
off=6 error code=9 reason="Expected dot"
```

### Extra digit in HTTP minor version

<!-- meta={"type": "response"} -->
```http
HTTP/1.01 200 OK


```

```log
off=0 message begin
off=5 len=3 span[version]="1.0"
off=8 version complete
off=8 error code=9 reason="Expected space after version"
```
-->

### Tab after HTTP version

<!-- meta={"type": "response"} -->
```http
HTTP/1.1\t200 OK


```

```log
off=0 message begin
off=5 len=3 span[version]="1.1"
off=8 version complete
off=8 error code=9 reason="Expected space after version"
```

### CR before response and tab after HTTP version

<!-- meta={"type": "response"} -->
```http
\rHTTP/1.1\t200 OK


```

```log
off=1 message begin
off=6 len=3 span[version]="1.1"
off=9 version complete
off=9 error code=9 reason="Expected space after version"
```

### Headers separated by CR

<!-- meta={"type": "response"} -->
```http
HTTP/1.1 200 OK
Foo: 1\rBar: 2


```

```log
off=0 message begin
off=5 len=3 span[version]="1.1"
off=8 version complete
off=13 len=2 span[status]="OK"
off=17 status complete
off=17 len=3 span[header_field]="Foo"
off=21 header_field complete
off=22 len=1 span[header_value]="1"
off=24 error code=3 reason="Missing expected LF after header value"
```

### Invalid HTTP version

<!-- meta={"type": "response"} -->
```http
HTTP/5.6 200 OK


```

```log
off=0 message begin
off=5 len=3 span[version]="5.6"
off=8 error code=9 reason="Invalid HTTP version"
```

## Invalid space after start line

<!-- meta={"type": "response"} -->
```http
HTTP/1.1 200 OK
 Host: foo
```

```log
off=0 message begin
off=5 len=3 span[version]="1.1"
off=8 version complete
off=13 len=2 span[status]="OK"
off=17 status complete
off=18 error code=30 reason="Unexpected space after start line"
```

### Extra space between HTTP version and status code

<!-- meta={"type": "response"} -->
```http
HTTP/1.1  200 OK


```

```log
off=0 message begin
off=5 len=3 span[version]="1.1"
off=8 version complete
off=9 error code=13 reason="Invalid status code"
```

### Extra space between status code and reason

<!-- meta={"type": "response"} -->
```http
HTTP/1.1 200  OK


```

```log
off=0 message begin
off=5 len=3 span[version]="1.1"
off=8 version complete
off=13 len=3 span[status]=" OK"
off=18 status complete
off=20 headers complete status=200 v=1/1 flags=0 content_length=0
```

### One-digit status code

<!-- meta={"type": "response"} -->
```http
HTTP/1.1 2 OK


```

```log
off=0 message begin
off=5 len=3 span[version]="1.1"
off=8 version complete
off=10 error code=13 reason="Invalid status code"
```

### Only LFs present and no body

<!-- meta={"type": "response"} -->
```http
HTTP/1.1 200 OK\nContent-Length: 0\n\n
```

```log
off=0 message begin
off=5 len=3 span[version]="1.1"
off=8 version complete
off=13 len=2 span[status]="OK"
off=16 error code=25 reason="Missing expected CR after response line"
```

### Only LFs present and no body (lenient)

<!-- meta={"type": "response-lenient-all"} -->
```http
HTTP/1.1 200 OK\nContent-Length: 0\n\n
```

```log
off=0 message begin
off=5 len=3 span[version]="1.1"
off=8 version complete
off=13 len=2 span[status]="OK"
off=16 status complete
off=16 len=14 span[header_field]="Content-Length"
off=31 header_field complete
off=32 len=1 span[header_value]="0"
off=34 header_value complete
off=35 headers complete status=200 v=1/1 flags=20 content_length=0
off=35 message complete
```

### Only LFs present

<!-- meta={"type": "response"} -->
```http
HTTP/1.1 200 OK\n\
Foo: abc\n\
Bar: def\n\
\n\
BODY\n\
```

```log
off=0 message begin
off=5 len=3 span[version]="1.1"
off=8 version complete
off=13 len=2 span[status]="OK"
off=16 error code=25 reason="Missing expected CR after response line"
```

### Only LFs present (lenient)

<!-- meta={"type": "response-lenient-all"} -->
```http
HTTP/1.1 200 OK\n\
Foo: abc\n\
Bar: def\n\
\n\
BODY\n\
```

```log
off=0 message begin
off=5 len=3 span[version]="1.1"
off=8 version complete
off=13 len=2 span[status]="OK"
off=16 status complete
off=16 len=3 span[header_field]="Foo"
off=20 header_field complete
off=21 len=3 span[header_value]="abc"
off=25 header_value complete
off=25 len=3 span[header_field]="Bar"
off=29 header_field complete
off=30 len=3 span[header_value]="def"
off=34 header_value complete
off=35 headers complete status=200 v=1/1 flags=0 content_length=0
off=35 len=4 span[body]="BODY"
off=39 len=1 span[body]=lf
off=40 len=1 span[body]="\"
```