Are input streams seekable in Zope?
Hi, I've stumbled over some code in Zope 2.7.0 that seems to suggest that input streams are meant to be seekable. In an extension I wrote for ZServer, i.e. AJPServer, I throw an exception when this is tried and I'm quite sure the call to seek wasn't there in 2.6.x. I found the call to seek in ZPublisher.HTTPRequest.py, line 128, in method "retry". Does this mean that only seekable streams are allowed in ZPublisher (i.e. not stdin) or is this a bug? TIA, andreas
Ames Andreas (MPA/DF) wrote:
I've stumbled over some code in Zope 2.7.0 that seems to suggest that input streams are meant to be seekable. In an extension I wrote for ZServer, i.e. AJPServer, I throw an exception when this is tried and I'm quite sure the call to seek wasn't there in 2.6.x. I found the call to seek in ZPublisher.HTTPRequest.py, line 128, in method "retry".
Does this mean that only seekable streams are allowed in ZPublisher (i.e. not stdin) or is this a bug?
When the object database raises a ConflictError, ZPublisher makes 3 attmpts (by default) to "retry" the request (in most cases, the request can succeed when retried). Is there a reason why the AJP protocol won't allow you to "rewind" to the beginning of the request stream? I don't think that the publisher does any other seek than to the start of the stream. Perhaps you need to derive an AJPRequest from HTTPRequest, and arrange not to need the 'stidn' stream during a retry; another possibility would be to submit a patch which allowed the retry mechanism to work without re-parsing the request stream (basically, the patch would need to clone the cgi.FieldRequest set from the original request into the one used for the retry). Tres. -- =============================================================== Tres Seaver tseaver@zope.com Zope Corporation "Zope Dealers" http://www.zope.com
Ames Andreas (MPA/DF) wrote at 2004-7-30 15:44 +0200:
I've stumbled over some code in Zope 2.7.0 that seems to suggest that input streams are meant to be seekable. In an extension I wrote for ZServer, i.e. AJPServer, I throw an exception when this is tried and I'm quite sure the call to seek wasn't there in 2.6.x. I found the call to seek in ZPublisher.HTTPRequest.py, line 128, in method "retry".
Does this mean that only seekable streams are allowed in ZPublisher (i.e. not stdin) or is this a bug?
ZServer usually streams the input stream via a temporary file. Therefore, ZPublisher can expect that its "stdin" is indeed seekable. As you found out, this is necessary when a request needs to be retried. -- Dieter
participants (3)
-
Ames Andreas (MPA/DF) -
Dieter Maurer -
Tres Seaver