Repository navigation
Conversation
…code#1109) HTTPHeaders.get() joins repeated headers with commas, so a multi-value field such as List received the joined string split into characters. Use HTTPHeaders.get_list() for multi-value keys instead.
Collaborator
|
I hesitated about this because, unlike the others, the fix is at least plausible on the surface. But upon consideration, this PR violates our AI Policy and there's no need to entertain it further. |
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.
Fixes #1109.
Summary
WebArgsTornadoMultiDictProxy.__getitem__reads values withself.data.get(key). For atornado.httputil.HTTPHeaders,get()joins repeated headers with commas. For a multi-value key, the proxy then iterates over that string, so aListfield receives the joined header split into characters:Changes
HTTPHeaders.get_list()when the data is anHTTPHeaders. Query, form and file arguments are already lists, so they are unchanged.Tests
The existing header tests build the request from a plain
dict, which is why they did not catch this. Two new tests inTestHeadersArgsuse a realHTTPHeaders, with a repeated header and with a single header. Both fail ondev.pytest: 505 passed, 4 skipped.pre-commit run --all-filespasses (ruff, mypy, blacken-docs, ...).