Repository navigation
Conversation
hackney:cookies/1 crashed with a case_clause error when a Set-Cookie value parsed to no cookie at all: an empty value, one holding only separators, or a single $-prefixed name. Such headers are now skipped.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
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
hackney:cookies/1crashes with{case_clause, []}when aSet-Cookieheader holds no cookie:Why
hackney_cookie:parse_cookie/1returns[]for an empty value, for a value made only of separators (" ; "), and for a single$-prefixed name ($Version=1), which it skips.cookies/1only handles{error, _}and a non-empty list, so one such header makes the whole call fail, and the other cookies in the response are lost with it.These headers are now skipped, like the ones
parse_cookie/1rejects.How to test
hackney_cookie_tests:cookies_test_/0passes an empty header, a header with only separators, a$Version=1header and a normal cookie. It fails with thecase_clauseerror without the change and returns the normal cookie with it.rebar3 eunit --module=hackney_cookie_testspasses (27 tests), andrebar3 xrefandrebar3 dialyzerare clean (OTP 28).