Mercurial > cpython-lru_cache-weakref
diff Lib/httplib.py @ 42497:17cdbedbb15d
Fix several failing tests in test_urllib2net.
The HTTPResponse object is being passed to BufferedReader, but it
wasn't designed to be used that way. These changes extend the hacks
that have already been made in urllib2 to get the tests to pass.
The hacks need to be removed and proper support for use with the io
library. That's a project for another day.
| author | Jeremy Hylton <jeremy@alum.mit.edu> |
|---|---|
| date | Wed, 08 Aug 2007 17:36:33 +0000 |
| parents | 3fc3cedc49ca |
| children | 3ec20c4c1a4f |
line wrap: on
line diff
--- a/Lib/httplib.py Wed Aug 08 17:01:45 2007 +0000 +++ b/Lib/httplib.py Wed Aug 08 17:36:33 2007 +0000 @@ -499,6 +499,20 @@ self.fp.close() self.fp = None + # These implementations are for the benefit of io.BufferedReader. + + # XXX This class should probably be revised to act more like + # the "raw stream" that BufferedReader expects. + + @property + def closed(self): + return self.isclosed() + + def flush(self): + self.fp.flush() + + # End of "raw stream" methods + def isclosed(self): # NOTE: it is possible that we will not ever call self.close(). This # case occurs when will_close is TRUE, length is None, and we
