-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
[server] Unhandled exception when None in header values #2742
Comments
I could open a PR to add a check inside the list comprehension (with tests) if you agree. |
For json response proper fix is likely to be a custom JSONEncoder, which understands that |
The problem is not on the JSONEncoder it's on |
Oh, I misread the second handler. In this case, it should be 500 Internal Server Error on the HTTP layer + maybe better exception raised from header conversion part |
A bad type for header value should produce 500 with exception info anyway. |
Ok, since there seems to be a consensus that the server shouldn't handle it silently I'll look into adding a 500 Error for this case during the weekend :) |
Andrew, I think raising exception is for developer (and ops/qa) anyway :) Not sure why you mentioned web-app's end-user. End-user of the framework is a developer and good UX for them is comprehensive exception + error message. |
We had a bug in http parser that sometimes emitted None. Fixed |
Long story short
When a dictionary is passed to the
headers
kwarg (in any response, either returned or raised) and a value in this dictionary isNone
, an unhandled exception is raised that results in the client getting no response at all.Expected behavior
The expected behavior would be to handle it in the same way an empty string header is handled (i.e. discard it) or to catch the exception so that a 500 error can be returned.
Actual behavior
No response arrives at the client.
Steps to reproduce
The Traceback:
Your environment
OS version : Linux deb9 4.9.0-3-amd64 #1 SMP Debian 4.9.30-2+deb9u5 (2017-09-19) x86_64 GNU/Linux
Python version : 3.6.4
aiohttp server version: 3.0.1
The text was updated successfully, but these errors were encountered: