From bad65adb010dfd9c931e27b3ad33ee85ef8d6095 Mon Sep 17 00:00:00 2001 From: jhylton Date: Sun, 29 Jun 2003 17:55:05 +0000 Subject: [PATCH] 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. git-svn-id: http://svn.python.org/projects/python/trunk@33351 6015fed2-1504-0410-9fe1-9d1591cc4771 --- Lib/httplib.py | 4 ++++ 1 file changed, 4 insertions(+) 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: -- 2.11.4.GIT