Merge branch 'master' of github.com:sqlmapproject/sqlmap

This commit is contained in:
Bernardo Damele 2012-07-17 00:25:08 +01:00
commit 7198e3185b
2 changed files with 14 additions and 10 deletions

View File

@ -3050,6 +3050,9 @@ def getHostHeader(url):
Returns proper Host header value for a given target URL Returns proper Host header value for a given target URL
""" """
retVal = url
if url:
retVal = urlparse.urlparse(url).netloc retVal = urlparse.urlparse(url).netloc
if re.search("http(s)?://\[.+\]", url, re.I): if re.search("http(s)?://\[.+\]", url, re.I):

View File

@ -75,6 +75,7 @@ class SmartRedirectHandler(urllib2.HTTPRedirectHandler):
content = None content = None
redurl = self._get_header_redirect(headers) redurl = self._get_header_redirect(headers)
if redurl:
if not urlparse.urlsplit(redurl).netloc: if not urlparse.urlsplit(redurl).netloc:
redurl = urlparse.urljoin(req.get_full_url(), redurl) redurl = urlparse.urljoin(req.get_full_url(), redurl)
@ -88,7 +89,7 @@ class SmartRedirectHandler(urllib2.HTTPRedirectHandler):
dbgMsg += "redirect response content (%s)" % msg dbgMsg += "redirect response content (%s)" % msg
logger.debug(dbgMsg) logger.debug(dbgMsg)
if kb.redirectChoice == REDIRECTION.YES: if redurl and kb.redirectChoice == REDIRECTION.YES:
req.headers[HTTPHEADER.HOST] = getHostHeader(redurl) req.headers[HTTPHEADER.HOST] = getHostHeader(redurl)
result = urllib2.HTTPRedirectHandler.http_error_302(self, req, fp, code, msg, headers) result = urllib2.HTTPRedirectHandler.http_error_302(self, req, fp, code, msg, headers)
else: else: