fix(http): isolate project cache keys by scheme & host#7043
fix(http): isolate project cache keys by scheme & host#7043dwisiswant0 wants to merge 1 commit intodevfrom
Conversation
Prev. project keyed cache lookups from dumped HTTP
request bytes alone. For eq requests, this allowed
"http" and "https" targets to collide and reuse
cached responses across schemes.
Derive a scoped cache key by prefixing normalized
scheme://host before `projectfile.{Get,Set}`
keying input in the HTTP protocol path.
Close #6866
Signed-off-by: Dwi Siswanto <git@dw1.io>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review infoConfiguration used: Organization UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (3)
WalkthroughThis change implements scheme and host-scoped cache keys for HTTP requests in the project cache system. Previously, the cache key was based solely on the dumped request, causing responses from HTTPS requests to be incorrectly reused for HTTP requests and vice versa. The fix computes a new cache key that combines the request dump with scheme and host information when available. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Comment |
Proposed changes
Prev. project keyed cache lookups from dumped HTTP
request bytes alone. For eq requests, this allowed
"http" and "https" targets to collide and reuse
cached responses across schemes.
Derive a scoped cache key by prefixing normalized
scheme://host before
projectfile.{Get,Set}keying input in the HTTP protocol path.
Close #6866
Proof
Patch is in
httppackage because only HTTP knows the missing context (schemeand effectivehost:port) at request-build time.projectfileis a generic byte-key store so if it guessed scope from raw bytes, it would duplicate protocol parsing logic and risk breaking non-HTTP callers. (HTTP adds the scope beforeGet/Set, andprojectfileremains protocol-agnostic and reusable, maybe, for future use).Checklist
Summary by CodeRabbit
Improvements
Tests