Debian Codegraph @

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

raw
1 Sample responses
2 ================
3
4 ## Simple response
5
6 <!-- meta={"type": "response"} -->
7 ```http
8 HTTP/1.1 200 OK
9 Header1: Value1
10 Header2:\t Value2
11 Content-Length: 0
12
13
14 ```
15
16 ```log
17 off=0 message begin
18 off=5 len=3 span[version]="1.1"
19 off=8 version complete
20 off=13 len=2 span[status]="OK"
21 off=17 status complete
22 off=17 len=7 span[header_field]="Header1"
23 off=25 header_field complete
24 off=26 len=6 span[header_value]="Value1"
25 off=34 header_value complete
26 off=34 len=7 span[header_field]="Header2"
27 off=42 header_field complete
28 off=44 len=6 span[header_value]="Value2"
29 off=52 header_value complete
30 off=52 len=14 span[header_field]="Content-Length"
31 off=67 header_field complete
32 off=68 len=1 span[header_value]="0"
33 off=71 header_value complete
34 off=73 headers complete status=200 v=1/1 flags=20 content_length=0
35 off=73 message complete
36 ```
37
38 ## Error on invalid response start
39
40 Every response must start with `HTTP/`.
41
42 <!-- meta={"type": "response"} -->
43 ```http
44 HTTPER/1.1 200 OK
45
46
47 ```
48
49 ```log
50 off=0 message begin
51 off=4 error code=8 reason="Expected HTTP/"
52 ```
53
54 ## Empty body should not trigger spurious span callbacks
55
56 <!-- meta={"type": "response"} -->
57 ```http
58 HTTP/1.1 200 OK
59
60
61 ```
62
63 ```log
64 off=0 message begin
65 off=5 len=3 span[version]="1.1"
66 off=8 version complete
67 off=13 len=2 span[status]="OK"
68 off=17 status complete
69 off=19 headers complete status=200 v=1/1 flags=0 content_length=0
70 ```
71
72 ## Google 301
73
74 <!-- meta={"type": "response"} -->
75 ```http
76 HTTP/1.1 301 Moved Permanently
77 Location: http://www.google.com/
78 Content-Type: text/html; charset=UTF-8
79 Date: Sun, 26 Apr 2009 11:11:49 GMT
80 Expires: Tue, 26 May 2009 11:11:49 GMT
81 X-$PrototypeBI-Version: 1.6.0.3
82 Cache-Control: public, max-age=2592000
83 Server: gws
84 Content-Length: 219
85
86 <HTML><HEAD><meta http-equiv=content-type content=text/html;charset=utf-8>\n\
87 <TITLE>301 Moved</TITLE></HEAD><BODY>\n\
88 <H1>301 Moved</H1>\n\
89 The document has moved\n\
90 <A HREF="http://www.google.com/">here</A>.
91 </BODY></HTML>
92 ```
93 _(Note the `$` char in header field)_
94
95 ```log
96 off=0 message begin
97 off=5 len=3 span[version]="1.1"
98 off=8 version complete
99 off=13 len=17 span[status]="Moved Permanently"
100 off=32 status complete
101 off=32 len=8 span[header_field]="Location"
102 off=41 header_field complete
103 off=42 len=22 span[header_value]="http://www.google.com/"
104 off=66 header_value complete
105 off=66 len=12 span[header_field]="Content-Type"
106 off=79 header_field complete
107 off=80 len=24 span[header_value]="text/html; charset=UTF-8"
108 off=106 header_value complete
109 off=106 len=4 span[header_field]="Date"
110 off=111 header_field complete
111 off=112 len=29 span[header_value]="Sun, 26 Apr 2009 11:11:49 GMT"
112 off=143 header_value complete
113 off=143 len=7 span[header_field]="Expires"
114 off=151 header_field complete
115 off=152 len=29 span[header_value]="Tue, 26 May 2009 11:11:49 GMT"
116 off=183 header_value complete
117 off=183 len=22 span[header_field]="X-$PrototypeBI-Version"
118 off=206 header_field complete
119 off=207 len=7 span[header_value]="1.6.0.3"
120 off=216 header_value complete
121 off=216 len=13 span[header_field]="Cache-Control"
122 off=230 header_field complete
123 off=231 len=23 span[header_value]="public, max-age=2592000"
124 off=256 header_value complete
125 off=256 len=6 span[header_field]="Server"
126 off=263 header_field complete
127 off=264 len=3 span[header_value]="gws"
128 off=269 header_value complete
129 off=269 len=14 span[header_field]="Content-Length"
130 off=284 header_field complete
131 off=286 len=5 span[header_value]="219 "
132 off=293 header_value complete
133 off=295 headers complete status=301 v=1/1 flags=20 content_length=219
134 off=295 len=74 span[body]="<HTML><HEAD><meta http-equiv=content-type content=text/html;charset=utf-8>"
135 off=369 len=1 span[body]=lf
136 off=370 len=37 span[body]="<TITLE>301 Moved</TITLE></HEAD><BODY>"
137 off=407 len=1 span[body]=lf
138 off=408 len=18 span[body]="<H1>301 Moved</H1>"
139 off=426 len=1 span[body]=lf
140 off=427 len=22 span[body]="The document has moved"
141 off=449 len=1 span[body]=lf
142 off=450 len=42 span[body]="<A HREF="http://www.google.com/">here</A>."
143 off=492 len=1 span[body]=cr
144 off=493 len=1 span[body]=lf
145 off=494 len=14 span[body]="</BODY></HTML>"
146 ```
147
148 ## amazon.com
149
150 <!-- meta={"type": "response"} -->
151 ```http
152 HTTP/1.1 301 MovedPermanently
153 Date: Wed, 15 May 2013 17:06:33 GMT
154 Server: Server
155 x-amz-id-1: 0GPHKXSJQ826RK7GZEB2
156 p3p: policyref="http://www.amazon.com/w3c/p3p.xml",CP="CAO DSP LAW CUR ADM IVAo IVDo CONo OTPo OUR DELi PUBi OTRi BUS PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA HEA PRE LOC GOV OTC "
157 x-amz-id-2: STN69VZxIFSz9YJLbz1GDbxpbjG6Qjmmq5E3DxRhOUw+Et0p4hr7c/Q8qNcx4oAD
158 Location: http://www.amazon.com/Dan-Brown/e/B000AP9DSU/ref=s9_pop_gw_al1?_encoding=UTF8&refinementId=618073011&pf_rd_m=ATVPDKIKX0DER&pf_rd_s=center-2&pf_rd_r=0SHYY5BZXN3KR20BNFAY&pf_rd_t=101&pf_rd_p=1263340922&pf_rd_i=507846
159 Vary: Accept-Encoding,User-Agent
160 Content-Type: text/html; charset=ISO-8859-1
161 Transfer-Encoding: chunked
162
163 1
164 \n
165 0
166
167
168 ```
169
170 ```log
171 off=0 message begin
172 off=5 len=3 span[version]="1.1"
173 off=8 version complete
174 off=13 len=16 span[status]="MovedPermanently"
175 off=31 status complete
176 off=31 len=4 span[header_field]="Date"
177 off=36 header_field complete
178 off=37 len=29 span[header_value]="Wed, 15 May 2013 17:06:33 GMT"
179 off=68 header_value complete
180 off=68 len=6 span[header_field]="Server"
181 off=75 header_field complete
182 off=76 len=6 span[header_value]="Server"
183 off=84 header_value complete
184 off=84 len=10 span[header_field]="x-amz-id-1"
185 off=95 header_field complete
186 off=96 len=20 span[header_value]="0GPHKXSJQ826RK7GZEB2"
187 off=118 header_value complete
188 off=118 len=3 span[header_field]="p3p"
189 off=122 header_field complete
190 off=123 len=178 span[header_value]="policyref="http://www.amazon.com/w3c/p3p.xml",CP="CAO DSP LAW CUR ADM IVAo IVDo CONo OTPo OUR DELi PUBi OTRi BUS PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA HEA PRE LOC GOV OTC ""
191 off=303 header_value complete
192 off=303 len=10 span[header_field]="x-amz-id-2"
193 off=314 header_field complete
194 off=315 len=64 span[header_value]="STN69VZxIFSz9YJLbz1GDbxpbjG6Qjmmq5E3DxRhOUw+Et0p4hr7c/Q8qNcx4oAD"
195 off=381 header_value complete
196 off=381 len=8 span[header_field]="Location"
197 off=390 header_field complete
198 off=391 len=214 span[header_value]="http://www.amazon.com/Dan-Brown/e/B000AP9DSU/ref=s9_pop_gw_al1?_encoding=UTF8&refinementId=618073011&pf_rd_m=ATVPDKIKX0DER&pf_rd_s=center-2&pf_rd_r=0SHYY5BZXN3KR20BNFAY&pf_rd_t=101&pf_rd_p=1263340922&pf_rd_i=507846"
199 off=607 header_value complete
200 off=607 len=4 span[header_field]="Vary"
201 off=612 header_field complete
202 off=613 len=26 span[header_value]="Accept-Encoding,User-Agent"
203 off=641 header_value complete
204 off=641 len=12 span[header_field]="Content-Type"
205 off=654 header_field complete
206 off=655 len=29 span[header_value]="text/html; charset=ISO-8859-1"
207 off=686 header_value complete
208 off=686 len=17 span[header_field]="Transfer-Encoding"
209 off=704 header_field complete
210 off=705 len=7 span[header_value]="chunked"
211 off=714 header_value complete
212 off=716 headers complete status=301 v=1/1 flags=208 content_length=0
213 off=719 chunk header len=1
214 off=719 len=1 span[body]=lf
215 off=722 chunk complete
216 off=725 chunk header len=0
217 off=727 chunk complete
218 off=727 message complete
219 ```
220
221 ## No headers and no body
222
223 <!-- meta={"type": "response"} -->
224 ```http
225 HTTP/1.1 404 Not Found
226
227
228 ```
229
230 ```log
231 off=0 message begin
232 off=5 len=3 span[version]="1.1"
233 off=8 version complete
234 off=13 len=9 span[status]="Not Found"
235 off=24 status complete
236 off=26 headers complete status=404 v=1/1 flags=0 content_length=0
237 ```
238
239 ## No reason phrase
240
241 <!-- meta={"type": "response"} -->
242 ```http
243 HTTP/1.1 301
244
245
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=14 status complete
253 off=16 headers complete status=301 v=1/1 flags=0 content_length=0
254 ```
255
256 ## Empty reason phrase after space
257
258 <!-- meta={"type": "response"} -->
259 ```http
260 HTTP/1.1 200 \r\n\
261
262
263 ```
264
265 ```log
266 off=0 message begin
267 off=5 len=3 span[version]="1.1"
268 off=8 version complete
269 off=13 len=0 span[status]=""
270 off=15 status complete
271 off=17 headers complete status=200 v=1/1 flags=0 content_length=0
272 ```
273
274 ## No carriage ret
275
276 <!-- meta={"type": "response"} -->
277 ```http
278 HTTP/1.1 200 OK\n\
279 Content-Type: text/html; charset=utf-8\n\
280 Connection: close\n\
281 \n\
282 these headers are from http://news.ycombinator.com/
283 ```
284
285 ```log
286 off=0 message begin
287 off=5 len=3 span[version]="1.1"
288 off=8 version complete
289 off=13 len=2 span[status]="OK"
290 off=16 error code=25 reason="Missing expected CR after response line"
291 ```
292
293 ## No carriage ret (lenient)
294
295 <!-- meta={"type": "response-lenient-optional-cr-before-lf"} -->
296 ```http
297 HTTP/1.1 200 OK\n\
298 Content-Type: text/html; charset=utf-8\n\
299 Connection: close\n\
300 \n\
301 these headers are from http://news.ycombinator.com/
302 ```
303
304 ```log
305 off=0 message begin
306 off=5 len=3 span[version]="1.1"
307 off=8 version complete
308 off=13 len=2 span[status]="OK"
309 off=16 status complete
310 off=16 len=12 span[header_field]="Content-Type"
311 off=29 header_field complete
312 off=30 len=24 span[header_value]="text/html; charset=utf-8"
313 off=55 header_value complete
314 off=55 len=10 span[header_field]="Connection"
315 off=66 header_field complete
316 off=67 len=5 span[header_value]="close"
317 off=73 header_value complete
318 off=74 headers complete status=200 v=1/1 flags=2 content_length=0
319 off=74 len=51 span[body]="these headers are from http://news.ycombinator.com/"
320 ```
321
322 ## Underscore in header key
323
324 Shown by: `curl -o /dev/null -v "http://ad.doubleclick.net/pfadx/DARTSHELLCONFIGXML;dcmt=text/xml;"`
325
326 <!-- meta={"type": "response"} -->
327 ```http
328 HTTP/1.1 200 OK
329 Server: DCLK-AdSvr
330 Content-Type: text/xml
331 Content-Length: 0
332 DCLK_imp: v7;x;114750856;0-0;0;17820020;0/0;21603567/21621457/1;;~okv=;dcmt=text/xml;;~cs=o
333
334
335 ```
336
337 ```log
338 off=0 message begin
339 off=5 len=3 span[version]="1.1"
340 off=8 version complete
341 off=13 len=2 span[status]="OK"
342 off=17 status complete
343 off=17 len=6 span[header_field]="Server"
344 off=24 header_field complete
345 off=25 len=10 span[header_value]="DCLK-AdSvr"
346 off=37 header_value complete
347 off=37 len=12 span[header_field]="Content-Type"
348 off=50 header_field complete
349 off=51 len=8 span[header_value]="text/xml"
350 off=61 header_value complete
351 off=61 len=14 span[header_field]="Content-Length"
352 off=76 header_field complete
353 off=77 len=1 span[header_value]="0"
354 off=80 header_value complete
355 off=80 len=8 span[header_field]="DCLK_imp"
356 off=89 header_field complete
357 off=90 len=81 span[header_value]="v7;x;114750856;0-0;0;17820020;0/0;21603567/21621457/1;;~okv=;dcmt=text/xml;;~cs=o"
358 off=173 header_value complete
359 off=175 headers complete status=200 v=1/1 flags=20 content_length=0
360 off=175 message complete
361 ```
362
363 ## bonjourmadame.fr
364
365 The client should not merge two headers fields when the first one doesn't
366 have a value.
367
368 <!-- meta={"type": "response"} -->
369 ```http
370 HTTP/1.0 301 Moved Permanently
371 Date: Thu, 03 Jun 2010 09:56:32 GMT
372 Server: Apache/2.2.3 (Red Hat)
373 Cache-Control: public
374 Pragma: \r\n\
375 Location: http://www.bonjourmadame.fr/
376 Vary: Accept-Encoding
377 Content-Length: 0
378 Content-Type: text/html; charset=UTF-8
379 Connection: keep-alive
380
381
382 ```
383
384 ```log
385 off=0 message begin
386 off=5 len=3 span[version]="1.0"
387 off=8 version complete
388 off=13 len=17 span[status]="Moved Permanently"
389 off=32 status complete
390 off=32 len=4 span[header_field]="Date"
391 off=37 header_field complete
392 off=38 len=29 span[header_value]="Thu, 03 Jun 2010 09:56:32 GMT"
393 off=69 header_value complete
394 off=69 len=6 span[header_field]="Server"
395 off=76 header_field complete
396 off=77 len=22 span[header_value]="Apache/2.2.3 (Red Hat)"
397 off=101 header_value complete
398 off=101 len=13 span[header_field]="Cache-Control"
399 off=115 header_field complete
400 off=116 len=6 span[header_value]="public"
401 off=124 header_value complete
402 off=124 len=6 span[header_field]="Pragma"
403 off=131 header_field complete
404 off=134 len=0 span[header_value]=""
405 off=134 header_value complete
406 off=134 len=8 span[header_field]="Location"
407 off=143 header_field complete
408 off=144 len=28 span[header_value]="http://www.bonjourmadame.fr/"
409 off=174 header_value complete
410 off=174 len=4 span[header_field]="Vary"
411 off=179 header_field complete
412 off=180 len=15 span[header_value]="Accept-Encoding"
413 off=197 header_value complete
414 off=197 len=14 span[header_field]="Content-Length"
415 off=212 header_field complete
416 off=213 len=1 span[header_value]="0"
417 off=216 header_value complete
418 off=216 len=12 span[header_field]="Content-Type"
419 off=229 header_field complete
420 off=230 len=24 span[header_value]="text/html; charset=UTF-8"
421 off=256 header_value complete
422 off=256 len=10 span[header_field]="Connection"
423 off=267 header_field complete
424 off=268 len=10 span[header_value]="keep-alive"
425 off=280 header_value complete
426 off=282 headers complete status=301 v=1/0 flags=21 content_length=0
427 off=282 message complete
428 ```
429
430 ## Spaces in header value
431
432 <!-- meta={"type": "response"} -->
433 ```http
434 HTTP/1.1 200 OK
435 Date: Tue, 28 Sep 2010 01:14:13 GMT
436 Server: Apache
437 Cache-Control: no-cache, must-revalidate
438 Expires: Mon, 26 Jul 1997 05:00:00 GMT
439 .et-Cookie: PlaxoCS=1274804622353690521; path=/; domain=.plaxo.com
440 Vary: Accept-Encoding
441 _eep-Alive: timeout=45
442 _onnection: Keep-Alive
443 Transfer-Encoding: chunked
444 Content-Type: text/html
445 Connection: close
446
447 0
448
449
450 ```
451
452 ```log
453 off=0 message begin
454 off=5 len=3 span[version]="1.1"
455 off=8 version complete
456 off=13 len=2 span[status]="OK"
457 off=17 status complete
458 off=17 len=4 span[header_field]="Date"
459 off=22 header_field complete
460 off=23 len=29 span[header_value]="Tue, 28 Sep 2010 01:14:13 GMT"
461 off=54 header_value complete
462 off=54 len=6 span[header_field]="Server"
463 off=61 header_field complete
464 off=62 len=6 span[header_value]="Apache"
465 off=70 header_value complete
466 off=70 len=13 span[header_field]="Cache-Control"
467 off=84 header_field complete
468 off=85 len=25 span[header_value]="no-cache, must-revalidate"
469 off=112 header_value complete
470 off=112 len=7 span[header_field]="Expires"
471 off=120 header_field complete
472 off=121 len=29 span[header_value]="Mon, 26 Jul 1997 05:00:00 GMT"
473 off=152 header_value complete
474 off=152 len=10 span[header_field]=".et-Cookie"
475 off=163 header_field complete
476 off=164 len=54 span[header_value]="PlaxoCS=1274804622353690521; path=/; domain=.plaxo.com"
477 off=220 header_value complete
478 off=220 len=4 span[header_field]="Vary"
479 off=225 header_field complete
480 off=226 len=15 span[header_value]="Accept-Encoding"
481 off=243 header_value complete
482 off=243 len=10 span[header_field]="_eep-Alive"
483 off=254 header_field complete
484 off=255 len=10 span[header_value]="timeout=45"
485 off=267 header_value complete
486 off=267 len=10 span[header_field]="_onnection"
487 off=278 header_field complete
488 off=279 len=10 span[header_value]="Keep-Alive"
489 off=291 header_value complete
490 off=291 len=17 span[header_field]="Transfer-Encoding"
491 off=309 header_field complete
492 off=310 len=7 span[header_value]="chunked"
493 off=319 header_value complete
494 off=319 len=12 span[header_field]="Content-Type"
495 off=332 header_field complete
496 off=333 len=9 span[header_value]="text/html"
497 off=344 header_value complete
498 off=344 len=10 span[header_field]="Connection"
499 off=355 header_field complete
500 off=356 len=5 span[header_value]="close"
501 off=363 header_value complete
502 off=365 headers complete status=200 v=1/1 flags=20a content_length=0
503 off=368 chunk header len=0
504 off=370 chunk complete
505 off=370 message complete
506 ```
507
508 ## Spaces in header name
509
510 <!-- meta={"type": "response", "noScan": true} -->
511 ```http
512 HTTP/1.1 200 OK
513 Server: Microsoft-IIS/6.0
514 X-Powered-By: ASP.NET
515 en-US Content-Type: text/xml
516 Content-Type: text/xml
517 Content-Length: 16
518 Date: Fri, 23 Jul 2010 18:45:38 GMT
519 Connection: keep-alive
520
521 <xml>hello</xml>
522 ```
523
524 ```log
525 off=0 message begin
526 off=5 len=3 span[version]="1.1"
527 off=8 version complete
528 off=13 len=2 span[status]="OK"
529 off=17 status complete
530 off=17 len=6 span[header_field]="Server"
531 off=24 header_field complete
532 off=25 len=17 span[header_value]="Microsoft-IIS/6.0"
533 off=44 header_value complete
534 off=44 len=12 span[header_field]="X-Powered-By"
535 off=57 header_field complete
536 off=58 len=7 span[header_value]="ASP.NET"
537 off=67 header_value complete
538 off=72 error code=10 reason="Invalid header token"
539 ```
540
541 ## Non ASCII in status line
542
543 <!-- meta={"type": "response", "noScan": true} -->
544 ```http
545 HTTP/1.1 500 Oriëntatieprobleem
546 Date: Fri, 5 Nov 2010 23:07:12 GMT+2
547 Content-Length: 0
548 Connection: close
549
550
551 ```
552
553 ```log
554 off=0 message begin
555 off=5 len=3 span[version]="1.1"
556 off=8 version complete
557 off=13 len=19 span[status]="Oriëntatieprobleem"
558 off=34 status complete
559 off=34 len=4 span[header_field]="Date"
560 off=39 header_field complete
561 off=40 len=30 span[header_value]="Fri, 5 Nov 2010 23:07:12 GMT+2"
562 off=72 header_value complete
563 off=72 len=14 span[header_field]="Content-Length"
564 off=87 header_field complete
565 off=88 len=1 span[header_value]="0"
566 off=91 header_value complete
567 off=91 len=10 span[header_field]="Connection"
568 off=102 header_field complete
569 off=103 len=5 span[header_value]="close"
570 off=110 header_value complete
571 off=112 headers complete status=500 v=1/1 flags=22 content_length=0
572 off=112 message complete
573 ```
574
575 ## HTTP version 0.9
576
577 <!-- meta={"type": "response"} -->
578 ```http
579 HTTP/0.9 200 OK
580
581
582 ```
583
584 ```log
585 off=0 message begin
586 off=5 len=3 span[version]="0.9"
587 off=8 version complete
588 off=13 len=2 span[status]="OK"
589 off=17 status complete
590 off=19 headers complete status=200 v=0/9 flags=0 content_length=0
591 ```
592
593 ## No Content-Length, no Transfer-Encoding
594
595 The client should wait for the server's EOF. That is, when neither
596 content-length nor transfer-encoding is specified, the end of body
597 is specified by the EOF.
598
599 <!-- meta={"type": "response"} -->
600 ```http
601 HTTP/1.1 200 OK
602 Content-Type: text/plain
603
604 hello world
605 ```
606
607 ```log
608 off=0 message begin
609 off=5 len=3 span[version]="1.1"
610 off=8 version complete
611 off=13 len=2 span[status]="OK"
612 off=17 status complete
613 off=17 len=12 span[header_field]="Content-Type"
614 off=30 header_field complete
615 off=31 len=10 span[header_value]="text/plain"
616 off=43 header_value complete
617 off=45 headers complete status=200 v=1/1 flags=0 content_length=0
618 off=45 len=11 span[body]="hello world"
619 ```
620
621 ## Response starting with CRLF
622
623 <!-- meta={"type": "response"} -->
624 ```http
625 \r\nHTTP/1.1 200 OK
626 Header1: Value1
627 Header2:\t Value2
628 Content-Length: 0
629
630
631 ```
632
633 ```log
634 off=2 message begin
635 off=7 len=3 span[version]="1.1"
636 off=10 version complete
637 off=15 len=2 span[status]="OK"
638 off=19 status complete
639 off=19 len=7 span[header_field]="Header1"
640 off=27 header_field complete
641 off=28 len=6 span[header_value]="Value1"
642 off=36 header_value complete
643 off=36 len=7 span[header_field]="Header2"
644 off=44 header_field complete
645 off=46 len=6 span[header_value]="Value2"
646 off=54 header_value complete
647 off=54 len=14 span[header_field]="Content-Length"
648 off=69 header_field complete
649 off=70 len=1 span[header_value]="0"
650 off=73 header_value complete
651 off=75 headers complete status=200 v=1/1 flags=20 content_length=0
652 off=75 message complete
653 ```