[Zope-dev] Re: Are input streams seekable in Zope?

Tres Seaver tseaver at zope.com
Fri Jul 30 15:35:45 EDT 2004


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 at zope.com
Zope Corporation      "Zope Dealers"       http://www.zope.com



More information about the Zope-Dev mailing list