Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c57941c

Browse files
committed
minor beautification
1 parent 27d244b commit c57941c

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

lib/controller/checks.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
See the file 'doc/COPYING' for copying permission
88
"""
99

10+
import httplib
1011
import logging
1112
import re
1213
import socket
@@ -972,7 +973,7 @@ def checkConnection(suppressOutput=False):
972973
errMsg = getUnicode(errMsg)
973974
logger.critical(errMsg)
974975

975-
if any(code in kb.httpErrorCodes for code in (404, )):
976+
if any(code in kb.httpErrorCodes for code in (httplib.NOT_FOUND, )):
976977
msg = "it is not recommended to continue in this kind of cases. Do you want to quit and make sure that everything is set up properly? [Y/n] "
977978
if readInput(msg, default="Y") not in ("n", "N"):
978979
raise sqlmapSilentQuitException

lib/request/connect.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -425,19 +425,19 @@ def getPage(**kwargs):
425425

426426
logger.log(7, responseMsg)
427427

428-
if e.code == 401:
428+
if e.code == httplib.UNAUTHORIZED:
429429
errMsg = "not authorized, try to provide right HTTP "
430430
errMsg += "authentication type and valid credentials (%d)" % code
431431
raise sqlmapConnectionException, errMsg
432-
elif e.code == 404:
432+
elif e.code == httplib.NOT_FOUND:
433433
if raise404:
434434
errMsg = "page not found (%d)" % code
435435
raise sqlmapConnectionException, errMsg
436436
else:
437437
debugMsg = "page not found (%d)" % code
438438
logger.debug(debugMsg)
439439
processResponse(page, responseHeaders)
440-
elif e.code == 504:
440+
elif e.code == httplib.GATEWAY_TIMEOUT:
441441
if ignoreTimeout:
442442
return None, None, None
443443
else:

0 commit comments

Comments
 (0)