diff --git a/doc/THANKS b/doc/THANKS index 884c46f68..6360a3064 100644 --- a/doc/THANKS +++ b/doc/THANKS @@ -63,6 +63,9 @@ Pierre Chifflier and Mark Hymers for uploading and accepting the sqlmap Debian package to the official Debian project repository +Chris Clements + for reporting a minor bug + Andreas Constantinides for reporting a minor bug diff --git a/lib/request/connect.py b/lib/request/connect.py index 37dfbdeb2..c8a9783a1 100644 --- a/lib/request/connect.py +++ b/lib/request/connect.py @@ -576,10 +576,11 @@ class Connect: _, headers = Connect.getPage(url=uri, get=get, post=post, cookie=cookie, ua=ua, referer=referer, silent=silent, method=method, auxHeaders=auxHeaders, raise404=raise404) - if kb.nullConnection == NULLCONNECTION.HEAD and HTTPHEADER.CONTENT_LENGTH in headers: - pageLength = int(headers[HTTPHEADER.CONTENT_LENGTH]) - elif kb.nullConnection == NULLCONNECTION.RANGE and HTTPHEADER.CONTENT_RANGE in headers: - pageLength = int(headers[HTTPHEADER.CONTENT_RANGE][headers[HTTPHEADER.CONTENT_RANGE].find('/') + 1:]) + if headers: + if kb.nullConnection == NULLCONNECTION.HEAD and HTTPHEADER.CONTENT_LENGTH in headers: + pageLength = int(headers[HTTPHEADER.CONTENT_LENGTH]) + elif kb.nullConnection == NULLCONNECTION.RANGE and HTTPHEADER.CONTENT_RANGE in headers: + pageLength = int(headers[HTTPHEADER.CONTENT_RANGE][headers[HTTPHEADER.CONTENT_RANGE].find('/') + 1:]) if not pageLength: page, headers = Connect.getPage(url=uri, get=get, post=post, cookie=cookie, ua=ua, referer=referer, silent=silent, method=method, auxHeaders=auxHeaders, response=response, raise404=raise404, ignoreTimeout=timeBasedCompare)