partial-content 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +31 -0
- package/LICENSE +21 -0
- package/README.md +601 -0
- package/SECURITY.md +92 -0
- package/dist/azure.d.ts +79 -0
- package/dist/azure.d.ts.map +1 -0
- package/dist/azure.js +251 -0
- package/dist/azure.js.map +1 -0
- package/dist/content-disposition.d.ts +74 -0
- package/dist/content-disposition.d.ts.map +1 -0
- package/dist/content-disposition.js +253 -0
- package/dist/content-disposition.js.map +1 -0
- package/dist/fs.d.ts +86 -0
- package/dist/fs.d.ts.map +1 -0
- package/dist/fs.js +375 -0
- package/dist/fs.js.map +1 -0
- package/dist/gcs.d.ts +72 -0
- package/dist/gcs.d.ts.map +1 -0
- package/dist/gcs.js +202 -0
- package/dist/gcs.js.map +1 -0
- package/dist/hono.d.ts +92 -0
- package/dist/hono.d.ts.map +1 -0
- package/dist/hono.js +61 -0
- package/dist/hono.js.map +1 -0
- package/dist/http.d.ts +70 -0
- package/dist/http.d.ts.map +1 -0
- package/dist/http.js +281 -0
- package/dist/http.js.map +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +27 -0
- package/dist/index.js.map +1 -0
- package/dist/kernel.d.ts +541 -0
- package/dist/kernel.d.ts.map +1 -0
- package/dist/kernel.js +1218 -0
- package/dist/kernel.js.map +1 -0
- package/dist/memory.d.ts +55 -0
- package/dist/memory.d.ts.map +1 -0
- package/dist/memory.js +107 -0
- package/dist/memory.js.map +1 -0
- package/dist/mime.d.ts +49 -0
- package/dist/mime.d.ts.map +1 -0
- package/dist/mime.js +150 -0
- package/dist/mime.js.map +1 -0
- package/dist/node.d.ts +84 -0
- package/dist/node.d.ts.map +1 -0
- package/dist/node.js +215 -0
- package/dist/node.js.map +1 -0
- package/dist/object-store.d.ts +472 -0
- package/dist/object-store.d.ts.map +1 -0
- package/dist/object-store.js +335 -0
- package/dist/object-store.js.map +1 -0
- package/dist/r2.d.ts +94 -0
- package/dist/r2.d.ts.map +1 -0
- package/dist/r2.js +150 -0
- package/dist/r2.js.map +1 -0
- package/dist/s3.d.ts +49 -0
- package/dist/s3.d.ts.map +1 -0
- package/dist/s3.js +263 -0
- package/dist/s3.js.map +1 -0
- package/dist/web.d.ts +336 -0
- package/dist/web.d.ts.map +1 -0
- package/dist/web.js +1094 -0
- package/dist/web.js.map +1 -0
- package/docs/DESIGN.md +426 -0
- package/package.json +182 -0
- package/src/azure.ts +329 -0
- package/src/content-disposition.ts +300 -0
- package/src/fs.ts +469 -0
- package/src/gcs.ts +290 -0
- package/src/hono.ts +123 -0
- package/src/http.ts +351 -0
- package/src/index.ts +85 -0
- package/src/kernel.ts +1498 -0
- package/src/memory.ts +148 -0
- package/src/mime.ts +160 -0
- package/src/node.ts +261 -0
- package/src/object-store.ts +665 -0
- package/src/r2.ts +232 -0
- package/src/s3.ts +324 -0
- package/src/web.ts +1603 -0
package/dist/web.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web.js","sourceRoot":"","sources":["../src/web.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EACL,0BAA0B,EAC1B,yBAAyB,EACzB,uBAAuB,EACvB,YAAY,EACZ,iBAAiB,EACjB,mBAAmB,EACnB,YAAY,EACZ,WAAW,EACX,kBAAkB,EAClB,eAAe,EACf,qBAAqB,EACrB,wBAAwB,EACxB,iBAAiB,EACjB,yBAAyB,EACzB,kBAAkB,EAClB,UAAU,EACV,sBAAsB,GAIvB,MAAM,YAAY,CAAC;AAYpB,gFAAgF;AAEhF;;;;;GAKG;AACH,MAAM,YAAY,GAAG,IAAI,WAAW,EAAE,CAAC;AAEvC,6DAA6D;AAC7D,MAAM,WAAW,GAA2B;IAC1C,GAAG,EAAE,IAAI;IACT,GAAG,EAAE,iBAAiB;IACtB,GAAG,EAAE,cAA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;QAAE,OAAO,IAAI,CAAC;IACjE,IAAI,IAAI,KAAK,wBAAwB,IAAI,IAAI,KAAK,wBAAwB;QAAE,OAAO,IAAI,CAAC;IACxF,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/docs/DESIGN.md
ADDED
|
@@ -0,0 +1,426 @@
|
|
|
1
|
+
# Design Notes
|
|
2
|
+
|
|
3
|
+
Implementation details, RFC deviations, and architecture decisions for `partial-content`.
|
|
4
|
+
|
|
5
|
+
## Scope
|
|
6
|
+
|
|
7
|
+
`partial-content` is the **protocol layer only**. It decides *what* status and headers a file request deserves; it never touches the bytes, the network, or your storage SDK.
|
|
8
|
+
|
|
9
|
+
**In scope**
|
|
10
|
+
|
|
11
|
+
- Range parsing and validation (single and multiple ranges)
|
|
12
|
+
- `multipart/byteranges` assembly with range coalescing + amplification defense
|
|
13
|
+
- The full conditional-request chain (412 → 304 → If-Range → 206/200)
|
|
14
|
+
- Write-side preconditions (If-Match / If-None-Match / If-Unmodified-Since)
|
|
15
|
+
- ETag derivation from storage metadata
|
|
16
|
+
- Security-hardened `Content-Disposition`
|
|
17
|
+
|
|
18
|
+
**Non-goals** (deliberately the caller's responsibility)
|
|
19
|
+
|
|
20
|
+
- **I/O.** No reads, writes, streaming, or network calls. You bring the bytes.
|
|
21
|
+
- **Authentication / authorization.** The library assumes the request was already deemed allowed. Gate access *before* calling it.
|
|
22
|
+
- **Caching policy.** It never emits `Cache-Control` on its own -- it only echoes a value you pass in `meta.cacheControl` (orchestrator) or `opts.cacheControl` (standalone builder). `Vary`, `Expires`, and `Date` are left to your runtime (see the [Response Header Matrix](#response-header-matrix)).
|
|
23
|
+
- **Precompressed variant negotiation (`.br` / `.gz` + `Content-Encoding`).**
|
|
24
|
+
That is static-asset serving (sirv, CDN edge config), not object serving.
|
|
25
|
+
Ranges apply to the *encoded* representation and each encoding needs its own
|
|
26
|
+
ETag -- a correctness minefield with no payoff for documents and media,
|
|
27
|
+
which are already compressed formats. Serve pre-compressed web assets from
|
|
28
|
+
a CDN; serve documents through this library.
|
|
29
|
+
- **Storage implementation.** `ObjectStore` is an interface; adapters are yours (or a thin wrapper over an SDK). Built-in adapters cover S3-compatible, R2, GCS, Azure, the local filesystem, any range-capable HTTP origin, and memory.
|
|
30
|
+
|
|
31
|
+
### When you need a protocol layer (and when you don't)
|
|
32
|
+
|
|
33
|
+
You need this when you **proxy bytes through your own origin** — because each request must be authorized or audited, or because the browser talks to your origin rather than to storage (`<video>`/`<audio>` `Range` requests, PDF.js progressive loading, iframe CORS).
|
|
34
|
+
|
|
35
|
+
If you can instead hand the client a **short-lived signed URL** and let object storage or a CDN serve the bytes directly, the backend already speaks this protocol for you — and you may not need this library at all. Reach for `partial-content` precisely when that redirect *isn't* an option.
|
|
36
|
+
|
|
37
|
+
## Evaluation Order
|
|
38
|
+
|
|
39
|
+
The [RFC 9110 Section 13.2.2](https://www.rfc-editor.org/rfc/rfc9110#section-13.2.2) evaluation chain:
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
1. isPreconditionFailure() -> 412 Precondition Failed
|
|
43
|
+
2. isConditionalFresh() -> 304 Not Modified
|
|
44
|
+
3. isRangeFresh() -> Should we honor the Range?
|
|
45
|
+
4. parseRangeHeader() -> Parse and validate the Range
|
|
46
|
+
5. buildRangeResponseHeaders() or build416Headers()
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
`evaluateConditionalRequest()` implements this entire chain in a single call.
|
|
50
|
+
|
|
51
|
+
## Design Decisions
|
|
52
|
+
|
|
53
|
+
**Multi-range is served as `multipart/byteranges`, with amplification defense.**
|
|
54
|
+
A `Range` with several parts (`bytes=0-100,200-300`) is served as a
|
|
55
|
+
`multipart/byteranges` 206. The single-range case keeps its own fast path
|
|
56
|
+
(`parseRangeHeader` + the single-round-trip Path B); multi-range takes a
|
|
57
|
+
separate path that never touches the hot single-seek code. Two things make this
|
|
58
|
+
safe rather than a DoS vector, informed by Go `net/http.ServeContent` and nginx:
|
|
59
|
+
|
|
60
|
+
- **Coalescing.** Overlapping and adjacent (touching) ranges are merged before
|
|
61
|
+
serving, so a client cannot force redundant bytes by requesting the same
|
|
62
|
+
region many times.
|
|
63
|
+
- **Amplification cap.** If the coalesced set still exceeds `maxRanges` distinct
|
|
64
|
+
parts (default 50), or already covers the whole representation, the ranges are
|
|
65
|
+
ignored and the full 200 is served, framing over the entire file is pure
|
|
66
|
+
overhead and the classic amplification vector.
|
|
67
|
+
|
|
68
|
+
The `Content-Length` is computed exactly from the framing and range spans (never
|
|
69
|
+
chunked). The first part is fetched eagerly so a pinned-read `ObjectChangedError`
|
|
70
|
+
surfaces before headers commit (same one-shot re-validation single-range gets);
|
|
71
|
+
the rest stream lazily, each pinned to the same representation. This relies on
|
|
72
|
+
each store serving exactly the requested (size-clamped) span per range, which
|
|
73
|
+
every bundled adapter does.
|
|
74
|
+
|
|
75
|
+
**Weak ETag matching for `If-None-Match`.** `If-None-Match` uses weak comparison
|
|
76
|
+
per RFC 9110 Section 8.8.3.2 Table 3 (the correct algorithm for this header).
|
|
77
|
+
We strip the `W/` prefix from both sides before comparing.
|
|
78
|
+
|
|
79
|
+
**Strong comparison for `If-Match`.** `If-Match` requires strong comparison per
|
|
80
|
+
RFC 9110 Section 8.8.3.2 Table 3. We enforce this strictly: if the server's ETag
|
|
81
|
+
is weak-prefixed (`W/`), the precondition always fails (412). This means
|
|
82
|
+
`evaluateConditionalWrite` cannot confirm a match for resources with only
|
|
83
|
+
weak validators (size+mtime), which is correct -- you cannot guarantee
|
|
84
|
+
byte equality with a weak validator, so OCC via `If-Match` requires a
|
|
85
|
+
content-hash ETag.
|
|
86
|
+
|
|
87
|
+
**If-Range requires strong validators.** RFC 7233 Section 3.2 requires If-Range\r
|
|
88
|
+
to use strong comparison (same as `If-Match`). If-Range with a weak validator is\r
|
|
89
|
+
actively dangerous: it could splice partial bytes from one representation onto a\r
|
|
90
|
+
cached body from another. When either the client's `If-Range` or the server's\r
|
|
91
|
+
ETag is weak-prefixed, we ignore the range and serve a full 200.
|
|
92
|
+
|
|
93
|
+
**If-Range date comparison is exact match.** RFC 9110 Section 13.1.5 requires
|
|
94
|
+
exact match for If-Range HTTP-date comparison (unlike If-Unmodified-Since which
|
|
95
|
+
uses `<=`), and Go stdlib enforces the same equality. The failure modes are
|
|
96
|
+
asymmetric: a strict mismatch costs at worst one full 200 re-download, while a
|
|
97
|
+
lenient `<=` would honor the range precisely when the dates differ -- the one
|
|
98
|
+
case where byte identity cannot be guaranteed -- splicing mismatched bytes onto
|
|
99
|
+
the client's cached body. Both sides are floored to whole seconds first, and a
|
|
100
|
+
well-behaved client echoes our emitted IMF-fixdate verbatim, so exact match
|
|
101
|
+
never misfires for correct revalidation.
|
|
102
|
+
|
|
103
|
+
**Case-insensitive range units.** Per RFC 9110 Section 14.1, range units are
|
|
104
|
+
compared case-insensitively. `Bytes=0-499` and `BYTES=0-499` are both valid.
|
|
105
|
+
|
|
106
|
+
## Parsing Details
|
|
107
|
+
|
|
108
|
+
**Quote-aware ETag parsing.** Commas inside quoted ETag values are valid per
|
|
109
|
+
RFC 7232 Section 2.3. Our parser correctly handles `"ver,1", "ver,2"` as
|
|
110
|
+
two ETags, not four fragments. The parser is a single-pass state machine that
|
|
111
|
+
tracks quote boundaries rather than splitting on commas.
|
|
112
|
+
|
|
113
|
+
**Obsolete date format acceptance.** Per RFC 9110 Section 5.6.7, we accept all
|
|
114
|
+
three HTTP-date formats in conditional request headers: IMF-fixdate
|
|
115
|
+
(`Sun, 06 Nov 1994 08:49:37 GMT`), obsolete RFC 850 format
|
|
116
|
+
(`Sunday, 06-Nov-94 08:49:37 GMT`), and ANSI C asctime format
|
|
117
|
+
(`Sun Nov 6 08:49:37 1994`, interpreted as UTC per the RFC; naive
|
|
118
|
+
`Date.parse` would read it as server-local time). These three are also the
|
|
119
|
+
ONLY formats honored in client conditional headers: Sections 13.1.3/13.1.4
|
|
120
|
+
require ignoring `If-Modified-Since`/`If-Unmodified-Since` values that are
|
|
121
|
+
not valid HTTP-dates, so ISO 8601 and other `Date.parse`-able strings are
|
|
122
|
+
rejected on the wire. Backend metadata (`lastModified` from an adapter) stays
|
|
123
|
+
lenient -- that is our own input -- and output is always normalized to
|
|
124
|
+
IMF-fixdate.
|
|
125
|
+
|
|
126
|
+
**Sub-second timestamp handling.** Storage backends (S3, R2, Postgres) return
|
|
127
|
+
timestamps with millisecond precision (e.g., `2025-06-28T12:00:00.500Z`). HTTP
|
|
128
|
+
dates are floored to whole seconds in `Last-Modified`. All conditional request
|
|
129
|
+
comparisons (`If-Modified-Since`, `If-Unmodified-Since`, `If-Range`) also floor
|
|
130
|
+
both sides to prevent permanent false-stale results from sub-second skew.
|
|
131
|
+
|
|
132
|
+
The flooring has a FALSE-FRESH twin that date validators cannot escape: two
|
|
133
|
+
same-length writes within one second are indistinguishable to a
|
|
134
|
+
second-resolution validator, so a revalidating client can receive 304 for
|
|
135
|
+
changed bytes. The fs store closes this window by deriving its weak ETag
|
|
136
|
+
from the NANOSECOND mtime (`stat({ bigint: true })`); filesystems with
|
|
137
|
+
coarse timestamps (FAT: 2 s) retain a residual window, and content-hash
|
|
138
|
+
ETags (S3 digests) never had one. With the fs hot-object cache enabled, a
|
|
139
|
+
cached validator can additionally lag an overwrite by up to `ttlMs`, so the
|
|
140
|
+
stale-304 exposure with the cache on is bounded by `ttlMs`, not by
|
|
141
|
+
timestamp resolution -- size the TTL against acceptable staleness for
|
|
142
|
+
mutable keys, or reserve the cache for immutable/content-addressed ones.
|
|
143
|
+
|
|
144
|
+
**Orchestrator date pre-computation.** `evaluateConditionalRequest` pre-computes
|
|
145
|
+
the `toHttpDate()` result once and passes the normalized IMF-fixdate string to all
|
|
146
|
+
downstream calls (`isPreconditionFailure`, `isConditionalFresh`, `isRangeFresh`,
|
|
147
|
+
and the final header builder). Without this, the orchestrator would call
|
|
148
|
+
`Date.parse` + `toUTCString` up to 4 times on the same string.
|
|
149
|
+
|
|
150
|
+
**Zero-length file handling.** When `totalSize` is 0, `parseRangeHeader` returns
|
|
151
|
+
`null` (treat as non-range request, serve 200 with empty body). This includes
|
|
152
|
+
`bytes=0-0` on a zero-length file. Strictly, RFC 9110 Section 14.1.2 would have
|
|
153
|
+
this be unsatisfiable (416), but an empty 200 is the pragmatic response since
|
|
154
|
+
there are zero bytes to serve either way.
|
|
155
|
+
|
|
156
|
+
**Request `Cache-Control` is ignored during conditional evaluation.** Matching
|
|
157
|
+
Go stdlib and nginx: request cache directives (RFC 9111 Section 5.2.1) address
|
|
158
|
+
caches, not origin conditional evaluation, and a 304 IS the end-to-end
|
|
159
|
+
revalidation the client asked for. This matters in practice: spec-compliant
|
|
160
|
+
fetch clients (undici, browsers) automatically append `Cache-Control: no-cache`
|
|
161
|
+
to any request that carries manually-set conditional headers, so honoring the
|
|
162
|
+
directive would make 304 unreachable for every programmatic revalidation
|
|
163
|
+
(verified live against Node/undici). Hard reloads need no special case -- they
|
|
164
|
+
omit the validators entirely, which already evaluates as "not conditional."
|
|
165
|
+
Some legacy middleware treats request `no-cache` as "force 200"; that behavior
|
|
166
|
+
silently disables revalidation for exactly the clients that follow the fetch
|
|
167
|
+
spec, so we do not reproduce it.
|
|
168
|
+
|
|
169
|
+
**HEAD masks `Range` and `If-Range`.** RFC 9110 Section 14.2 defines range
|
|
170
|
+
handling for GET only, so a HEAD never yields 206 or 416; conditionals
|
|
171
|
+
(304/412) still apply to HEAD exactly as to GET per Section 13.1.
|
|
172
|
+
|
|
173
|
+
**Oversized range values are capped, not rejected.** Range positions beyond
|
|
174
|
+
`Number.MAX_SAFE_INTEGER` (attackers probing 64-bit parsers) are clamped to
|
|
175
|
+
the representation bounds instead of erroring; the response is still a
|
|
176
|
+
correct 206/200 for the actual object.
|
|
177
|
+
|
|
178
|
+
**Suffix ranges larger than the file serve the full body as 206.** RFC 9110
|
|
179
|
+
Section 14.1.2 resolves `bytes=-N` where N >= size to the entire
|
|
180
|
+
representation; we emit it as a 206 with full bounds rather than degrading
|
|
181
|
+
to 200, matching Go stdlib.
|
|
182
|
+
|
|
183
|
+
**A `Range` on a zero-length representation serves 200, not 416.** A strict
|
|
184
|
+
reading of RFC 9110 Section 14.1.2 could call any range on a 0-byte object
|
|
185
|
+
unsatisfiable (416), but Go `net/http.ServeContent` and nginx both serve the
|
|
186
|
+
empty 200, and returning 416 for `bytes=0-` on an empty file breaks real
|
|
187
|
+
clients. We match the battle-tested behavior: the range parser treats a
|
|
188
|
+
zero-size representation as "not a range request" and serves the empty 200.
|
|
189
|
+
|
|
190
|
+
**`Want-Repr-Digest` negotiation is parsed for `sha-256`, not as a full
|
|
191
|
+
Structured Fields document.** RFC 9530 digest negotiation is read with a
|
|
192
|
+
purpose-built parser that finds `sha-256` and its preference weight (and
|
|
193
|
+
ignores any parameters); it is not a general RFC 8941 parser, because the only
|
|
194
|
+
algorithm we emit is `sha-256`. Any other `Want-*` member is ignored, which is
|
|
195
|
+
the correct outcome (we cannot honor an algorithm we do not produce).
|
|
196
|
+
|
|
197
|
+
**Unknown totals in backend `Content-Range` are passed through as `*`.**
|
|
198
|
+
When an origin answers `bytes a-b/*` (RFC 7233 Section 4.2 -- a streaming
|
|
199
|
+
origin that does not know its full length), the adapter leaves
|
|
200
|
+
`ObjectStream.totalSize` `undefined` and the served 206 repeats `bytes a-b/*`
|
|
201
|
+
honestly. Nothing is fabricated: the 206's `Content-Length` is the range span
|
|
202
|
+
(known), and the served-range guard trusts the authoritative backend's ordered
|
|
203
|
+
bounds since there is no EOF to check against. Object stores (S3, R2, GCS,
|
|
204
|
+
Azure) always report a concrete total, so this only ever engages for the `http`
|
|
205
|
+
adapter in front of a proxied streaming origin.
|
|
206
|
+
|
|
207
|
+
## Response Header Matrix
|
|
208
|
+
|
|
209
|
+
This library generates the following response headers:
|
|
210
|
+
|
|
211
|
+
| Header | 200 | 206 | 304 | 412 | 416 |
|
|
212
|
+
|--------|-----|-----|-----|-----|-----|
|
|
213
|
+
| `Accept-Ranges` | yes | yes | - | - | yes |
|
|
214
|
+
| `Content-Length` | yes | yes | - | yes¹ | yes¹ |
|
|
215
|
+
| `Content-Range` | - | yes | - | - | yes |
|
|
216
|
+
| `Content-Type` | yes | yes | - | - | - |
|
|
217
|
+
| `ETag` | yes | yes | yes | opt³ | - |
|
|
218
|
+
| `Last-Modified` | yes | yes | yes⁶ | - | - |
|
|
219
|
+
| `Repr-Digest` | opt⁴ | opt⁴ | - | - | - |
|
|
220
|
+
| `Content-Digest` | opt⁵ | - | - | - | - |
|
|
221
|
+
| `Cache-Control` | opt² | opt² | opt² | - | - |
|
|
222
|
+
|
|
223
|
+
¹ `Content-Length: 0` on 412 and 416 for enterprise proxy compatibility.
|
|
224
|
+
HAProxy and Envoy require explicit Content-Length on bodyless responses
|
|
225
|
+
to avoid chunked-encoding timeouts.
|
|
226
|
+
|
|
227
|
+
² Included when the caller passes `cacheControl` to `build304Headers`,
|
|
228
|
+
`buildRangeResponseHeaders`, or `evaluateConditionalRequest`. This library
|
|
229
|
+
never generates cache directives on its own.
|
|
230
|
+
|
|
231
|
+
³ Included in 412 from `evaluateConditionalWrite` when `meta.etag` is available.
|
|
232
|
+
Returning the current ETag on a 412 lets OCC clients resync without a follow-up
|
|
233
|
+
GET. The standalone `build412Headers()` omits it (callers add it themselves).
|
|
234
|
+
|
|
235
|
+
⁴ RFC 9530 `Repr-Digest`. Emitted when `meta.digest` (raw base64 SHA-256) is
|
|
236
|
+
provided. Uses Structured Fields Dictionary syntax: `sha-256=:<base64>:`.
|
|
237
|
+
Covers the full representation (independent of Content-Range or Content-Encoding),
|
|
238
|
+
so it remains stable across range requests. Storage backends provide the source:
|
|
239
|
+
S3 via `x-amz-checksum-sha256`, GCS via `x-goog-hash`.
|
|
240
|
+
|
|
241
|
+
⁵ RFC 9530 `Content-Digest`. Identical to `Repr-Digest` on 200 responses
|
|
242
|
+
(content equals full representation). Omitted on 206 because computing a hash
|
|
243
|
+
of the range slice would require streaming through crypto, violating the
|
|
244
|
+
zero-I/O kernel contract.
|
|
245
|
+
|
|
246
|
+
⁶ Omitted on 304 whenever an `ETag` is emitted: RFC 7232 Section 4.1 lists
|
|
247
|
+
`Last-Modified` among headers to send only "unless the reason for sending is
|
|
248
|
+
the entity-tag"; one strong validator suffices and this matches Go stdlib.
|
|
249
|
+
|
|
250
|
+
The following headers are **not** generated because they are the responsibility
|
|
251
|
+
of the HTTP runtime or application layer:
|
|
252
|
+
|
|
253
|
+
- **`Date`** - Set automatically by Bun, Node.js, Deno, Cloudflare Workers
|
|
254
|
+
- **`Vary`** - Application-specific (depends on content negotiation)
|
|
255
|
+
- **`Content-Location`** - Application-specific
|
|
256
|
+
- **`Expires`** - Use `Cache-Control` instead (per RFC 7234 Section 5.3)
|
|
257
|
+
|
|
258
|
+
RFC 9110 Section 15.3.7 requires `Date`, `Cache-Control`, `ETag`, `Expires`,
|
|
259
|
+
`Content-Location`, and `Vary` on 206 responses "if the field would have been
|
|
260
|
+
sent in a 200 (OK) response." This library handles ETag and Cache-Control;
|
|
261
|
+
the rest are either runtime-managed or application-specific.
|
|
262
|
+
|
|
263
|
+
## Content-Disposition Security
|
|
264
|
+
|
|
265
|
+
**Dual-parameter approach (RFC 6266 Section 4.3).** When a filename contains
|
|
266
|
+
non-ASCII characters, `buildContentDisposition` emits both `filename` (ASCII
|
|
267
|
+
fallback with lossy transliteration) and `filename*` (UTF-8 percent-encoded
|
|
268
|
+
original). Browsers that understand `filename*` MUST prefer it over `filename`.
|
|
269
|
+
|
|
270
|
+
Security sanitization:
|
|
271
|
+
|
|
272
|
+
- CRLF injection prevention (strips `\r`, `\n`, control characters)
|
|
273
|
+
- Path traversal protection (strips `../`, `..\\`, extracts basename)
|
|
274
|
+
- Bidi override stripping (prevents RLO filename spoofing attacks)
|
|
275
|
+
- C1 control characters, NBSP, line/paragraph separators stripped
|
|
276
|
+
- Surrogate pair safety (handles truncated emoji gracefully)
|
|
277
|
+
- RFC 2616 quoted-string escaping (backslash and double-quote)
|
|
278
|
+
- RFC 8187 `filename*` encoding for non-ASCII characters
|
|
279
|
+
|
|
280
|
+
## RFC 9530 Digest Fields (End-to-End Integrity)
|
|
281
|
+
|
|
282
|
+
`partial-content` ships first-class RFC 9530 (February 2024) support --
|
|
283
|
+
emission plus `Want-Repr-Digest` negotiation -- which none of the mainstream
|
|
284
|
+
JS file-serving libraries (`send`, `sirv`, the framework static middlewares)
|
|
285
|
+
offer. When a storage backend provides a SHA-256 hash of the full
|
|
286
|
+
representation, the kernel emits both `Repr-Digest` and `Content-Digest`
|
|
287
|
+
headers.
|
|
288
|
+
|
|
289
|
+
Key properties:
|
|
290
|
+
|
|
291
|
+
- **Repr-Digest** covers the *full representation*, not the transmitted bytes.
|
|
292
|
+
This means the same digest value appears on both full (200) and partial (206)
|
|
293
|
+
responses, allowing clients to verify integrity regardless of transfer strategy.
|
|
294
|
+
- **Content-Digest** is identical to `Repr-Digest` on 200 responses (content
|
|
295
|
+
equals the full representation). On 206, Content-Digest is omitted because
|
|
296
|
+
computing a hash of the range slice would require streaming through crypto,
|
|
297
|
+
violating the zero-I/O kernel contract. This is correct per RFC 9530 Section 2.
|
|
298
|
+
- **Want-Repr-Digest / Want-Content-Digest** request header parsing (RFC 9530
|
|
299
|
+
Section 4). The kernel respects client algorithm preferences: if the client
|
|
300
|
+
only wants `sha-512`, we omit our `sha-256` digest rather than sending an
|
|
301
|
+
unwanted algorithm. Weight 0 means explicitly unwanted. The negotiation is
|
|
302
|
+
exported as `clientWantsDigest()` and applied identically by the kernel
|
|
303
|
+
orchestrator and the web adapter, so suppression works at every layer.
|
|
304
|
+
- Uses **Structured Fields Dictionary** syntax per RFC 8941: `sha-256=:<base64>:`
|
|
305
|
+
- **Not emitted** on 304 (no body) or 412 (precondition failure).
|
|
306
|
+
- The library **never computes** digests itself (zero dependencies, no crypto).
|
|
307
|
+
It relies on the storage backend to provide the hash, which S3 and GCS already
|
|
308
|
+
compute at upload time.
|
|
309
|
+
|
|
310
|
+
Enterprise use case: SOC 2 / ISO 27001 compliance audits can verify that the
|
|
311
|
+
file delivered to the browser matches the file stored in object storage, using
|
|
312
|
+
only standard HTTP headers, with no application-layer checksums required.
|
|
313
|
+
|
|
314
|
+
## Atomic Reads (HEAD->GET Consistency)
|
|
315
|
+
|
|
316
|
+
**Plain-range fast path (no HEAD at all).** A range request carrying no
|
|
317
|
+
conditional headers and no `If-Range` needs nothing from a HEAD: on stores
|
|
318
|
+
declaring `authoritativeRange` (S3, Azure, R2, http -- their 206
|
|
319
|
+
bounds/total are parsed from the backend's actual `Content-Range`), the
|
|
320
|
+
orchestrator issues a single GET. `bytes=a-b` and `bytes=a-` qualify (an
|
|
321
|
+
open end is sent as a large last-byte-pos, which RFC 9110 Section 14.1.2
|
|
322
|
+
lets the server clamp); suffix, multi-range, and malformed specs fall back
|
|
323
|
+
to the validating HEAD path. Validators, bounds, and digest all come from
|
|
324
|
+
the GET response itself, so the fast path is inherently TOCTOU-atomic. If
|
|
325
|
+
the backend rejects the range natively (start beyond EOF) the request
|
|
326
|
+
falls back to the HEAD path, which produces the correct 416 with real
|
|
327
|
+
bounds. This halves round-trips on the hottest media paths (video seeking,
|
|
328
|
+
PDF.js chunked loading).
|
|
329
|
+
|
|
330
|
+
For everything else, evaluating conditionals requires metadata (HEAD)
|
|
331
|
+
before bytes (GET), which opens a race: the object can change between the
|
|
332
|
+
two calls. The web adapter closes it in layers:
|
|
333
|
+
|
|
334
|
+
1. **Pinned reads.** The GET carries the HEAD's raw ETag as
|
|
335
|
+
`GetObjectOptions.ifMatch`, mapped to each backend's native conditional
|
|
336
|
+
read: S3 `IfMatch`, R2 `onlyIf.etagMatches`, Azure `conditions.ifMatch`,
|
|
337
|
+
GCS generation-pinned stream. Either the exact validated bytes stream,
|
|
338
|
+
or the store throws `ObjectChangedError`.
|
|
339
|
+
Stores whose version identifier is not the ETag also issue an opaque
|
|
340
|
+
`ObjectMetadata.pin` token from `headObject`, which the orchestrator
|
|
341
|
+
round-trips verbatim into `GetObjectOptions.pin`. GCS encodes its
|
|
342
|
+
generation plus the size/validators in it, so a pinned `getObject`
|
|
343
|
+
streams directly from that immutable generation without re-fetching
|
|
344
|
+
metadata -- the HEAD->GET pair costs exactly one metadata round trip.
|
|
345
|
+
Foreign or stale pins are ignored and the adapter revalidates from
|
|
346
|
+
scratch. One narrow divergence: if a GCS pinned generation is *hard*
|
|
347
|
+
deleted mid-flight (an overwrite with both Object Versioning and
|
|
348
|
+
soft-delete off), `createReadStream` errors after the response headers
|
|
349
|
+
commit, so the client sees a torn transfer rather than an
|
|
350
|
+
`ObjectChangedError` + revalidation. Modern buckets default to
|
|
351
|
+
soft-delete, which keeps the pinned generation readable and masks this;
|
|
352
|
+
the outcome is a failed transfer the client retries, never spliced bytes.
|
|
353
|
+
2. **One re-validation.** On `ObjectChangedError` the adapter re-runs
|
|
354
|
+
HEAD + evaluation once against the new state, so the client gets a
|
|
355
|
+
coherent answer (a stale `If-Range` now correctly yields a full 200 of
|
|
356
|
+
the new bytes). A second failure returns 502 -- the object is churning.
|
|
357
|
+
3. **Response-side guard** (for stores that ignore the pin): validators are
|
|
358
|
+
taken from the GET response, 206 bounds come from the backend's actual
|
|
359
|
+
`Content-Range`, an absent Content-Range degrades to 200, and an
|
|
360
|
+
unparseable one fails loudly with 502.
|
|
361
|
+
|
|
362
|
+
The fs adapter needs no pin: it stats and streams from a single opened file
|
|
363
|
+
handle, and the Azure adapter's single `download()` call makes metadata and
|
|
364
|
+
body one response by construction. One caveat: with the opt-in fs cache
|
|
365
|
+
enabled, HEAD/conditional evaluation may serve a cached metadata snapshot
|
|
366
|
+
while a concurrent GET reads fresh from disk; every disk read writes its
|
|
367
|
+
metadata back to the cache so the views converge, and each individual
|
|
368
|
+
response remains internally coherent. The divergence is bounded by `ttlMs`
|
|
369
|
+
(see Sub-second timestamp handling above).
|
|
370
|
+
|
|
371
|
+
## Audit Hook (onServe)
|
|
372
|
+
|
|
373
|
+
The web adapter provides a structured `onServe` callback for compliance
|
|
374
|
+
logging. It fires on every response that grants access (200, 206, 304, and
|
|
375
|
+
302 signed-URL redirects) AND on protocol denials (412 failed precondition,
|
|
376
|
+
416 unsatisfiable range) -- a 412 is an optimistic-concurrency conflict,
|
|
377
|
+
exactly the event change-control audit trails need. `bytesServed` is the
|
|
378
|
+
GRANTED Content-Length, captured when headers commit (a disconnecting
|
|
379
|
+
client may receive fewer bytes); treat it as access volume, not transfer
|
|
380
|
+
confirmation. A throwing hook never affects the response: the failure is
|
|
381
|
+
routed to `onError` with `operation: "audit"`. Each event carries:
|
|
382
|
+
|
|
383
|
+
- `key`: Storage key served
|
|
384
|
+
- `method`: `GET` or `HEAD` (distinguishes a metadata probe from a byte transfer)
|
|
385
|
+
- `status`: HTTP status (200, 206, 302, 304, or a 412/416 denial)
|
|
386
|
+
- `mime`: MIME type
|
|
387
|
+
- `bytesServed`: Content-Length (0 for 302, 304, 412, 416, and HEAD)
|
|
388
|
+
- `rangeStart` / `rangeEnd`: Present only on 206
|
|
389
|
+
- `etag`: ETag of the served representation
|
|
390
|
+
|
|
391
|
+
302 redirects are audited because a signed URL grants the same file access as
|
|
392
|
+
a streamed body; omitting them would leave a hole in the access trail exactly
|
|
393
|
+
where the storage backend cannot stream ranges.
|
|
394
|
+
|
|
395
|
+
This satisfies SOC 2 CC7.2 (system operation monitoring) and ISO 27001 A.8.15
|
|
396
|
+
(logging) without coupling the library to any specific logging framework.
|
|
397
|
+
|
|
398
|
+
### Transfer completion (onTransfer)
|
|
399
|
+
|
|
400
|
+
`onServe` reports bytes *granted* at header-commit time; `onTransfer` reports
|
|
401
|
+
bytes *actually transferred* once the response body reaches its terminal
|
|
402
|
+
state. It fires once per 200/206 GET with `bytesExpected` (the granted
|
|
403
|
+
Content-Length), `bytesTransferred` (bytes read through the body), and
|
|
404
|
+
`completed` (`true` on a full drain, `false` when the client disconnected or
|
|
405
|
+
cancelled early). Use `bytesTransferred` for true egress billing and
|
|
406
|
+
`completed === false` for download-abandonment analytics -- the honest signals
|
|
407
|
+
`onServe` structurally cannot give, because it fires before a single byte
|
|
408
|
+
leaves the process.
|
|
409
|
+
|
|
410
|
+
The metering is opt-in and zero-cost when unset: the body is returned
|
|
411
|
+
untouched, so byte bodies keep the runtime's static-body fast path. When
|
|
412
|
+
`onTransfer` is set, the body is routed through a counting stream (byte bodies
|
|
413
|
+
are wrapped too, so a byte store and a streaming store report identically) --
|
|
414
|
+
a deliberate cost you pay only when measuring. Like `onServe`, a throwing
|
|
415
|
+
`onTransfer` cannot corrupt the transfer: it fires from inside the body's
|
|
416
|
+
stream machinery, and its error is routed to `onError` (`operation: "audit"`).
|
|
417
|
+
|
|
418
|
+
## Charset Enforcement
|
|
419
|
+
|
|
420
|
+
The web adapter enforces `charset=utf-8` on textual MIME types (`text/*`,
|
|
421
|
+
`application/json`, `application/xml`, `*+json`, `*+xml`,
|
|
422
|
+
`application/javascript`) by default. This prevents UTF-7 encoding-sniffing XSS
|
|
423
|
+
where legacy browsers auto-detect charset when none is declared, allowing
|
|
424
|
+
`+ADw-script+AD4-` to execute as JavaScript.
|
|
425
|
+
|
|
426
|
+
Controlled via `enforceCharset: false` for consumers who need raw MIME types.
|