summaryrefslogtreecommitdiffstats
path: root/Lib/httplib.py
diff options
context:
space:
mode:
authorJeremy Hylton <jeremy@alum.mit.edu>2007-08-08 17:36:33 (GMT)
committerJeremy Hylton <jeremy@alum.mit.edu>2007-08-08 17:36:33 (GMT)
commitdf5f6b551ad89257a579682114ae9f2ab1d3755e (patch)
treea05db2f1a62dd2d879de945b8938cb35c010ca41 /Lib/httplib.py
parent6a10e02aa644ad7f9c1f2ab6dd249c1a414c0c8b (diff)
downloadcpython-df5f6b551ad89257a579682114ae9f2ab1d3755e.zip
cpython-df5f6b551ad89257a579682114ae9f2ab1d3755e.tar.gz
cpython-df5f6b551ad89257a579682114ae9f2ab1d3755e.tar.bz2
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.
Diffstat (limited to 'Lib/httplib.py')
-rw-r--r--Lib/httplib.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/Lib/httplib.py b/Lib/httplib.py
index 0931446..fd66cfd 100644
--- a/Lib/httplib.py
+++ b/Lib/httplib.py
@@ -499,6 +499,20 @@ class HTTPResponse:
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