OLD | NEW |
(Empty) | |
| 1 <!doctype html> |
| 2 <html> |
| 3 <head> |
| 4 <meta charset="utf-8"> |
| 5 <title>HTTP Cache - Partial Content</title> |
| 6 <meta name="help" href="https://fetch.spec.whatwg.org/#request"> |
| 7 <meta name="timeout" content="long"> |
| 8 <script src="/resources/testharness.js"></script> |
| 9 <script src="/resources/testharnessreport.js"></script> |
| 10 <script src="/common/utils.js"></script> |
| 11 <script src="/common/get-host-info.sub.js"></script> |
| 12 <script src="http-cache.js"></script> |
| 13 </head> |
| 14 <body> |
| 15 <script> |
| 16 var tests = [ |
| 17 { |
| 18 name: 'HTTP cache stores partial content and reuses it.', |
| 19 requests: [ |
| 20 { |
| 21 request_headers: [ |
| 22 ['Range', "bytes=-5"] |
| 23 ], |
| 24 response_status: [206, "Partial Content"], |
| 25 response_headers: [ |
| 26 ['Cache-Control', 'max-age=3600'], |
| 27 ['Content-Range', 'bytes 0-4/10'] |
| 28 ], |
| 29 response_body: "01234", |
| 30 expected_request_headers: [ |
| 31 ['Range', "bytes=-5"] |
| 32 ], |
| 33 }, |
| 34 { |
| 35 request_headers: [ |
| 36 ['Range', "bytes=-5"] |
| 37 ], |
| 38 expected_type: "cached", |
| 39 expected_status: 206 |
| 40 } |
| 41 ] |
| 42 }, |
| 43 { |
| 44 name: 'HTTP cache stores complete response and serves smaller ranges fro
m it.', |
| 45 requests: [ |
| 46 { |
| 47 response_headers: [ |
| 48 ['Cache-Control', 'max-age=3600'], |
| 49 ], |
| 50 response_body: "01234567890", |
| 51 }, |
| 52 { |
| 53 request_headers: [ |
| 54 ['Range', "bytes=-1"] |
| 55 ], |
| 56 expected_type: "cached", |
| 57 expected_response_text: "01" |
| 58 } |
| 59 ] |
| 60 }, |
| 61 { |
| 62 name: 'HTTP cache stores partial response and serves smaller ranges from
it.', |
| 63 requests: [ |
| 64 { |
| 65 request_headers: [ |
| 66 ['Range', "bytes=-5"] |
| 67 ], |
| 68 response_status: [206, "Partial Content"], |
| 69 response_headers: [ |
| 70 ['Cache-Control', 'max-age=3600'], |
| 71 ['Content-Range', 'bytes 0-4/10'] |
| 72 ], |
| 73 response_body: "01234", |
| 74 }, |
| 75 { |
| 76 request_headers: [ |
| 77 ['Range', "bytes=-1"] |
| 78 ], |
| 79 expected_type: "cached", |
| 80 expected_response_text: "01" |
| 81 } |
| 82 ] |
| 83 }, |
| 84 { |
| 85 name: 'HTTP cache stores partial content and completes it.', |
| 86 requests: [ |
| 87 { |
| 88 request_headers: [ |
| 89 ['Range', "bytes=-5"] |
| 90 ], |
| 91 response_status: [206, "Partial Content"], |
| 92 response_headers: [ |
| 93 ['Cache-Control', 'max-age=3600'], |
| 94 ['Content-Range', 'bytes 0-4/10'] |
| 95 ], |
| 96 response_body: "01234", |
| 97 }, |
| 98 { |
| 99 expected_request_headers: [ |
| 100 ["range", "bytes=5-"] |
| 101 ] |
| 102 } |
| 103 ] |
| 104 }, |
| 105 ]; |
| 106 run_tests(tests); |
| 107 </script> |
| 108 </body> |
| 109 </html> |
OLD | NEW |