From b67695238d3ce6c40dacb05b155f24716af0c982 Mon Sep 17 00:00:00 2001 From: Jeremy Hylton Date: Sun, 29 Jun 2003 17:55:05 +0000 Subject: 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. --- Lib/httplib.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Lib/httplib.py') 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: -- cgit v1.2.1