From: Shoham Peller Date: Fri, 14 Sep 2018 23:28:08 +0000 (+0300) Subject: [2.7] closes bpo-8450: a better error message when http status line isn't received... X-Git-Tag: v2.7.16rc1~144 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ee78ba2c819b0cd7671a575e584d8fe1b7adb3e4;p=thirdparty%2FPython%2Fcpython.git [2.7] closes bpo-8450: a better error message when http status line isn't received (GH-2825) When the server has closed the connection before sending a status-line, the client's error message should have a more descriptive error message https://bugs.python.org/issue8450 https://bugs.python.org/issue8450 --- diff --git a/Lib/httplib.py b/Lib/httplib.py index f3bb22c2b6ff..60a8fb4e355f 100644 --- a/Lib/httplib.py +++ b/Lib/httplib.py @@ -399,7 +399,7 @@ class HTTPResponse: if not line: # Presumably, the server closed the connection before # sending a valid response. - raise BadStatusLine(line) + raise BadStatusLine("No status line received - the server has closed the connection") try: [version, status, reason] = line.split(None, 2) except ValueError: