summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Lib/httplib.py14
-rw-r--r--Lib/urllib2.py5
2 files changed, 18 insertions, 1 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
diff --git a/Lib/urllib2.py b/Lib/urllib2.py
index c8bfe38..448f2a8 100644
--- a/Lib/urllib2.py
+++ b/Lib/urllib2.py
@@ -1072,6 +1072,10 @@ class AbstractHTTPHandler(BaseHandler):
# Pick apart the HTTPResponse object to get the addinfourl
# object initialized properly.
+ # XXX Should an HTTPResponse object really be passed to
+ # BufferedReader? If so, we should change httplib to support
+ # this use directly.
+
# Add some fake methods to the reader to satisfy BufferedReader.
r.readable = lambda: True
r.writable = r.seekable = lambda: False
@@ -1283,7 +1287,6 @@ class FTPHandler(BaseHandler):
def connect_ftp(self, user, passwd, host, port, dirs, timeout):
fw = ftpwrapper(user, passwd, host, port, dirs, timeout)
-## fw.ftp.set_debuglevel(1)
return fw
class CacheFTPHandler(FTPHandler):