mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-02-03 13:14:13 +03:00
better way for dealing with relative paths
This commit is contained in:
parent
a536bf210f
commit
ad25bcc2be
|
@ -104,6 +104,9 @@ class Connect:
|
||||||
retrying = kwargs.get('retrying', False)
|
retrying = kwargs.get('retrying', False)
|
||||||
redirecting = kwargs.get('redirecting', False)
|
redirecting = kwargs.get('redirecting', False)
|
||||||
|
|
||||||
|
if not urlparse.urlsplit(url).netloc:
|
||||||
|
url = urlparse.urljoin(conf.url, url)
|
||||||
|
|
||||||
# flag to know if we are dealing with the same target host
|
# flag to know if we are dealing with the same target host
|
||||||
target = reduce(lambda x, y: x == y, map(lambda x: urlparse.urlparse(x).netloc.split(':')[0], [url, conf.url]))
|
target = reduce(lambda x, y: x == y, map(lambda x: urlparse.urlparse(x).netloc.split(':')[0], [url, conf.url]))
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ class SmartRedirectHandler(urllib2.HTTPRedirectHandler):
|
||||||
result.redurl = headers.getheaders("uri")[0].split("?")[0]
|
result.redurl = headers.getheaders("uri")[0].split("?")[0]
|
||||||
|
|
||||||
if hasattr(result, 'redurl'):
|
if hasattr(result, 'redurl'):
|
||||||
if result.redurl.startswith('.') or result.redurl.startswith('/'):
|
if not urlparse.urlsplit(result.redurl).netloc:
|
||||||
result.redurl = urlparse.urljoin(conf.url, result.redurl)
|
result.redurl = urlparse.urljoin(conf.url, result.redurl)
|
||||||
|
|
||||||
if "set-cookie" in headers:
|
if "set-cookie" in headers:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user