summaryrefslogtreecommitdiffstats
path: root/Lib/httplib.py
diff options
context:
space:
mode:
authorJeremy Hylton <jeremy@alum.mit.edu>2007-08-04 19:22:00 (GMT)
committerJeremy Hylton <jeremy@alum.mit.edu>2007-08-04 19:22:00 (GMT)
commit39b198d8354b2b1b059488acbd3804b6a01641a8 (patch)
tree7faabcdfc18fc922e961d16e6e5a10c6420ffaf8 /Lib/httplib.py
parentf066c1ba3755e844be42ce9bc2344d34a14c5701 (diff)
downloadcpython-39b198d8354b2b1b059488acbd3804b6a01641a8.zip
cpython-39b198d8354b2b1b059488acbd3804b6a01641a8.tar.gz
cpython-39b198d8354b2b1b059488acbd3804b6a01641a8.tar.bz2
Change urllib to use HTTPConnection rather than old HTTP class.
The HTTP class is a backwards compatibility layer for the Python 1.5 API. (The only remaining use in the std library is xmlrpclib.) The current change makes urllib issue HTTP/1.0 requests with HTTPConnection, because is accesses HTTPResponse.fp directly instead of using the read() method. Using fp directly interacts poorly with persistent connections. There are probably better solutions than the current one, but this is a start.
Diffstat (limited to 'Lib/httplib.py')
-rw-r--r--Lib/httplib.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/httplib.py b/Lib/httplib.py
index 4d7e5c5..89af296 100644
--- a/Lib/httplib.py
+++ b/Lib/httplib.py
@@ -322,6 +322,13 @@ class HTTPResponse:
# accepts iso-8859-1.
def __init__(self, sock, debuglevel=0, strict=0, method=None):
+ # XXX If the response includes a content-length header, we
+ # need to make sure that the client doesn't read more than the
+ # specified number of bytes. If it does, it will block until
+ # the server times out and closes the connection. (The only
+ # applies to HTTP/1.1 connections.) Since some clients access
+ # self.fp directly rather than calling read(), this is a little
+ # tricky.
self.fp = sock.makefile("rb", 0)
self.debuglevel = debuglevel
self.strict = strict