@@ -167,26 +167,29 @@ def getPage(**kwargs):
167167 exceptionMsg = "not authorized, try to provide right HTTP "
168168 exceptionMsg += "authentication type and valid credentials"
169169 raise sqlmapConnectionException , exceptionMsg
170+ elif e .code == 404 :
171+ exceptionMsg = "page not found"
172+ raise sqlmapConnectionException , exceptionMsg
170173 else :
171174 page = e .read ()
172175 code = e .code
173176 status = e .msg
174177 responseHeaders = e .info ()
175178
176- except (urllib2 .URLError , socket .error , socket .timeout , httplib .BadStatusLine ), _ :
179+ debugMsg = "got HTTP error code: %d" % code
180+ logger .debug (debugMsg )
181+
182+ except (urllib2 .URLError , socket .error , socket .timeout , httplib .BadStatusLine ), e :
177183 tbMsg = traceback .format_exc ()
178184
179185 if "URLError" in tbMsg or "error" in tbMsg :
180186 warnMsg = "unable to connect to the target url"
181-
182187 elif "timeout" in tbMsg :
183188 warnMsg = "connection timed out to the target url"
184-
185189 elif "BadStatusLine" in tbMsg :
186190 warnMsg = "the target url responded with an unknown HTTP "
187191 warnMsg += "status code, try to force the HTTP User-Agent "
188192 warnMsg += "header with option --user-agent or -a"
189-
190193 else :
191194 warnMsg = "unable to connect to the target url"
192195
@@ -201,7 +204,6 @@ def getPage(**kwargs):
201204
202205 if silent :
203206 return None , None
204-
205207 elif conf .retriesCount < conf .retries :
206208 conf .retriesCount += 1
207209
@@ -212,7 +214,6 @@ def getPage(**kwargs):
212214
213215 socket .setdefaulttimeout (conf .timeout )
214216 return Connect .__getPageProxy (** kwargs )
215-
216217 else :
217218 socket .setdefaulttimeout (conf .timeout )
218219 raise sqlmapConnectionException , warnMsg
0 commit comments