[Twisted-web] twisted.web2.stream.IStream.reset()?

Scott Lamb slamb at slamb.org
Fri Sep 23 15:27:41 MDT 2005


Hi David and all,

I stumbled across your twisted web2-client branch from google. I need  
to make a specialized HTTP load generator that uses Keep-Alives.  
twisted.web2.client seems the best way, so I'm trying to make this  
branch work for me.

My load generator needs to make a bunch of sequences of authenticated  
POSTs, picking up a cookie along the way.

I've stumbled onto a bug: the first request will return a  
401Unauthorized. HTTPClientFactory.handleStatus_401 deals with  
this...but the postdata is gone.

This code generates the new request:

                 req = Request(request.method, request.uri,  
request.args,
                               request.headers, request.stream)

It looks like web2.stream.IStream is single-use - it returns a None  
when there's no more data. I think this - or maybe a  
IResettableStream subclass - needs a reset() method.

I've got a patch that allowed me to proceed. I wouldn't recommend  
applying as-is - I only messed with the MemoryStream that I'm using,  
and there's no unit test. I want to send this in before I forget  
about it, though.

Regards,
Scott

-- 
Scott Lamb <http://www.slamb.org/>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: stream-kludgey-reset.patch
Type: application/octet-stream
Size: 2207 bytes
Desc: not available
Url : http://twistedmatrix.com/pipermail/twisted-web/attachments/20050923/9c122164/stream-kludgey-reset.obj
-------------- next part --------------



More information about the Twisted-web mailing list