httplib: response.read() vs response.read(size)
Doug Fort
dougfort at downright.com
Thu Feb 1 20:28:49 EST 2001
We're developing a website load testing application
(http://www.stressmy.com). We give httplib a pretty good workout. And
generally get excellent results. Recently, we ran into a pair of unrelated
sites that use some form of graphics server (Netscape-Enterprise/4.1).
There, our simulated users hung up waiting for a read on the socket in the
httplib.HTTPResponse.read(). The code looks like this (with a lot of
deletions)
self._client = httplib.HTTPConnection("", None)
...
response = self._client.getresponse()
...
self._data = response.read()
I was able to work around this with the following:
if response.length:
self._data = response.read(response.length)
else:
self._data = response.read()
My question is: should this be moved up into httplib.HTTPResponse.read()?
I'm posting this here, instead of sending a bug or a diff to SourceForge
because I really don't understand the new HTTP 1.1 state machine in httplib,
and I don't want to aggravate the developers with bogus bugs or dumb patches
while they're working on 2.1.
--
Doug Fort
Senior Meat Manager
Downright Software LLC
http://www.dougfort.net
More information about the Python-list
mailing list