From 40971aca94715112fb479a9e91ec2bf17635c09f Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Sun, 22 May 2011 10:59:56 +0000 Subject: [PATCH] fixing nasty bug caused by retrying counter --- lib/request/connect.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/request/connect.py b/lib/request/connect.py index 82c2f5939..6041d8501 100644 --- a/lib/request/connect.py +++ b/lib/request/connect.py @@ -102,10 +102,15 @@ class Connect: response = kwargs.get('response', False) ignoreTimeout = kwargs.get('ignoreTimeout', kb.ignoreTimeout) refreshing = kwargs.get('refreshing', False) + retrying = kwargs.get('retrying', False) # flag to know if we are dealing with the same target host target = reduce(lambda x, y: x == y, map(lambda x: urlparse.urlparse(x).netloc.split(':')[0], [url, conf.url])) + if not retrying: + # Reset the number of connection retries + threadData.retriesCount = 0 + # fix for known issue when urllib2 just skips the other part of provided # url splitted with space char while urlencoding it in the later phase url = url.replace(" ", "%20") @@ -270,9 +275,6 @@ class Connect: conf.redirectHandled = True - # Reset the number of connection retries - threadData.retriesCount = 0 - # Return response object if response: return conn, None @@ -425,9 +427,10 @@ class Connect: time.sleep(1) socket.setdefaulttimeout(conf.timeout) + kwargs['retrying'] = True return Connect.__getPageProxy(**kwargs) elif kb.testMode: - logger.warn(warnMsg) + logger.critical(warnMsg) return None, None else: socket.setdefaulttimeout(conf.timeout)