Debian Codegraph @

third_party/python/aiohttp/vendor/llhttp/test/response/invalid.md

raw
1 Invalid responses
2 =================
3
4 ### Incomplete HTTP protocol
5
6 <!-- meta={"type": "response"} -->
7 ```http
8 HTP/1.1 200 OK
9
10
11 ```
12
13 ```log
14 off=0 message begin
15 off=2 error code=8 reason="Expected HTTP/"
16 ```
17
18 ### Extra digit in HTTP major version
19
20 <!-- meta={"type": "response"} -->
21 ```http
22 HTTP/01.1 200 OK
23
24
25 ```
26
27 ```log
28 off=0 message begin
29 off=5 len=1 span[version]="0"
30 off=6 error code=9 reason="Expected dot"
31 ```
32
33 ### Extra digit in HTTP major version #2
34
35 <!-- meta={"type": "response"} -->
36 ```http
37 HTTP/11.1 200 OK
38
39
40 ```
41
42 ```log
43 off=0 message begin
44 off=5 len=1 span[version]="1"
45 off=6 error code=9 reason="Expected dot"
46 ```
47
48 ### Extra digit in HTTP minor version
49
50 <!-- meta={"type": "response"} -->
51 ```http
52 HTTP/1.01 200 OK
53
54
55 ```
56
57 ```log
58 off=0 message begin
59 off=5 len=3 span[version]="1.0"
60 off=8 version complete
61 off=8 error code=9 reason="Expected space after version"
62 ```
63 -->
64
65 ### Tab after HTTP version
66
67 <!-- meta={"type": "response"} -->
68 ```http
69 HTTP/1.1\t200 OK
70
71
72 ```
73
74 ```log
75 off=0 message begin
76 off=5 len=3 span[version]="1.1"
77 off=8 version complete
78 off=8 error code=9 reason="Expected space after version"
79 ```
80
81 ### CR before response and tab after HTTP version
82
83 <!-- meta={"type": "response"} -->
84 ```http
85 \rHTTP/1.1\t200 OK
86
87
88 ```
89
90 ```log
91 off=1 message begin
92 off=6 len=3 span[version]="1.1"
93 off=9 version complete
94 off=9 error code=9 reason="Expected space after version"
95 ```
96
97 ### Headers separated by CR
98
99 <!-- meta={"type": "response"} -->
100 ```http
101 HTTP/1.1 200 OK
102 Foo: 1\rBar: 2
103
104
105 ```
106
107 ```log
108 off=0 message begin
109 off=5 len=3 span[version]="1.1"
110 off=8 version complete
111 off=13 len=2 span[status]="OK"
112 off=17 status complete
113 off=17 len=3 span[header_field]="Foo"
114 off=21 header_field complete
115 off=22 len=1 span[header_value]="1"
116 off=24 error code=3 reason="Missing expected LF after header value"
117 ```
118
119 ### Invalid HTTP version
120
121 <!-- meta={"type": "response"} -->
122 ```http
123 HTTP/5.6 200 OK
124
125
126 ```
127
128 ```log
129 off=0 message begin
130 off=5 len=3 span[version]="5.6"
131 off=8 error code=9 reason="Invalid HTTP version"
132 ```
133
134 ## Invalid space after start line
135
136 <!-- meta={"type": "response"} -->
137 ```http
138 HTTP/1.1 200 OK
139 Host: foo
140 ```
141
142 ```log
143 off=0 message begin
144 off=5 len=3 span[version]="1.1"
145 off=8 version complete
146 off=13 len=2 span[status]="OK"
147 off=17 status complete
148 off=18 error code=30 reason="Unexpected space after start line"
149 ```
150
151 ### Extra space between HTTP version and status code
152
153 <!-- meta={"type": "response"} -->
154 ```http
155 HTTP/1.1 200 OK
156
157
158 ```
159
160 ```log
161 off=0 message begin
162 off=5 len=3 span[version]="1.1"
163 off=8 version complete
164 off=9 error code=13 reason="Invalid status code"
165 ```
166
167 ### Extra space between status code and reason
168
169 <!-- meta={"type": "response"} -->
170 ```http
171 HTTP/1.1 200 OK
172
173
174 ```
175
176 ```log
177 off=0 message begin
178 off=5 len=3 span[version]="1.1"
179 off=8 version complete
180 off=13 len=3 span[status]=" OK"
181 off=18 status complete
182 off=20 headers complete status=200 v=1/1 flags=0 content_length=0
183 ```
184
185 ### One-digit status code
186
187 <!-- meta={"type": "response"} -->
188 ```http
189 HTTP/1.1 2 OK
190
191
192 ```
193
194 ```log
195 off=0 message begin
196 off=5 len=3 span[version]="1.1"
197 off=8 version complete
198 off=10 error code=13 reason="Invalid status code"
199 ```
200
201 ### Only LFs present and no body
202
203 <!-- meta={"type": "response"} -->
204 ```http
205 HTTP/1.1 200 OK\nContent-Length: 0\n\n
206 ```
207
208 ```log
209 off=0 message begin
210 off=5 len=3 span[version]="1.1"
211 off=8 version complete
212 off=13 len=2 span[status]="OK"
213 off=16 error code=25 reason="Missing expected CR after response line"
214 ```
215
216 ### Only LFs present and no body (lenient)
217
218 <!-- meta={"type": "response-lenient-all"} -->
219 ```http
220 HTTP/1.1 200 OK\nContent-Length: 0\n\n
221 ```
222
223 ```log
224 off=0 message begin
225 off=5 len=3 span[version]="1.1"
226 off=8 version complete
227 off=13 len=2 span[status]="OK"
228 off=16 status complete
229 off=16 len=14 span[header_field]="Content-Length"
230 off=31 header_field complete
231 off=32 len=1 span[header_value]="0"
232 off=34 header_value complete
233 off=35 headers complete status=200 v=1/1 flags=20 content_length=0
234 off=35 message complete
235 ```
236
237 ### Only LFs present
238
239 <!-- meta={"type": "response"} -->
240 ```http
241 HTTP/1.1 200 OK\n\
242 Foo: abc\n\
243 Bar: def\n\
244 \n\
245 BODY\n\
246 ```
247
248 ```log
249 off=0 message begin
250 off=5 len=3 span[version]="1.1"
251 off=8 version complete
252 off=13 len=2 span[status]="OK"
253 off=16 error code=25 reason="Missing expected CR after response line"
254 ```
255
256 ### Only LFs present (lenient)
257
258 <!-- meta={"type": "response-lenient-all"} -->
259 ```http
260 HTTP/1.1 200 OK\n\
261 Foo: abc\n\
262 Bar: def\n\
263 \n\
264 BODY\n\
265 ```
266
267 ```log
268 off=0 message begin
269 off=5 len=3 span[version]="1.1"
270 off=8 version complete
271 off=13 len=2 span[status]="OK"
272 off=16 status complete
273 off=16 len=3 span[header_field]="Foo"
274 off=20 header_field complete
275 off=21 len=3 span[header_value]="abc"
276 off=25 header_value complete
277 off=25 len=3 span[header_field]="Bar"
278 off=29 header_field complete
279 off=30 len=3 span[header_value]="def"
280 off=34 header_value complete
281 off=35 headers complete status=200 v=1/1 flags=0 content_length=0
282 off=35 len=4 span[body]="BODY"
283 off=39 len=1 span[body]=lf
284 off=40 len=1 span[body]="\"
285 ```