Repository navigation
Conversation
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.
Problem
get_expired_cookies()givesExpirespriority overMax-Age. RFC 6265 section 4.1.2.2 specifies the reverse: https://www.rfc-editor.org/rfc/rfc6265.html#section-4.1.2.2A response such as
Set-Cookie: cookie2=bar; Max-Age=3600; Expires=Thu, 01-Jan-1970 00:00:00 GMT; Path=/is accepted by Requests, but HTTPie's extra expiration pass then removes the valid cookie from the persisted session. The next request losescookie2=bar. Conversely,Max-Age=0combined with a future Expires does not mark a cookie for removal.Change
Let the existing valid Max-Age conversion override Expires. Invalid Max-Age values still fall back to Expires. Update the malformed-Expires regression: a valid Max-Age remains authoritative even when the date is malformed.
This is separate from #1914's signed Max-Age parsing; the current digit-only parsing is unchanged.
Verification
python -m pytest tests/test_sessions.py tests/test_cookie.py -q -o addopts='': 68 passed (existing resource/deprecation warnings).python -m flake8 httpie/utils.py tests/test_sessions.pyandgit diff --checkpassed.AI assistance disclosure: OpenAI Codex investigated, implemented, tested, and drafted this PR description.