Repository navigation
Conversation
Co-authored-by: generaltony007 <[email protected]>
Co-authored-by: generaltony007 <[email protected]>
Co-authored-by: generaltony007 <[email protected]>
Co-authored-by: generaltony007 <[email protected]>
Co-authored-by: generaltony007 <[email protected]>
Co-authored-by: generaltony007 <[email protected]>
Co-authored-by: generaltony007 <[email protected]>
Co-authored-by: generaltony007 <[email protected]>
2 tasks done
Contributor
Author
|
Could a maintainer give this HTTP/1 connection-option case fix a human review and advise on the next step? The earlier autofix-job question in #8522 also covered this PR. Please let me know if changes are needed or if you'd prefer it closed. Thanks. |
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.
Description
HTTP/1 connection options are case-insensitive (RFC 9110, section 7.6.1), but
connection_close()currently compares tokens against lowercase literals without normalizing them. As a result,Connection: CloseorCLOSEdoes not close an HTTP/1.1 connection, andConnection: Keep-Alivedoes not keep an HTTP/1.0 connection open.Normalize the tokens locally for the persistence decision. Keep close precedence, complete-token matching, original header values, and the generic header-token helper unchanged.
Add eight helper cases covering mixed/uppercase options, HTTP/1.0 keep-alive, repeated fields, close precedence, header nonmutation, and lookalike tokens. Add six HTTP/1 client/server Playbook regressions that assert the actual
CloseConnectioncommand. Thirteen of the fourteen new cases fail without the source fix; the lookalike-token control already passes.Validation on main
6debf65b612abc726fe9cabe5c2a1ebb1cb36df4:uv run pytest test/mitmproxy/net/http/http1 test/mitmproxy/proxy/layers/http: 260 passed.test/mitmproxy --ignore=test/mitmproxy/tools: 1886 passed, 1 skipped, 1 environment failure creating a TUN device. The TUN failure also reproduces without the source fix.mitmproxy/net/httpandmitmproxy/proxypassed (46 source files).RFC: https://www.rfc-editor.org/rfc/rfc9110.html#section-7.6.1
Checklist