From 75c12c5edbbccacf43a33232c176e8cbdb712e4d Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Tue, 7 Jun 2011 21:46:49 +0000 Subject: [PATCH] =?UTF-8?q?fix=20for=20a=20bug=20reported=20by=20cclements?= =?UTF-8?q?@flatearth.=E2=80=8Bnet=20(TypeError:=20argument=20of=20type=20?= =?UTF-8?q?'NoneType'=20is=20not=20iterable)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- doc/THANKS | 3 +++ lib/request/connect.py | 9 +++++---- 2 files changed, 8 insertions(+), 4 deletions(-) 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)