summaryrefslogtreecommitdiffstats
path: root/Lib/httplib.py
diff options
context:
space:
mode:
authorJeremy Hylton <jeremy@alum.mit.edu>2007-08-04 02:34:24 (GMT)
committerJeremy Hylton <jeremy@alum.mit.edu>2007-08-04 02:34:24 (GMT)
commit97043c3c02d0a531685ce2256eeaf5c4c5d8dc44 (patch)
tree914518a5401edb42a942c92758212772096fa343 /Lib/httplib.py
parentc2de7c03a05eb59ff03f07ea799d0c33abad6cc8 (diff)
downloadcpython-97043c3c02d0a531685ce2256eeaf5c4c5d8dc44.zip
cpython-97043c3c02d0a531685ce2256eeaf5c4c5d8dc44.tar.gz
cpython-97043c3c02d0a531685ce2256eeaf5c4c5d8dc44.tar.bz2
HTTPResponse should not inherit from io.IOBase.
I'm not sure why I thought it should originally, but it introduces an __del__() method on the response which cause the close() to be called too soon using the HTTP compat class. Also, remove some stale comments. The HTTPResponse calls makefile() immediately, so there is no risk of it closing the socket.
Diffstat (limited to 'Lib/httplib.py')
-rw-r--r--Lib/httplib.py8
1 files changed, 2 insertions, 6 deletions
diff --git a/Lib/httplib.py b/Lib/httplib.py
index 2f9a5c3..020d5c5 100644
--- a/Lib/httplib.py
+++ b/Lib/httplib.py
@@ -308,7 +308,7 @@ class HTTPMessage(mimetools.Message):
self.status = self.status + '; bad seek'
break
-class HTTPResponse(io.IOBase):
+class HTTPResponse:
# strict: If true, raise BadStatusLine if the status line can't be
# parsed as a valid HTTP/1.0 or 1.1 status line. By default it is
@@ -1205,10 +1205,6 @@ class HTTP:
try:
response = self._conn.getresponse()
except BadStatusLine as e:
- ### hmm. if getresponse() ever closes the socket on a bad request,
- ### then we are going to have problems with self.sock
-
- ### should we keep this behavior? do people use it?
# keep the socket open (as a file), and return it
self.file = self._conn.sock.makefile('rb', 0)
@@ -1399,7 +1395,7 @@ def test():
status, reason, headers = h.getreply()
print('status =', status)
print('reason =', reason)
- print("read", len(h.getfile().read()))
+ print('read', len(h.getfile().read()))
print()
if headers:
for header in headers.headers: print(header.strip())