Repository navigation
feat: RFC compliant typed headers - #360
Conversation
… quote-aware splitting Closes serverpod#102
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughThe PR raises the Dart SDK baseline to 3.10.3, updates CI gating to match, and refactors multiple typed HTTP header parsers and primitives to use stricter canonicalization, new parsing helpers, and revised validation semantics. Tests and IO behavior were updated to match the new header contracts. ChangesCI and SDK baseline
Typed headers and primitives
Sequence Diagram(s)sequenceDiagram
participant PackageExports as relic_core.dart
participant Parsers as typed header parsers
participant IO as relic_io handlers
participant Tests as typed tests
PackageExports->>Parsers: export new primitives
Parsers->>IO: provide parsed headers and validators
Parsers->>Tests: expose new parse/encode behavior
IO->>Tests: verified by range and transfer-encoding tests
Estimated code review effort🎯 5 (Critical) | ⏱️ ~90+ minutes Possibly related issues
Possibly related PRs
✨ Finishing Touches🧪 Generate unit tests (beta)
|
da8791d to
9608c86
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #360 +/- ##
==========================================
+ Coverage 91.21% 91.72% +0.51%
==========================================
Files 98 108 +10
Lines 3849 4510 +661
Branches 1964 2291 +327
==========================================
+ Hits 3511 4137 +626
- Misses 338 373 +35
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…ngletons (BCP 47)
Backported from serverpod#360 (RFC compliant typed headers) so the header-parsing security fixes can build on the same primitives as main. The files are deliberately not exported from relic_core.dart: they are an implementation detail here, and keeping them internal leaves the 1.2.x public API surface unchanged.
dart:io owns Transfer-Encoding framing and Connection handling: on a bodyless GET it waits for a chunked body the client never sends, on Dart 3.13+ HttpServer rejects an empty or unknown Transfer-Encoding coding at the protocol layer, and it drops an empty Connection request header. Ten round-trip tests hung for 30s or saw closed connections. Backport the test-side reshaping from serverpod#360 onto the 1.2 line: the affected Transfer-Encoding and empty-Connection cases move to direct unit tests in relic_core against the 1.2 parse API, keeping 1.2 semantics (chunked reordering, closed directive set). No runtime code changes.
Backported from serverpod#360 (RFC compliant typed headers) so the header-parsing security fixes can build on the same primitives as main. The files are deliberately not exported from relic_core.dart: they are an implementation detail here, and keeping them internal leaves the 1.2.x public API surface unchanged.
DigestAuthorizationHeader.headerValue joined the scheme into the comma-separated param list, emitting "Digest, username=...". The old regex parser skimmed past the junk, but the linear header scanner rightly rejects the encoder's own output, breaking codec round-trips. Mirror the encoder fixed on main by serverpod#360 (excluded from this backport): a single SP after the scheme (RFC 7235 2.1), quoted-string escaping with a control-character guard for text params, and bare tokens for algorithm, qop, and nc.
Backported from serverpod#360 (RFC compliant typed headers) so the header-parsing security fixes can build on the same primitives as main. The files are deliberately not exported from relic_core.dart: they are an implementation detail here, and keeping them internal leaves the 1.2.x public API surface unchanged.
DigestAuthorizationHeader.headerValue joined the scheme into the comma-separated param list, emitting "Digest, username=...". The old regex parser skimmed past the junk, but the linear header scanner rightly rejects the encoder's own output, breaking codec round-trips. Mirror the encoder fixed on main by serverpod#360 (excluded from this backport): a single SP after the scheme (RFC 7235 2.1), quoted-string escaping with a control-character guard for text params, and bare tokens for algorithm, qop, and nc.
dart:io owns Transfer-Encoding framing and Connection handling: on a bodyless GET it waits for a chunked body the client never sends, on Dart 3.13+ HttpServer rejects an empty or unknown Transfer-Encoding coding at the protocol layer, and it drops an empty Connection request header. Ten round-trip tests hung for 30s or saw closed connections. Backport the test-side reshaping from serverpod#360 onto the 1.2 line: the affected Transfer-Encoding and empty-Connection cases move to direct unit tests in relic_core against the 1.2 parse API, keeping 1.2 semantics (chunked reordering, closed directive set). No runtime code changes.
Backported from serverpod#360 (RFC compliant typed headers) so the header-parsing security fixes can build on the same primitives as main. The files are deliberately not exported from relic_core.dart: they are an implementation detail here, and keeping them internal leaves the 1.2.x public API surface unchanged.
DigestAuthorizationHeader.headerValue joined the scheme into the comma-separated param list, emitting "Digest, username=...". The old regex parser skimmed past the junk, but the linear header scanner rightly rejects the encoder's own output, breaking codec round-trips. Mirror the encoder fixed on main by serverpod#360 (excluded from this backport): a single SP after the scheme (RFC 7235 2.1), quoted-string escaping with a control-character guard for text params, and bare tokens for algorithm, qop, and nc.
dart:io owns Transfer-Encoding framing and Connection handling: on a bodyless GET it waits for a chunked body the client never sends, on Dart 3.13+ HttpServer rejects an empty or unknown Transfer-Encoding coding at the protocol layer, and it drops an empty Connection request header. Ten round-trip tests hung for 30s or saw closed connections. Backport the test-side reshaping from serverpod#360 onto the 1.2 line: the affected Transfer-Encoding and empty-Connection cases move to direct unit tests in relic_core against the 1.2 parse API, keeping 1.2 semantics (chunked reordering, closed directive set). No runtime code changes.
Backported from serverpod#360 (RFC compliant typed headers) so the header-parsing security fixes can build on the same primitives as main. The files are deliberately not exported from relic_core.dart: they are an implementation detail here, and keeping them internal leaves the 1.2.x public API surface unchanged.
DigestAuthorizationHeader.headerValue joined the scheme into the comma-separated param list, emitting "Digest, username=...". The old regex parser skimmed past the junk, but the linear header scanner rightly rejects the encoder's own output, breaking codec round-trips. Mirror the encoder fixed on main by serverpod#360 (excluded from this backport): a single SP after the scheme (RFC 7235 2.1), quoted-string escaping with a control-character guard for text params, and bare tokens for algorithm, qop, and nc.
DigestAuthorizationHeader.headerValue joined the scheme into the comma-separated param list, emitting "Digest, username=...". The old regex parser skimmed past the junk, but the linear header scanner rightly rejects the encoder's own output, breaking codec round-trips. Mirror the encoder fixed on main by serverpod#360 (excluded from this backport): a single SP after the scheme (RFC 7235 2.1), quoted-string escaping with a control-character guard for text params, and bare tokens for algorithm, qop, and nc.
DigestAuthorizationHeader.headerValue joined the scheme into the comma-separated param list, emitting "Digest, username=...". The old regex parser skimmed past the junk, but the linear header scanner rightly rejects the encoder's own output, breaking codec round-trips. Mirror the encoder fixed on main by serverpod#360 (excluded from this backport): a single SP after the scheme (RFC 7235 2.1), quoted-string escaping with a control-character guard for text params, and bare tokens for algorithm, qop, and nc.
DigestAuthorizationHeader.headerValue joined the scheme into the comma-separated param list, emitting "Digest, username=...". The old regex parser skimmed past the junk, but the linear header scanner rightly rejects the encoder's own output, breaking codec round-trips. Mirror the encoder fixed on main by serverpod#360 (excluded from this backport): a single SP after the scheme (RFC 7235 2.1), quoted-string escaping with a control-character guard for text params, and bare tokens for algorithm, qop, and nc.
Backported from serverpod#360 (RFC compliant typed headers) so the header-parsing security fixes can build on the same primitives as main. The files are deliberately not exported from relic_core.dart: they are an implementation detail here, and keeping them internal leaves the 1.2.x public API surface unchanged.
DigestAuthorizationHeader.headerValue joined the scheme into the comma-separated param list, emitting "Digest, username=...". The old regex parser skimmed past the junk, but the linear header scanner rightly rejects the encoder's own output, breaking codec round-trips. Mirror the encoder fixed on main by serverpod#360 (excluded from this backport): a single SP after the scheme (RFC 7235 2.1), quoted-string escaping with a control-character guard for text params, and bare tokens for algorithm, qop, and nc.
Description
Overhaul typed headers to be fully (/more?) RFC compliant. Parsing is still lenient (except for security related headers), but construction (and serialization) is always strict.
Related Issues
Pre-Launch Checklist
Please ensure that your PR meets the following requirements before submitting:
///), ensuring consistency with existing project documentation.Breaking Changes
Many typed headers changed, both their shape (Dart interface) and semantics (behavior or parse, etc.).
Additional Notes
These changes are landing now in concert with serverpod 4.0
Summary by CodeRabbit
New Features
Bug Fixes & Improvements