summaryrefslogtreecommitdiffstats
path: root/Lib/httplib.py
diff options
context:
space:
mode:
authorJeremy Hylton <jeremy@alum.mit.edu>2007-08-04 03:41:19 (GMT)
committerJeremy Hylton <jeremy@alum.mit.edu>2007-08-04 03:41:19 (GMT)
commit04319c78d633420231079efbe55155c040b1ed1b (patch)
tree2e67d8ab3239c55b7c560bc01ffc20f495865444 /Lib/httplib.py
parent4e7855d7fd5f9ef88125d439868e9afffef20276 (diff)
downloadcpython-04319c78d633420231079efbe55155c040b1ed1b.zip
cpython-04319c78d633420231079efbe55155c040b1ed1b.tar.gz
cpython-04319c78d633420231079efbe55155c040b1ed1b.tar.bz2
Make sure LineAndFileWrapper gets bytes() as its first argument.
This change fixes a test in test_urllib.
Diffstat (limited to 'Lib/httplib.py')
-rw-r--r--Lib/httplib.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/Lib/httplib.py b/Lib/httplib.py
index fe2f9ab..4d7e5c5 100644
--- a/Lib/httplib.py
+++ b/Lib/httplib.py
@@ -340,7 +340,7 @@ class HTTPResponse:
self.will_close = _UNKNOWN # conn will close at end of response
def _read_status(self):
- # Initialize with Simple-Response defaults
+ # Initialize with Simple-Response defaults.
line = str(self.fp.readline(), "iso-8859-1")
if self.debuglevel > 0:
print("reply:", repr(line))
@@ -363,8 +363,10 @@ class HTTPResponse:
self.close()
raise BadStatusLine(line)
else:
- # assume it's a Simple-Response from an 0.9 server
- self.fp = LineAndFileWrapper(line, self.fp)
+ # Assume it's a Simple-Response from an 0.9 server.
+ # We have to convert the first line back to raw bytes
+ # because self.fp.readline() needs to return bytes.
+ self.fp = LineAndFileWrapper(bytes(line), self.fp)
return "HTTP/0.9", 200, ""
# The status code is a three-digit number