From ef1809464d62dd61682eaba75dfa7e2216f78cff Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Fri, 5 Nov 2010 11:58:20 +0000 Subject: [PATCH] bug fix for that BadStatusLine (http://bugs.python.org/issue8450) --- extra/keepalive/keepalive.py | 1 + lib/request/connect.py | 3 --- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/extra/keepalive/keepalive.py b/extra/keepalive/keepalive.py index 25b12059a..129ae6921 100644 --- a/extra/keepalive/keepalive.py +++ b/extra/keepalive/keepalive.py @@ -160,6 +160,7 @@ class HTTPHandler(urllib2.HTTPHandler): else: try: r = h.getresponse() except httplib.ResponseNotReady, e: r = None + except httplib.BadStatusLine, e: r = None if r is None or r.version == 9: # httplib falls back to assuming HTTP 0.9 if it gets a diff --git a/lib/request/connect.py b/lib/request/connect.py index 367675b1c..4f1840246 100644 --- a/lib/request/connect.py +++ b/lib/request/connect.py @@ -243,9 +243,6 @@ class Connect: elif "timeout" in tbMsg: warnMsg = "connection timed out to the target url" elif "BadStatusLine" in tbMsg: - debugMsg = "BadStatusLine: %s || %s || %s" % (tbMsg, e, e.line) - logger.debug(debugMsg) - warnMsg = "the target url responded with an unknown HTTP " warnMsg += "status code, try to force the HTTP User-Agent " warnMsg += "header with option --user-agent or -a"