fix: match the ETag response header case-insensitively - #484
fix: match the ETag response header case-insensitively#484thweetkomputer wants to merge 1 commit into
Conversation
AsyncHttpManager::HeaderCallback extracted the ETag with a byte-exact
"ETag:" prefix compare. HTTP header names are case-insensitive and HTTP/2
delivers them lowercased ("etag:"), and curl negotiates HTTP/2 by default
over TLS, so against an h2 endpoint (e.g. GCS) task->etag_ stayed empty.
BootstrapUpsertTermFile then issued the term-file update with an empty
ETag, so SetupUploadRequest added no If-Match/If-None-Match -- the
compare-and-swap that fences zombie writers after failover silently
became an unconditional PUT, reopening the split-brain window it exists
to close. AWS S3 (HTTP/1.1) and the plain-HTTP MinIO CI config send
"ETag" and were unaffected, so tests never caught it.
Match the header name case-insensitively (strncasecmp). The ETag parsing
is extracted into a pure, unit-testable AsyncHttpManager::ParseETagHeader
so the case handling can be tested offline without an HTTP/2 server (the
e2e MinIO path cannot reproduce it).
|
Warning Review limit reached
Next review available in: 50 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Problem
AsyncHttpManager::HeaderCallbackextracted the ETag with a byte-exact"ETag:"prefix compare. HTTP header names are case-insensitive, and HTTP/2 delivers them lowercased (etag:) — curl negotiates HTTP/2 by default over TLS (CURL_HTTP_VERSION_2TLS), so against an h2 endpoint (e.g. GCS)task->etag_stayed empty.BootstrapUpsertTermFilethen issued the term-file update with an empty ETag, soSetupUploadRequestadded neitherIf-MatchnorIf-None-Match: the compare-and-swap that fences zombie writers after failover silently degraded to an unconditional PUT, reopening the split-brain window it exists to close (two nodes can both "win" the term-file CAS and write the same partitions).AWS S3 (HTTP/1.1) and the plain-HTTP MinIO CI config send
ETag(capitalized) and were unaffected — which is exactly why existing tests never caught it.Fix
Match the header name case-insensitively (
strncasecmp); the value is untouched. The ETag parsing is extracted into a pure, unit-testableAsyncHttpManager::ParseETagHeader.Test
object_store_etagunit test feeds the parser header lines directly, so the case handling is exercised offline — no HTTP/2 server needed (the e2e MinIO path can't reproduce this, since MinIO sendsETag). It assertsETag:, lowercaseetag:, and mixed-caseEtag:\t…all parse, and that non-ETag / empty / too-short lines are rejected.