Patch: let non-seekable streams be input for ZPublisher (updated)
Hi, I had a thinko in my previous patch (http://mail.zope.org/pipermail/zope-dev/2004-August/023630.html) which is corrected in the attached version of the patch. Sorry for any inconvenience, I might have caused. As I'm sort of protocol challenged (thanks to corporate firewall), svn unfortunately isn't an option for me. Thus I created the patch against lib/python/ZPublisher/HTTPRequest.py as released in 2.7.2-0. As the patch is almost trivial it shouldn't be a problem to apply it even manually against other vesions (at least 2.7.0, 2.7.1 and 2.7.2 should work OOTB i.e. by using /usr/bin/patch). To sum up its purpose again: It's meant to avoid the stdin.seek() call in the HTTPRequest class so that non-seekable streams can be used as stdin. It also potentially avoids unnecessary (blocking) disk I/O in retries (this depends on the according request that's being worked on) and repeated request parsing in cgi.FieldStorage. The immediate cause for the patch is that AJPServer uses non-seekable streams as input for the ZPublisher. To change this locally I'd need to go with disk buffering. Nevertheless I think this could provide a general performance improvement. To this end I just save the cgi.FieldStorage instance, that is created by HTTPRequest.processInputs, when the request is worked upon for the first time, across retry boundaries. Questions: - Is this the right forum/place to send patches to? - Is there any chance that this could be applied to Zope's mainline? (If not I will proceed with a local disk buffering scheme in the long term.) cheers, andreas
Em Qua, 2004-08-18 às 12:22, Ames Andreas (MPA/DF) escreveu:
[...] Questions:
- Is this the right forum/place to send patches to?
This is the right forum to discuss the patches, and to send them for evaluation if it's a small one, like yours. The best place to actually send patches to is as attachment in a bug report in the Zope bug collector.
- Is there any chance that this could be applied to Zope's mainline? (If not I will proceed with a local disk buffering scheme in the long term.)
Yes, if you file a feature request on the bug collector, which can be found at: http://collector.zope.org/Zope Cheers, Leo
Ames Andreas (MPA/DF) wrote at 2004-8-18 17:22 +0200:
I had a thinko in my previous patch (http://mail.zope.org/pipermail/zope-dev/2004-August/023630.html) which is corrected in the attached version of the patch. Sorry for any inconvenience, I might have caused.
I do not think that your patch can work: The "FieldStorage" must be rebuilt, because it can contain file objects. These file objects must be reset as they may have been (partially) read in the previous request. This prevent reusing the previous "FieldStorage". -- Dieter
participants (3)
-
Ames Andreas (MPA/DF) -
Dieter Maurer -
Leonardo Rochael Almeida