Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unhandled exception via invalid configuration or request #3197

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

pajod
Copy link
Contributor

@pajod pajod commented Apr 26, 2024

Whenever "string %r" % single_arg is used, the string formatting can raise confusing exception whenever single_arg is a tuple with more than one item.

This is exposed via invalid configuration read from a python configuration file, or more likely and seriously because of the switched Exception argument type in 7ebe442 whenever refusing requests based on their (parsed) version tuple. The latter affecting only the case where gunicorn can receive such requests (read: not sitting behind Nginx) and only the 22.0.0 release.

Solution: Make the argument string-only again, and for good measure wrap the string argument in a tuple unconditionally, which also helps with automatically converting it to "string {!r}".format(single_arg) or even f"string {single_arg!r}" later on.

@pajod pajod marked this pull request as ready for review April 26, 2024 12:02
@pajod pajod changed the title unhandled exception via invalid configuration or reqest unhandled exception via invalid configuration or request Apr 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

InvalidHTTPVersion / TypeError: not all arguments converted during string formatting
1 participant