-
Notifications
You must be signed in to change notification settings - Fork 102
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
Update WSGIWrapper to be spec compliant (pep 333/3333). #155
Conversation
The commit contains the following changes: * Error out early if the application forgets to call start_response * Send a proper content-length if the iterable returned has only one item * Always call `close()` on the returned iterable if it exists.
@pgjones Could you reapprove that workflow? I have added a few tests and improved the code so no unnecessary For what it is worth I'd consider this a rather critical bug. Not calling |
1b2fc94
to
f557d9c
Compare
Thanks, I've taken a different approach in 2d2c62b. I've tested other implementations and gunicorn and I don't believe any others set the content-length (rather they'll use chunked transfer encoding). So I've decided against this to avoid the complexity. As I understand PEP 3333 considers this optional. |
Mhm, yeah as long as the framework sets |
Thanks for opening the PR, it was very helpful - sorry I didn't merge it directly. I'm often conflicted between accepting the PR as is, and wanting it to match "my style" - I usually try both (merge the PR then add a commit adjusting it). |
No worries, the most important thing is that the underlying issue is fixed and we have one hard issue less to debug in Django. That said I wonder if it would make sense to utilize https://github.com/abersheeran/a2wsgi instead, though that would need trio support first (maybe through anyio). This way we would only need to improve the asgi -> wsgi mapping in one place (uvicorn uses it as well). Maybe @abersheeran can chime in as well.
…On Wed, Dec 27, 2023, at 23:35, Phil Jones wrote:
Thanks for opening the PR, it was very helpful - sorry I didn't merge
it directly. I'm often conflicted between accepting the PR as is, and
wanting it to match "my style" - I usually try both (merge the PR then
add a commit adjusting it).
—
Reply to this email directly, view it on GitHub
<#155 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAT5C4MLBVWBJN4J7AYVM3YLSPB3AVCNFSM6AAAAAA7IFCATOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZQGY3DQNJZGE>.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
I can't add any more dependencies if I want Hypercorn to be considered as the replacement for the Werkzeug development server. Happy to work with a2wsgi though and link to it in the docs. |
The commit contains the following changes:
close()
on the returned iterable if it exists.This potentially fixes #154. Haven't looked at tests yet, but should provide a base for discussion…