Skip to content

fix: match the ETag response header case-insensitively - #484

Open
thweetkomputer wants to merge 1 commit into
mainfrom
fix/etag-case-insensitive
Open

fix: match the ETag response header case-insensitively#484
thweetkomputer wants to merge 1 commit into
mainfrom
fix/etag-case-insensitive

Conversation

@thweetkomputer

Copy link
Copy Markdown
Collaborator

Problem

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:) — curl negotiates HTTP/2 by default over TLS (CURL_HTTP_VERSION_2TLS), 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 neither If-Match nor If-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-testable AsyncHttpManager::ParseETagHeader.

Test

object_store_etag unit 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 sends ETag). It asserts ETag:, lowercase etag:, and mixed-case Etag:\t… all parse, and that non-ETag / empty / too-short lines are rejected.

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).
@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@thweetkomputer, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 50 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c86f4724-021a-4d53-a2d5-0384648cc3a3

📥 Commits

Reviewing files that changed from the base of the PR and between 8ba2b33 and 9b3d25f.

📒 Files selected for processing (4)
  • include/storage/object_store.h
  • src/storage/object_store.cpp
  • tests/CMakeLists.txt
  • tests/object_store_etag.cpp
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/etag-case-insensitive

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant