Debian Codegraph @

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

raw
1 Connection header
2 =================
3
4 ## Proxy-Connection
5
6 <!-- meta={"type": "response"} -->
7 ```http
8 HTTP/1.1 200 OK
9 Content-Type: text/html; charset=UTF-8
10 Content-Length: 11
11 Proxy-Connection: close
12 Date: Thu, 31 Dec 2009 20:55:48 +0000
13
14 hello world
15 ```
16
17 ```log
18 off=0 message begin
19 off=5 len=3 span[version]="1.1"
20 off=8 version complete
21 off=13 len=2 span[status]="OK"
22 off=17 status complete
23 off=17 len=12 span[header_field]="Content-Type"
24 off=30 header_field complete
25 off=31 len=24 span[header_value]="text/html; charset=UTF-8"
26 off=57 header_value complete
27 off=57 len=14 span[header_field]="Content-Length"
28 off=72 header_field complete
29 off=73 len=2 span[header_value]="11"
30 off=77 header_value complete
31 off=77 len=16 span[header_field]="Proxy-Connection"
32 off=94 header_field complete
33 off=95 len=5 span[header_value]="close"
34 off=102 header_value complete
35 off=102 len=4 span[header_field]="Date"
36 off=107 header_field complete
37 off=108 len=31 span[header_value]="Thu, 31 Dec 2009 20:55:48 +0000"
38 off=141 header_value complete
39 off=143 headers complete status=200 v=1/1 flags=22 content_length=11
40 off=143 len=11 span[body]="hello world"
41 off=154 message complete
42 ```
43
44 ## HTTP/1.0 with keep-alive and EOF-terminated 200 status
45
46 There is no `Content-Length` in this response, so even though the
47 `keep-alive` is on - it should read until EOF.
48
49 <!-- meta={"type": "response"} -->
50 ```http
51 HTTP/1.0 200 OK
52 Connection: keep-alive
53
54 HTTP/1.0 200 OK
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=13 len=2 span[status]="OK"
62 off=17 status complete
63 off=17 len=10 span[header_field]="Connection"
64 off=28 header_field complete
65 off=29 len=10 span[header_value]="keep-alive"
66 off=41 header_value complete
67 off=43 headers complete status=200 v=1/0 flags=1 content_length=0
68 off=43 len=15 span[body]="HTTP/1.0 200 OK"
69 ```
70
71 ## HTTP/1.0 with keep-alive and 204 status
72
73 Responses with `204` status cannot have a body.
74
75 <!-- meta={"type": "response"} -->
76 ```http
77 HTTP/1.0 204 No content
78 Connection: keep-alive
79
80 HTTP/1.0 200 OK
81 ```
82
83 ```log
84 off=0 message begin
85 off=5 len=3 span[version]="1.0"
86 off=8 version complete
87 off=13 len=10 span[status]="No content"
88 off=25 status complete
89 off=25 len=10 span[header_field]="Connection"
90 off=36 header_field complete
91 off=37 len=10 span[header_value]="keep-alive"
92 off=49 header_value complete
93 off=51 headers complete status=204 v=1/0 flags=1 content_length=0
94 off=51 message complete
95 off=51 reset
96 off=51 message begin
97 off=56 len=3 span[version]="1.0"
98 off=59 version complete
99 off=64 len=2 span[status]="OK"
100 ```
101
102 ## HTTP/1.1 with EOF-terminated 200 status
103
104 There is no `Content-Length` in this response, so even though the
105 `keep-alive` is on (implicitly in HTTP 1.1) - it should read until EOF.
106
107 <!-- meta={"type": "response"} -->
108 ```http
109 HTTP/1.1 200 OK
110
111 HTTP/1.1 200 OK
112 ```
113
114 ```log
115 off=0 message begin
116 off=5 len=3 span[version]="1.1"
117 off=8 version complete
118 off=13 len=2 span[status]="OK"
119 off=17 status complete
120 off=19 headers complete status=200 v=1/1 flags=0 content_length=0
121 off=19 len=15 span[body]="HTTP/1.1 200 OK"
122 ```
123
124 ## HTTP/1.1 with 204 status
125
126 Responses with `204` status cannot have a body.
127
128 <!-- meta={"type": "response"} -->
129 ```http
130 HTTP/1.1 204 No content
131
132 HTTP/1.1 200 OK
133 ```
134
135 ```log
136 off=0 message begin
137 off=5 len=3 span[version]="1.1"
138 off=8 version complete
139 off=13 len=10 span[status]="No content"
140 off=25 status complete
141 off=27 headers complete status=204 v=1/1 flags=0 content_length=0
142 off=27 message complete
143 off=27 reset
144 off=27 message begin
145 off=32 len=3 span[version]="1.1"
146 off=35 version complete
147 off=40 len=2 span[status]="OK"
148 ```
149
150 ## HTTP/1.1 with keep-alive disabled and 204 status
151
152 <!-- meta={"type": "response" } -->
153 ```http
154 HTTP/1.1 204 No content
155 Connection: close
156
157 HTTP/1.1 200 OK
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=13 len=10 span[status]="No content"
165 off=25 status complete
166 off=25 len=10 span[header_field]="Connection"
167 off=36 header_field complete
168 off=37 len=5 span[header_value]="close"
169 off=44 header_value complete
170 off=46 headers complete status=204 v=1/1 flags=2 content_length=0
171 off=46 message complete
172 off=47 error code=5 reason="Data after `Connection: close`"
173 ```
174
175 ## HTTP/1.1 with keep-alive disabled, content-length (lenient)
176
177 Parser should discard extra request in lenient mode.
178
179 <!-- meta={"type": "response-lenient-data-after-close" } -->
180 ```http
181 HTTP/1.1 200 No content
182 Content-Length: 5
183 Connection: close
184
185 2ad731e3-4dcd-4f70-b871-0ad284b29ffc
186 ```
187
188 ```log
189 off=0 message begin
190 off=5 len=3 span[version]="1.1"
191 off=8 version complete
192 off=13 len=10 span[status]="No content"
193 off=25 status complete
194 off=25 len=14 span[header_field]="Content-Length"
195 off=40 header_field complete
196 off=41 len=1 span[header_value]="5"
197 off=44 header_value complete
198 off=44 len=10 span[header_field]="Connection"
199 off=55 header_field complete
200 off=56 len=5 span[header_value]="close"
201 off=63 header_value complete
202 off=65 headers complete status=200 v=1/1 flags=22 content_length=5
203 off=65 len=5 span[body]="2ad73"
204 off=70 message complete
205 ```
206
207 ## HTTP/1.1 with keep-alive disabled, content-length
208
209 Parser should discard extra request in strict mode.
210
211 <!-- meta={"type": "response" } -->
212 ```http
213 HTTP/1.1 200 No content
214 Content-Length: 5
215 Connection: close
216
217 2ad731e3-4dcd-4f70-b871-0ad284b29ffc
218 ```
219
220 ```log
221 off=0 message begin
222 off=5 len=3 span[version]="1.1"
223 off=8 version complete
224 off=13 len=10 span[status]="No content"
225 off=25 status complete
226 off=25 len=14 span[header_field]="Content-Length"
227 off=40 header_field complete
228 off=41 len=1 span[header_value]="5"
229 off=44 header_value complete
230 off=44 len=10 span[header_field]="Connection"
231 off=55 header_field complete
232 off=56 len=5 span[header_value]="close"
233 off=63 header_value complete
234 off=65 headers complete status=200 v=1/1 flags=22 content_length=5
235 off=65 len=5 span[body]="2ad73"
236 off=70 message complete
237 off=71 error code=5 reason="Data after `Connection: close`"
238 ```
239
240 ## HTTP/1.1 with keep-alive disabled and 204 status (lenient)
241
242 <!-- meta={"type": "response-lenient-keep-alive"} -->
243 ```http
244 HTTP/1.1 204 No content
245 Connection: close
246
247 HTTP/1.1 200 OK
248 ```
249
250 ```log
251 off=0 message begin
252 off=5 len=3 span[version]="1.1"
253 off=8 version complete
254 off=13 len=10 span[status]="No content"
255 off=25 status complete
256 off=25 len=10 span[header_field]="Connection"
257 off=36 header_field complete
258 off=37 len=5 span[header_value]="close"
259 off=44 header_value complete
260 off=46 headers complete status=204 v=1/1 flags=2 content_length=0
261 off=46 message complete
262 off=46 reset
263 off=46 message begin
264 off=51 len=3 span[version]="1.1"
265 off=54 version complete
266 off=59 len=2 span[status]="OK"
267 ```
268
269 ## HTTP 101 response with Upgrade and Content-Length header
270
271 <!-- meta={"type": "response"} -->
272 ```http
273 HTTP/1.1 101 Switching Protocols
274 Connection: upgrade
275 Upgrade: h2c
276 Content-Length: 4
277
278 body\
279 proto
280 ```
281
282 ```log
283 off=0 message begin
284 off=5 len=3 span[version]="1.1"
285 off=8 version complete
286 off=13 len=19 span[status]="Switching Protocols"
287 off=34 status complete
288 off=34 len=10 span[header_field]="Connection"
289 off=45 header_field complete
290 off=46 len=7 span[header_value]="upgrade"
291 off=55 header_value complete
292 off=55 len=7 span[header_field]="Upgrade"
293 off=63 header_field complete
294 off=64 len=3 span[header_value]="h2c"
295 off=69 header_value complete
296 off=69 len=14 span[header_field]="Content-Length"
297 off=84 header_field complete
298 off=85 len=1 span[header_value]="4"
299 off=88 header_value complete
300 off=90 headers complete status=101 v=1/1 flags=34 content_length=4
301 off=90 message complete
302 off=90 error code=22 reason="Pause on CONNECT/Upgrade"
303 ```
304
305 ## HTTP 101 response with Upgrade and Transfer-Encoding header
306
307 <!-- meta={"type": "response"} -->
308 ```http
309 HTTP/1.1 101 Switching Protocols
310 Connection: upgrade
311 Upgrade: h2c
312 Transfer-Encoding: chunked
313
314 2
315 bo
316 2
317 dy
318 0
319
320 proto
321 ```
322
323 ```log
324 off=0 message begin
325 off=5 len=3 span[version]="1.1"
326 off=8 version complete
327 off=13 len=19 span[status]="Switching Protocols"
328 off=34 status complete
329 off=34 len=10 span[header_field]="Connection"
330 off=45 header_field complete
331 off=46 len=7 span[header_value]="upgrade"
332 off=55 header_value complete
333 off=55 len=7 span[header_field]="Upgrade"
334 off=63 header_field complete
335 off=64 len=3 span[header_value]="h2c"
336 off=69 header_value complete
337 off=69 len=17 span[header_field]="Transfer-Encoding"
338 off=87 header_field complete
339 off=88 len=7 span[header_value]="chunked"
340 off=97 header_value complete
341 off=99 headers complete status=101 v=1/1 flags=21c content_length=0
342 off=99 message complete
343 off=99 error code=22 reason="Pause on CONNECT/Upgrade"
344 ```
345
346 ## HTTP 200 response with Upgrade header
347
348 <!-- meta={"type": "response"} -->
349 ```http
350 HTTP/1.1 200 OK
351 Connection: upgrade
352 Upgrade: h2c
353
354 body
355 ```
356
357 ```log
358 off=0 message begin
359 off=5 len=3 span[version]="1.1"
360 off=8 version complete
361 off=13 len=2 span[status]="OK"
362 off=17 status complete
363 off=17 len=10 span[header_field]="Connection"
364 off=28 header_field complete
365 off=29 len=7 span[header_value]="upgrade"
366 off=38 header_value complete
367 off=38 len=7 span[header_field]="Upgrade"
368 off=46 header_field complete
369 off=47 len=3 span[header_value]="h2c"
370 off=52 header_value complete
371 off=54 headers complete status=200 v=1/1 flags=14 content_length=0
372 off=54 len=4 span[body]="body"
373 ```
374
375 ## HTTP 200 response with Upgrade header and Content-Length
376
377 <!-- meta={"type": "response"} -->
378 ```http
379 HTTP/1.1 200 OK
380 Connection: upgrade
381 Upgrade: h2c
382 Content-Length: 4
383
384 body
385 ```
386
387 ```log
388 off=0 message begin
389 off=5 len=3 span[version]="1.1"
390 off=8 version complete
391 off=13 len=2 span[status]="OK"
392 off=17 status complete
393 off=17 len=10 span[header_field]="Connection"
394 off=28 header_field complete
395 off=29 len=7 span[header_value]="upgrade"
396 off=38 header_value complete
397 off=38 len=7 span[header_field]="Upgrade"
398 off=46 header_field complete
399 off=47 len=3 span[header_value]="h2c"
400 off=52 header_value complete
401 off=52 len=14 span[header_field]="Content-Length"
402 off=67 header_field complete
403 off=68 len=1 span[header_value]="4"
404 off=71 header_value complete
405 off=73 headers complete status=200 v=1/1 flags=34 content_length=4
406 off=73 len=4 span[body]="body"
407 off=77 message complete
408 ```
409
410 ## HTTP 200 response with Upgrade header and Transfer-Encoding
411
412 <!-- meta={"type": "response"} -->
413 ```http
414 HTTP/1.1 200 OK
415 Connection: upgrade
416 Upgrade: h2c
417 Transfer-Encoding: chunked
418
419 2
420 bo
421 2
422 dy
423 0
424
425
426 ```
427
428 ```log
429 off=0 message begin
430 off=5 len=3 span[version]="1.1"
431 off=8 version complete
432 off=13 len=2 span[status]="OK"
433 off=17 status complete
434 off=17 len=10 span[header_field]="Connection"
435 off=28 header_field complete
436 off=29 len=7 span[header_value]="upgrade"
437 off=38 header_value complete
438 off=38 len=7 span[header_field]="Upgrade"
439 off=46 header_field complete
440 off=47 len=3 span[header_value]="h2c"
441 off=52 header_value complete
442 off=52 len=17 span[header_field]="Transfer-Encoding"
443 off=70 header_field complete
444 off=71 len=7 span[header_value]="chunked"
445 off=80 header_value complete
446 off=82 headers complete status=200 v=1/1 flags=21c content_length=0
447 off=85 chunk header len=2
448 off=85 len=2 span[body]="bo"
449 off=89 chunk complete
450 off=92 chunk header len=2
451 off=92 len=2 span[body]="dy"
452 off=96 chunk complete
453 off=99 chunk header len=0
454 off=101 chunk complete
455 off=101 message complete
456 ```
457
458 ## HTTP 304 with Content-Length
459
460 <!-- meta={"type": "response"} -->
461 ```http
462 HTTP/1.1 304 Not Modified
463 Content-Length: 10
464
465
466 HTTP/1.1 200 OK
467 Content-Length: 5
468
469 hello
470 ```
471
472 ```log
473 off=0 message begin
474 off=5 len=3 span[version]="1.1"
475 off=8 version complete
476 off=13 len=12 span[status]="Not Modified"
477 off=27 status complete
478 off=27 len=14 span[header_field]="Content-Length"
479 off=42 header_field complete
480 off=43 len=2 span[header_value]="10"
481 off=47 header_value complete
482 off=49 headers complete status=304 v=1/1 flags=20 content_length=10
483 off=49 message complete
484 off=51 reset
485 off=51 message begin
486 off=56 len=3 span[version]="1.1"
487 off=59 version complete
488 off=64 len=2 span[status]="OK"
489 off=68 status complete
490 off=68 len=14 span[header_field]="Content-Length"
491 off=83 header_field complete
492 off=84 len=1 span[header_value]="5"
493 off=87 header_value complete
494 off=89 headers complete status=200 v=1/1 flags=20 content_length=5
495 off=89 len=5 span[body]="hello"
496 off=94 message complete
497 ```
498
499 ## HTTP 304 with Transfer-Encoding
500
501 <!-- meta={"type": "response"} -->
502 ```http
503 HTTP/1.1 304 Not Modified
504 Transfer-Encoding: chunked
505
506 HTTP/1.1 200 OK
507 Transfer-Encoding: chunked
508
509 5
510 hello
511 0
512
513 ```
514
515 ```log
516 off=0 message begin
517 off=5 len=3 span[version]="1.1"
518 off=8 version complete
519 off=13 len=12 span[status]="Not Modified"
520 off=27 status complete
521 off=27 len=17 span[header_field]="Transfer-Encoding"
522 off=45 header_field complete
523 off=46 len=7 span[header_value]="chunked"
524 off=55 header_value complete
525 off=57 headers complete status=304 v=1/1 flags=208 content_length=0
526 off=57 message complete
527 off=57 reset
528 off=57 message begin
529 off=62 len=3 span[version]="1.1"
530 off=65 version complete
531 off=70 len=2 span[status]="OK"
532 off=74 status complete
533 off=74 len=17 span[header_field]="Transfer-Encoding"
534 off=92 header_field complete
535 off=93 len=7 span[header_value]="chunked"
536 off=102 header_value complete
537 off=104 headers complete status=200 v=1/1 flags=208 content_length=0
538 off=107 chunk header len=5
539 off=107 len=5 span[body]="hello"
540 off=114 chunk complete
541 off=117 chunk header len=0
542 ```
543
544 ## HTTP 100 first, then 400
545
546 <!-- meta={"type": "response"} -->
547 ```http
548 HTTP/1.1 100 Continue
549
550
551 HTTP/1.1 404 Not Found
552 Content-Type: text/plain; charset=utf-8
553 Content-Length: 14
554 Date: Fri, 15 Sep 2023 19:47:23 GMT
555 Server: Python/3.10 aiohttp/4.0.0a2.dev0
556
557 404: Not Found
558 ```
559
560 ```log
561 off=0 message begin
562 off=5 len=3 span[version]="1.1"
563 off=8 version complete
564 off=13 len=8 span[status]="Continue"
565 off=23 status complete
566 off=25 headers complete status=100 v=1/1 flags=0 content_length=0
567 off=25 message complete
568 off=27 reset
569 off=27 message begin
570 off=32 len=3 span[version]="1.1"
571 off=35 version complete
572 off=40 len=9 span[status]="Not Found"
573 off=51 status complete
574 off=51 len=12 span[header_field]="Content-Type"
575 off=64 header_field complete
576 off=65 len=25 span[header_value]="text/plain; charset=utf-8"
577 off=92 header_value complete
578 off=92 len=14 span[header_field]="Content-Length"
579 off=107 header_field complete
580 off=108 len=2 span[header_value]="14"
581 off=112 header_value complete
582 off=112 len=4 span[header_field]="Date"
583 off=117 header_field complete
584 off=118 len=29 span[header_value]="Fri, 15 Sep 2023 19:47:23 GMT"
585 off=149 header_value complete
586 off=149 len=6 span[header_field]="Server"
587 off=156 header_field complete
588 off=157 len=32 span[header_value]="Python/3.10 aiohttp/4.0.0a2.dev0"
589 off=191 header_value complete
590 off=193 headers complete status=404 v=1/1 flags=20 content_length=14
591 off=193 len=14 span[body]="404: Not Found"
592 off=207 message complete
593 ```
594
595 ## HTTP 103 first, then 200
596
597 <!-- meta={"type": "response"} -->
598 ```http
599 HTTP/1.1 103 Early Hints
600 Link: </styles.css>; rel=preload; as=style
601
602 HTTP/1.1 200 OK
603 Date: Wed, 13 Sep 2023 11:09:41 GMT
604 Connection: keep-alive
605 Keep-Alive: timeout=5
606 Content-Length: 17
607
608 response content
609 ```
610
611 ```log
612 off=0 message begin
613 off=5 len=3 span[version]="1.1"
614 off=8 version complete
615 off=13 len=11 span[status]="Early Hints"
616 off=26 status complete
617 off=26 len=4 span[header_field]="Link"
618 off=31 header_field complete
619 off=32 len=36 span[header_value]="</styles.css>; rel=preload; as=style"
620 off=70 header_value complete
621 off=72 headers complete status=103 v=1/1 flags=0 content_length=0
622 off=72 message complete
623 off=72 reset
624 off=72 message begin
625 off=77 len=3 span[version]="1.1"
626 off=80 version complete
627 off=85 len=2 span[status]="OK"
628 off=89 status complete
629 off=89 len=4 span[header_field]="Date"
630 off=94 header_field complete
631 off=95 len=29 span[header_value]="Wed, 13 Sep 2023 11:09:41 GMT"
632 off=126 header_value complete
633 off=126 len=10 span[header_field]="Connection"
634 off=137 header_field complete
635 off=138 len=10 span[header_value]="keep-alive"
636 off=150 header_value complete
637 off=150 len=10 span[header_field]="Keep-Alive"
638 off=161 header_field complete
639 off=162 len=9 span[header_value]="timeout=5"
640 off=173 header_value complete
641 off=173 len=14 span[header_field]="Content-Length"
642 off=188 header_field complete
643 off=189 len=2 span[header_value]="17"
644 off=193 header_value complete
645 off=195 headers complete status=200 v=1/1 flags=21 content_length=17
646 off=195 len=16 span[body]="response content"
647 ```