#3585 defect closed fixed (fixed)
If the Content-Type of a request is "application/x-www-form-urlencoded", twisted.web.wsgi gives applications a zero-length input object
Reported by: | wangchun | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | web | Keywords: | |
Cc: | mattc | Branch: |
branches/wsgi-form-post-3585
branch-diff, diff-cov, branch-cov, buildbot |
Author: | exarkun |
Description (last modified by )
Sometimes twisted.web.http.Request.requestReceived
reads from the body object (Request.content
) and parses the result into Request.args
. Then it calls process. If a twisted.web.wsgi.WSGIResource
is getting the request, it will be passed on as the wsgi.input in the environ
to application code. This means that sometimes a wsgi application will get an already-read input and not be able to get the request body.
Attachments (2)
Change History (13)
Changed 9 years ago by
comment:1 Changed 9 years ago by
Description: | modified (diff) |
---|---|
Summary: | [PATCH] Request.content should be rewinded to the beginning before Request.process is called → If the Content-Type of a request is "application/x-www-form-urlencoded", twisted.web.wsgi gives applications a zero-length input object |
comment:2 Changed 9 years ago by
Cc: | mattc added |
---|
wangchun's fix seems fine to me. What's the next step?
comment:5 Changed 9 years ago by
Owner: | jknight deleted |
---|
comment:6 Changed 9 years ago by
Keywords: | review removed |
---|---|
Owner: | set to Jean-Paul Calderone |
The patch basically looks good to me. I've adjusted it a bit to deal with trivial coding standard issues and to be less specific in the prediction added to the unit tests, though.
comment:7 Changed 9 years ago by
Author: | → exarkun |
---|---|
Branch: | → branches/wsgi-form-post-3585 |
(In [26120]) Branching to 'wsgi-form-post-3585'
comment:8 Changed 9 years ago by
comment:9 Changed 9 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
(In [26123]) Merge wsgi-form-post-3585
Author: mattc, exarkun Reviewer: exarkun Fixes: #3585
Ensure that Request.content
is always positioned at the beginning of
the file before calling the process
method. This simplifies handling
request bodies by making it never necessary to explicitly seek back to
the beginning of the file.
comment:11 Changed 7 years ago by
Owner: | Jean-Paul Calderone deleted |
---|
Adjusting summary and description to more directly describe the problem, rather than describing a possible solution. The old description was: