@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bakery-framework/core",
3
- "version": "2.0.0-alpha.11",
3
+ "version": "2.0.0-alpha.12",
4
4
  "description": "Bakery framework core: handlers, router, config, session, caches, logger, compiler.",
5
5
  "keywords": [
6
6
  "bakery",
@@ -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` to the
248
- // 206/416, and setting it here too emitted `bytes, bytes`. The trade,
249
- // measured on Bun 1.4.0: a GET whose Range is malformed or multipart is
250
- // served whole with no advertisement from either side acceptable,
251
- // since a client that already sent `Range` is not the one this probe
252
- // header exists for. HEAD ignores `Range` and gets the header even when
253
- // one is present.
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
- !(req && req.method === 'GET' && req.headers.has('range'))
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
  }