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

chunked encoding bug with latest version of django. #1264

Closed
benoitc opened this issue May 14, 2016 · 7 comments
Closed

chunked encoding bug with latest version of django. #1264

benoitc opened this issue May 14, 2016 · 7 comments

Comments

@benoitc
Copy link
Owner

benoitc commented May 14, 2016

Following the discussing on #605 :
#605 (comment)

Django doesn't handle anymore chunked encoded requests. Not sure how to fix it yet.

@benoitc
Copy link
Owner Author

benoitc commented May 14, 2016

cc @jezdez maybe you know if there have been some discussions about it?

benoitc added a commit that referenced this issue May 14, 2016
…uests

After looking at the code of Django or Werkzeug it seems that some WSGI frameworks considers that the body is empty when the `CONTENT_LENGTH` environ key is not present:

- django: https://github.com/django/django/blob/master/django/core/handlers/wsgi.py#L109-L112
- https://github.com/pallets/werkzeug/blob/master/werkzeug/wsgi.py#L205-L210

So waiting for a better  spec set the size to max since we know that Gunicorn is able to handle chunked encoding.

fix #1264
@benoitc
Copy link
Owner Author

benoitc commented Oct 16, 2016

ok I'm not sure what to do with this solution, maybe we should just force the usage of content-length for frameworks that don't handle HTTP 1.1 ? cc @tilgovi @berkerpeksag

@berkerpeksag
Copy link
Collaborator

If I remember correctly, Django handles HTTP 1.1. The lines you mentioned in #605 (comment) haven't changed since 5 years and the OP's Django version is a little bit old. I haven't read the whole discussion in #605 and tried the test project yet so I might be missing something here. Perhaps @timgraham or @claudep can chime in.

@claudep
Copy link

claudep commented Oct 17, 2016

I don't remember anything about Django supporting chunked transfer encoding at the request side. It might well be a missing feature in Django.

@timgraham
Copy link
Contributor

I don't know much about the specifics, but a quick search indicates "This is a not a Django issue. It is a limitation of the WSGI specification itself in as much as the WSGI specification prohibits use of chunked request content by requiring a CONTENT_LENGTH value for request." -Graham Dumpleton

http://stackoverflow.com/a/12091479

@benoitc
Copy link
Owner Author

benoitc commented Oct 17, 2016

i know what the spec says. But some frameworks allow to bypass this rule.
It also used to work with oldest versions of django. and for sure it won't
be removed fr gunicorn.

Anyway like i says we have limited options since i've never been answered
on that topic.so i propose to introduce a --strict option that would
default to true for django. strict would meanbin this case to return a 411
error. thoughts?
On Mon, 17 Oct 2016 at 13:38, Tim Graham notifications@github.com wrote:

I don't know much about the specifics, but a quick search indicates "This
is a not a Django issue. It is a limitation of the WSGI specification
itself in as much as the WSGI specification prohibits use of chunked
request content by requiring a CONTENT_LENGTH value for request." -Graham
Dumpleton

http://stackoverflow.com/a/12091479


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#1264 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAA4ogm1AL3qgR0OtgujM477VCr6_Wguks5q015OgaJpZM4Ieo5b
.

@benoitc
Copy link
Owner Author

benoitc commented Nov 22, 2019

no feedback given. closing the issue.

@benoitc benoitc closed this as completed Nov 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Bugs
Other
Development

Successfully merging a pull request may close this issue.

4 participants