mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2024-11-22 09:36:35 +03:00
minor fix (when redirected path has non-ASCII char and conf.url is unicode) and bits along with pieces
This commit is contained in:
parent
595f69fa2c
commit
333f8057a5
|
@ -1886,7 +1886,10 @@ def getUnicode(value, encoding=None, system=False, noneToNull=False):
|
|||
if isinstance(value, unicode):
|
||||
return value
|
||||
elif isinstance(value, basestring):
|
||||
return unicode(value, encoding or UNICODE_ENCODING, errors="replace")
|
||||
try:
|
||||
return unicode(value, encoding or kb.pageEncoding)
|
||||
except:
|
||||
return unicode(value, UNICODE_ENCODING, "replace")
|
||||
else:
|
||||
return unicode(value) # encoding ignored for non-basestring instances
|
||||
else:
|
||||
|
@ -2511,7 +2514,7 @@ def openFile(filename, mode='r'):
|
|||
"""
|
||||
|
||||
try:
|
||||
return codecs.open(filename, mode, UNICODE_ENCODING, errors="replace")
|
||||
return codecs.open(filename, mode, UNICODE_ENCODING, "replace")
|
||||
except IOError:
|
||||
errMsg = "there has been a file opening error for filename '%s'. " % filename
|
||||
errMsg += "Please check %s permissions on a file " % ("write" if \
|
||||
|
|
|
@ -77,7 +77,7 @@ def urldecode(value, encoding=None):
|
|||
result = urllib.unquote_plus(value)
|
||||
|
||||
if isinstance(result, str):
|
||||
result = unicode(result, encoding or UNICODE_ENCODING, errors="replace")
|
||||
result = unicode(result, encoding or UNICODE_ENCODING, "replace")
|
||||
|
||||
return result
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ class SmartRedirectHandler(urllib2.HTTPRedirectHandler):
|
|||
redurl = self._get_header_redirect(headers)
|
||||
|
||||
if not urlparse.urlsplit(redurl).netloc:
|
||||
redurl = urlparse.urljoin(conf.url, redurl)
|
||||
redurl = urlparse.urljoin(req.get_full_url(), redurl)
|
||||
|
||||
self._infinite_loop_check(req)
|
||||
self._ask_redirect_choice(code, redurl)
|
||||
|
|
Loading…
Reference in New Issue
Block a user