File tree Expand file tree Collapse file tree 1 file changed +13
-11
lines changed
Expand file tree Collapse file tree 1 file changed +13
-11
lines changed Original file line number Diff line number Diff line change @@ -1090,18 +1090,20 @@ def __setHTTPUserAgent():
10901090 conf .httpHeaders .append (("User-Agent" , __defaultHTTPUserAgent ()))
10911091
10921092 else :
1093- debugMsg = "loading random HTTP User-Agent header(s) from "
1094- debugMsg += "file '%s'" % paths .USER_AGENTS
1095- logger .debug (debugMsg )
1096-
1097- try :
1098- kb .userAgents = getFileItems (paths .USER_AGENTS )
1099- except IOError :
1100- warnMsg = "unable to read HTTP User-Agent header "
1101- warnMsg += "file '%s'" % paths .USER_AGENTS
1102- logger .warn (warnMsg )
1093+ if not kb .userAgents :
1094+ debugMsg = "loading random HTTP User-Agent header(s) from "
1095+ debugMsg += "file '%s'" % paths .USER_AGENTS
1096+ logger .debug (debugMsg )
11031097
1104- conf .httpHeaders .append ((HTTPHEADER .USER_AGENT , __defaultHTTPUserAgent ()))
1098+ try :
1099+ kb .userAgents = getFileItems (paths .USER_AGENTS )
1100+ except IOError :
1101+ warnMsg = "unable to read HTTP User-Agent header "
1102+ warnMsg += "file '%s'" % paths .USER_AGENTS
1103+ logger .warn (warnMsg )
1104+
1105+ conf .httpHeaders .append ((HTTPHEADER .USER_AGENT , __defaultHTTPUserAgent ()))
1106+ return
11051107
11061108 count = len (kb .userAgents )
11071109
You can’t perform that action at this time.
0 commit comments