Ephemeral wsgi.input stream makes it nearly impossible for plugins to change URL structure
|Reported by:||Owned by:||Jonas Borgström|
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:11 Changed 8 years ago by
- Resolution set to worksforme
- Status changed from reopened to closed