Message98513
Calling getresponse() on an httplib.HTTPConnection object returns a response object. Internally, the self.sock is handed over to the HTTPResponse object which transforms it into a file-like object. The response object is returned to the caller. If one calls response.read() later on, no or incomplete content will be returned because the underlying socket has been closed.
The code path, simplified:
class HTTPConnection:
def getresponse(self):
response = self.response_class(self.sock, ...)
...
if response.will_close:
# this effectively passes the connection to the response
self.close()
def close(self):
if self.sock:
self.sock.close()
...
class HTTPResponse:
def __init__(self, sock, debuglevel=0, strict=0, method=None):
self.fp = sock.makefile('rb', 0)
... |
|
Date |
User |
Action |
Args |
2010-01-29 15:01:51 | Robert.Buchholz | set | recipients:
+ Robert.Buchholz |
2010-01-29 15:01:51 | Robert.Buchholz | set | messageid: <1264777311.04.0.988942468984.issue7806@psf.upfronthosting.co.za> |
2010-01-29 15:01:48 | Robert.Buchholz | link | issue7806 messages |
2010-01-29 15:01:47 | Robert.Buchholz | create | |
|