Ephemeral wsgi.input stream makes it nearly impossible for plugins to change URL structure
|Reported by:||Dave Abrahams <dave@…>||Owned by:||jonas|
See, for example, the TracForge project list.
Some information is lost as req.args is constructed, and all of that information needs to be reassembled exactly as-is for, e.g. file upload (which uses a multipart-formdata request), even though the plugin may not even be interested in touching it (as in the case of TracForge). Python gives us no facility for undoing the parsing of cgi.FieldStorage, so anyone attempting this sort of hook will have to repeat an extremely complicated series of steps; it would be better to capture the request in a string that can be reused.
The following simple patch remedies the problem:
old new 434 434 args = _RequestArgs() 435 435 436 436 fp = self.environ['wsgi.input'] 437 438 439 440 441 437 442 438 443 # Avoid letting cgi.FieldStorage consume the input stream when the 439 444 # request does not contain form data
Change History (12)
comment:9 Changed 6 years ago by Dave Abrahams <dave@…>
- Resolution set to fixed
- Status changed from new to closed
comment:10 Changed 6 years ago by eblot
- Resolution fixed deleted
- Status changed from closed to reopened
comment:11 Changed 6 years ago by eblot
- Resolution set to worksforme
- Status changed from reopened to closed