Repository navigation
Preserve caller value lists in MultiDict.set_all - #8521
Merged
mhils merged 6 commits intoOct 25, 2026
Merged
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]>
2 tasks done
mhils
enabled auto-merge (squash)
October 25, 2026 18:50
Contributor
Author
|
Thanks for reviewing and merging this and the cookie expiry fix! |
lups2000
pushed a commit
to lups2000/mitmproxy
that referenced
this pull request
Oct 31, 2026
* fix: preserve caller value lists in MultiDict.set_all Co-authored-by: generaltony007 <[email protected]> * test: preserve reusable MultiDict input lists Co-authored-by: generaltony007 <[email protected]> * test: reuse query values across requests Co-authored-by: generaltony007 <[email protected]> * docs: note preserved MultiDict input values Co-authored-by: generaltony007 <[email protected]> * [autofix.ci] apply automated fixes --------- Co-authored-by: generaltony007 <[email protected]> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Maximilian Hils <[email protected]>
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
MultiDict.set_all()consumes its caller's list withpop(0). This also affectsMultiDictView, includingRequest.queryand request cookies.For example, an addon applying the same query values to two flows silently drops the parameter from the second flow:
The first call empties
values, so the second call removesidrather than assigning it. Copy the list before consuming it. Existing field order, duplicate-key handling, capitalization and removal behavior stay unchanged. This does not changeHeaders.set_all(), which already materializes its own list.Tests cover empty, single and multiple replacement values against absent, single and case-insensitive duplicate keys, plus reuse through two real
Request.queryviews while preserving an unrelated parameter. Seven new cases fail on unchanged base9125647; all ten pass with the fix.Validation in a separate current-main tree, without the changes from #8518 or #8520:
No full tools test suite, live proxy session or Windows/macOS run was performed.
Checklist