Repository navigation
MINOR: [Flight] Fix cookie header parsing in ServerSessionMiddleware - #1517
Merged
Merged
Conversation
Arawoof06
requested review from
jbonofre,
laurentgo,
lidavidm and
wgtmac
as code owners
November 23, 2026 12:50
jbonofre
approved these changes
Nov 23, 2026
jbonofre
left a comment
Member
There was a problem hiding this comment.
LGTM, thanks for fixing this!
The updated RFC 6265 cookie parsing in ServerSessionMiddleware.Factory.onCallStarted cleanly resolves the multi-cookie and = in value issues.
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.
What's Changed
ServerSessionMiddleware.Factory.onCallStartedsplits thecookieheader on" ;"(space, then semicolon) and then on every=. Clients send cookie lists asname=value; name=value(RFC 6265, and whatClientCookieMiddlewareand the C++ Flight client produce), so as soon as any other cookie is present, for example a load balancer affinity cookie, the whole header becomes one token with two or more=, the loop gives up, andarrow_flight_session_idis never found. The call is then served without a session and any options set throughSetSessionOptionsare silently gone. A session id that itself contains=(base64 padding) is truncated and rejected with NOT_FOUND.The parser now splits on
;, splits each pair at the first=, trims, strips surrounding double quotes, and skips a malformed entry instead of abandoning the rest of the header, which is what the C++ServerSessionMiddlewareFactory::ParseCookieStringdoes. A header holding onlyarrow_flight_session_id=<id>behaves exactly as before.TestServerSessionMiddlewarecovers the single-cookie, multi-cookie, quoted,=-containing, malformed, second-header, missing and unknown-id cases; four of them fail onmain.