|
21 | 21 | import ntpath |
22 | 22 | import posixpath |
23 | 23 | import subprocess |
| 24 | +import httplib |
24 | 25 |
|
25 | 26 | from ConfigParser import DEFAULTSECT |
26 | 27 | from ConfigParser import RawConfigParser |
@@ -419,14 +420,13 @@ def filePathToString(filePath): |
419 | 420 | return strRepl |
420 | 421 |
|
421 | 422 | def dataToStdout(data, forceOutput=False): |
422 | | - if (forceOutput or conf.verbose > 0)\ |
423 | | - and not ('threadException' in kb and kb.threadException)\ |
424 | | - and not ('disableStdOut' in kb and kb.disableStdOut): |
425 | | - try: |
426 | | - sys.stdout.write(data) |
427 | | - sys.stdout.flush() |
428 | | - except UnicodeEncodeError: |
429 | | - print data.encode(conf.dataEncoding) |
| 423 | + if not ('threadException' in kb and kb.threadException): |
| 424 | + if forceOutput or (conf.verbose > 0) and not ('disableStdOut' in kb and kb.disableStdOut): |
| 425 | + try: |
| 426 | + sys.stdout.write(data) |
| 427 | + sys.stdout.flush() |
| 428 | + except UnicodeEncodeError: |
| 429 | + print data.encode(conf.dataEncoding) |
430 | 430 |
|
431 | 431 | def dataToSessionFile(data): |
432 | 432 | if not conf.sessionFile: |
@@ -1956,3 +1956,11 @@ def unicodeToSafeHTMLValue(value): |
1956 | 1956 |
|
1957 | 1957 | def getErrorParsedDBMS(): |
1958 | 1958 | return kb.htmlFp[0] if kb.htmlFp else None |
| 1959 | + |
| 1960 | +def showHttpErrorCodes(): |
| 1961 | + if kb.httpErrorCodes: |
| 1962 | + warnMsg = "HTTP error codes detected during testing:\n" |
| 1963 | + warnMsg += ", ".join("%d (%s) - %d times" % (code, httplib.responses[code]\ |
| 1964 | + if code in httplib.responses else '?', count)\ |
| 1965 | + for code, count in kb.httpErrorCodes.items()) |
| 1966 | + logger.warn(warnMsg) |
0 commit comments