diff options
author | Jeremy Hylton <jeremy@alum.mit.edu> | 2003-06-29 17:55:05 (GMT) |
---|---|---|
committer | Jeremy Hylton <jeremy@alum.mit.edu> | 2003-06-29 17:55:05 (GMT) |
commit | b67695238d3ce6c40dacb05b155f24716af0c982 (patch) | |
tree | fc25b60127944a20742f422e863b5cfc3100c36f /Lib/httplib.py | |
parent | b752c278019c46fef777267d5ee32a2b90b5d46e (diff) | |
download | cpython-b67695238d3ce6c40dacb05b155f24716af0c982.zip cpython-b67695238d3ce6c40dacb05b155f24716af0c982.tar.gz cpython-b67695238d3ce6c40dacb05b155f24716af0c982.tar.bz2 |
Fix sf bug 666219: assertion error in httplib.
The obvious way for this assertion to fail is if the LineAndFileWrapper constructor is called when an empty line. Raise a BadStatusError before the call.
Diffstat (limited to 'Lib/httplib.py')
-rw-r--r-- | Lib/httplib.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/httplib.py b/Lib/httplib.py index b1712d8..03adb43 100644 --- a/Lib/httplib.py +++ b/Lib/httplib.py @@ -231,6 +231,10 @@ class HTTPResponse: line = self.fp.readline() if self.debuglevel > 0: print "reply:", repr(line) + if not line: + # Presumably, the server closed the connection before + # sending a valid response. + raise BadStatusLine(line) try: [version, status, reason] = line.split(None, 2) except ValueError: |