From: Jeremy Hylton Date: Sun, 29 Jun 2003 17:55:05 +0000 (+0000) Subject: Fix sf bug 666219: assertion error in httplib. X-Git-Tag: v2.3c1~237 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b67695238d3ce6c40dacb05b155f24716af0c982;p=python 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. --- diff --git a/Lib/httplib.py b/Lib/httplib.py index b1712d84bd..03adb43604 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: