@bakery-framework/core 2.0.0-alpha.11 → 2.0.0-alpha.12
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/package.json +1 -1
- package/src/utils/http/etag.ts +24 -9
package/package.json
CHANGED
package/src/utils/http/etag.ts
CHANGED
|
@@ -243,17 +243,32 @@ export namespace ETag {
|
|
|
243
243
|
// in-memory Blob or a `sendText` string body ignores Range entirely
|
|
244
244
|
// (served whole, 200), which is why `.name` gates the claim.
|
|
245
245
|
//
|
|
246
|
-
// Skipped when Bun's own range path is about to answer (a GET carrying
|
|
247
|
-
// `Range`): that path appends its own `Accept-Ranges: bytes`
|
|
248
|
-
// 206/416, and setting it here too emitted `bytes, bytes`.
|
|
249
|
-
//
|
|
250
|
-
//
|
|
251
|
-
//
|
|
252
|
-
//
|
|
253
|
-
// one
|
|
246
|
+
// Skipped when Bun's own range path is about to answer (a GET carrying a
|
|
247
|
+
// single-range `Range`): that path appends its own `Accept-Ranges: bytes`
|
|
248
|
+
// to the 206/416, and setting it here too emitted `bytes, bytes`.
|
|
249
|
+
//
|
|
250
|
+
// A **multipart** range (`bytes=0-1,10-11`) is carved back out of the
|
|
251
|
+
// skip: Bun does not do multipart — it serves the whole file as a 200 and
|
|
252
|
+
// appends nothing — so the skip left that response advertising nothing at
|
|
253
|
+
// all, which reads as "ranges not supported" to the one client that just
|
|
254
|
+
// demonstrated it wants them. Found by a downstream smoke test. The comma
|
|
255
|
+
// is the entire multipart grammar, so this cannot drift from Bun's own
|
|
256
|
+
// parse the way a real Range parser here could; RFC-legal multipart gets
|
|
257
|
+
// the 200-with-advertisement it deserves. What stays excluded-and-silent
|
|
258
|
+
// is a *malformed* single range (`Range: potato`) — also served whole by
|
|
259
|
+
// Bun, but that requester sent garbage, and mirroring Bun's full validity
|
|
260
|
+
// judgment here is exactly the second-parser drift this comment refuses.
|
|
261
|
+
// HEAD ignores `Range` and gets the header even when one is present.
|
|
262
|
+
const rangeValue = req?.headers.get('range')
|
|
254
263
|
if (
|
|
255
264
|
resolvedFile.name &&
|
|
256
|
-
!(
|
|
265
|
+
!(
|
|
266
|
+
req &&
|
|
267
|
+
req.method === 'GET' &&
|
|
268
|
+
rangeValue !== null &&
|
|
269
|
+
rangeValue !== undefined &&
|
|
270
|
+
!rangeValue.includes(',')
|
|
271
|
+
)
|
|
257
272
|
) {
|
|
258
273
|
headers['Accept-Ranges'] = 'bytes'
|
|
259
274
|
}
|