feat(http/unstable): add RFC 9530 digest fields#7037
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7037 +/- ##
==========================================
+ Coverage 94.57% 94.59% +0.01%
==========================================
Files 636 637 +1
Lines 52138 52283 +145
Branches 9399 9431 +32
==========================================
+ Hits 49311 49456 +145
Misses 2249 2249
Partials 578 578 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Updated to use the stable toBytes |
|
Parsing has been hardened and docs improved. Ready for review @bartlomieju |
fibibot
left a comment
There was a problem hiding this comment.
CI green. The new unstable module is wired only via http/deno.json ./unstable-digest-fields, not re-exported from mod.ts. Symbols have @experimental, JSDoc, and per-symbol examples with @std/assert assertions.
parseDigestHeaderValue runs before any body access — the streaming-body tests at lines 380-413 confirm malformed headers don't drain the request body. Subtle but correct.
- nit:
verifyDigestHeaderreads the whole body viamessage.clone().bytes(). The doc already warns about content-encoded responses; worth also flagging the in-memory cost for large bodies. - nit: the module-level "Creating a Content-Digest header" example (lines 12-23) builds a
Requestbut doesn't assert anything; per-symbol examples below do.
|
@bartlomieju this is ready to merge |
Adds an unstable
@std/http/unstable-digest-fieldsmodule for creating and verifying RFC 9530Content-DigestandRepr-Digestfield values.RFC 9530, an IETF standards-track RFC from Feb 2024, replaces the legacy RFC 3230
Digestfield with Structured Fields based digest headers for HTTP content and representation integrity. These helpers support creating digest values from strings, bytes, or streams, and verifyingRequest/Responsebodies without consuming the original body.This is also useful with HTTP Message Signatures (RFC 9421), where a signed digest field can bind the signature to the message body. The implementation is small and browser-compatible, reusing existing
@stdprimitives:timing-safe-equal,unstable-structured-fields, andto-bytes.