This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Robert.Buchholz
Recipients Robert.Buchholz
Date 2010-01-29.15:01:46
SpamBayes Score 0.030780844
Marked as misclassified No
Message-id <1264777311.04.0.988942468984.issue7806@psf.upfronthosting.co.za>
In-reply-to
Content
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)
        ...
History
Date User Action Args
2010-01-29 15:01:51Robert.Buchholzsetrecipients: + Robert.Buchholz
2010-01-29 15:01:51Robert.Buchholzsetmessageid: <1264777311.04.0.988942468984.issue7806@psf.upfronthosting.co.za>
2010-01-29 15:01:48Robert.Buchholzlinkissue7806 messages
2010-01-29 15:01:47Robert.Buchholzcreate