From 983546d6bf562b19b77899db0cd44b320c133c65 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Sat, 30 Apr 2011 07:01:21 +0000 Subject: [PATCH] proper fix --- lib/core/option.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/lib/core/option.py b/lib/core/option.py index bd600eb2d..831508ba0 100644 --- a/lib/core/option.py +++ b/lib/core/option.py @@ -1090,18 +1090,20 @@ def __setHTTPUserAgent(): conf.httpHeaders.append(("User-Agent", __defaultHTTPUserAgent())) else: - debugMsg = "loading random HTTP User-Agent header(s) from " - debugMsg += "file '%s'" % paths.USER_AGENTS - logger.debug(debugMsg) + if not kb.userAgents: + debugMsg = "loading random HTTP User-Agent header(s) from " + debugMsg += "file '%s'" % paths.USER_AGENTS + logger.debug(debugMsg) - try: - kb.userAgents = getFileItems(paths.USER_AGENTS) - except IOError: - warnMsg = "unable to read HTTP User-Agent header " - warnMsg += "file '%s'" % paths.USER_AGENTS - logger.warn(warnMsg) + try: + kb.userAgents = getFileItems(paths.USER_AGENTS) + except IOError: + warnMsg = "unable to read HTTP User-Agent header " + warnMsg += "file '%s'" % paths.USER_AGENTS + logger.warn(warnMsg) - conf.httpHeaders.append((HTTPHEADER.USER_AGENT, __defaultHTTPUserAgent())) + conf.httpHeaders.append((HTTPHEADER.USER_AGENT, __defaultHTTPUserAgent())) + return count = len(kb.userAgents)