HTTP 304 lab / HTTP 304 实验 / HTTP 304 実験
Recorded on 2026-10-13, using macOS 27.0.1, Python 3.9.6 and curl 8.7.1.

In the extracted directory:
  python3 http304-lab.py http304-output

Requires Python 3.9+ and curl 7.68+. No Python dependencies.
The experiment sends five sequential, read-only HTTP/1.1 GET requests to:
  https://gumi.ink/examples/great-wave-reading-notes.txt

Cases:
  1. Unconditional GET, saving the body and ETag separately.
  2. A conditional GET using the saved ETag.
  3. A GET with a deliberately nonmatching tag.
  4. A GET with a weak form of the matching tag.
  5. Delete only the first curl body inside the script's temporary directory,
     keep the tag, and send another conditional GET.

The recorded responses were 200, 304, 200, 304, 304.
Body sizes were 2906, 0, 2906, 0, 0 bytes.
The two 200 bodies had identical locally computed SHA-256 values.
All three 304 cases created no new body output file in this run.
The fifth case had no initial body available to reuse.

Output: results.json, including environment, request options, HTTP status,
response header fields, raw final response headers, downloaded bytes,
body-output-file existence and local SHA-256 where a body was received.
The initial ETag is a snapshot; it is freshly retrieved on every run.
No latency, total-wire-byte, browser storage, CDN topology or load test is performed.
The script is an experiment driver, not a complete HTTP cache implementation.
The assertions require the target to remain stable during the five requests.

Observed boundary: the 200 responses had Vary: Accept-Encoding, but the
304 responses did not include Vary. RFC 9110 section 15.4.5 requires Vary
when an equivalent 200 would have included it. No encoding variants were
tested, so this experiment does not establish full cache conformance.

Sources:
  https://www.rfc-editor.org/rfc/rfc9110.html#section-15.4.5
  https://www.rfc-editor.org/rfc/rfc9110.html#section-9.3.2
  https://www.rfc-editor.org/rfc/rfc9110.html#section-6.6.1
  https://www.rfc-editor.org/rfc/rfc9111.html#section-4.3.4
  https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/304
  https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/ETag
  https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/If-None-Match
  https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/Caching
  https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Vary
  https://curl.se/docs/manpage.html#--etag-compare

中文：本实验只验证上述五组请求。ETag 文件不会替代正文；正文缺失时，
304 也不会补回内容。使用自己的缓存时，应关联可用正文与验证信息。
日本語：検証したのは上記の五条件です。ETagのファイルは本文の代わりに
ならず、本文を失っても304は補いません。本文と検証情報を対応させて管理します。
