Core: Read REST response headers without regard to case - #17979
Open
moomindani wants to merge 1 commit into
Open
Core: Read REST response headers without regard to case#17979moomindani wants to merge 1 commit into
moomindani wants to merge 1 commit into
Conversation
Freshness-aware table loading did nothing when the catalog server wrote the ETag response header in any spelling other than ETag. HTTPClient collected response headers into a map keyed by the name exactly as received and RESTSessionCatalog copied that into another HashMap and read the tag back as HttpHeaders.ETAG, so a server sending etag left the table cache empty, no later load sent If-None-Match, and nothing surfaced that the server had answered with a tag. Header field names are case-insensitive (RFC 9110) and lowercase is mandatory in HTTP/2 (RFC 9113), so the spelling a server chose cannot decide whether a client finds the header. Both maps are now case-insensitive.
uros-b
approved these changes
Sep 6, 2026
uros-b
left a comment
Member
There was a problem hiding this comment.
Looks like a correct, minimal, RFC 9110-grounded fix for a real HTTP/2 and lowercase-header-normalization interop bug: both collection points must be case-insensitive for the ETag round-trip to work, both edits are present, and both new tests trace the full path and fail on an unfixed tree. The sole red CI check is an unrelated Gradle-wrapper infra flake. Otherwise, should be good to go! Thank you @moomindani.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #17978.
Freshness-aware table loading did nothing at all when the catalog server wrote the
ETagresponse header in any spelling other thanETag.HTTPClientcollected response headers into a map keyed by the name exactly as received,RESTSessionCatalogcopied that into anotherHashMapand read the tag back asHttpHeaders.ETAG, so a server that sentetaglefttableCacheempty. No later load sentIf-None-Match, and nothing surfaced the fact that the server had answered with a tag.Header field names are case-insensitive (RFC 9110 section 5.1), and lowercase is mandatory in HTTP/2 (RFC 9113 section 8.2.1), so a client cannot key on the spelling a server happened to choose. Both maps are now case-insensitive, which fixes the lookup without changing what callers see otherwise.
I hit this against an Armeria-based catalog server, which writes HTTP/1 header names in their lowercase HTTP/2 form by default: the server returned a correct
ETagfor a conditionalloadTableand the client could not see it. The same applies to any server reached over HTTP/2.Tests:
TestHTTPClient.responseHeadersAreReadWithoutRegardToCasehas the mock server answer withetagand asserts the map handed to the caller resolves both spellings, covering the collection point.TestFreshnessAwareLoading.freshnessAwareLoadingWithLowercaseETagHeaderdrives a catalog through an adapter that reports its response headers lowercased, and asserts the table cache is still populated and the second load is answered from it, covering the consumer../gradlew :iceberg-core:test --tests "org.apache.iceberg.rest.*"passes.