@@ -1984,7 +1984,7 @@ def findMultipartPostBoundary(post):
19841984
19851985 return retVal
19861986
1987- def urldecode (value , encoding = None , unsafe = "%%&=;+%s" % CUSTOM_INJECTION_MARK_CHAR , convall = False ):
1987+ def urldecode (value , encoding = None , unsafe = "%%&=;+%s" % CUSTOM_INJECTION_MARK_CHAR , convall = False , plusspace = True ):
19881988 result = value
19891989
19901990 if value :
@@ -2002,14 +2002,16 @@ def _(match):
20022002 char = chr (ord (match .group (1 ).decode ("hex" )))
20032003 return char if char in charset else match .group (0 )
20042004 result = re .sub ("%([0-9a-fA-F]{2})" , _ , value )
2005- result = result .replace ("+" , " " ) # plus sign has a special meaning in url encoded data (hence the usage of urllib.unquote_plus in convall case)
2005+
2006+ if plusspace :
2007+ result = result .replace ("+" , " " ) # plus sign has a special meaning in url encoded data (hence the usage of urllib.unquote_plus in convall case)
20062008
20072009 if isinstance (result , str ):
20082010 result = unicode (result , encoding or UNICODE_ENCODING , "replace" )
20092011
20102012 return result
20112013
2012- def urlencode (value , safe = "%&=" , convall = False , limit = False ):
2014+ def urlencode (value , safe = "%&=" , convall = False , limit = False , spaceplus = False ):
20132015 if conf .direct :
20142016 return value
20152017
@@ -2041,6 +2043,9 @@ def urlencode(value, safe="%&=", convall=False, limit=False):
20412043 else :
20422044 break
20432045
2046+ if spaceplus :
2047+ result = result .replace (urllib .quote (' ' ), '+' )
2048+
20442049 return result
20452050
20462051def runningAsAdmin ():
@@ -3021,7 +3026,7 @@ def geturl(self):
30213026 url = urldecode (request .get_full_url (), kb .pageEncoding )
30223027 method = request .get_method ()
30233028 data = request .get_data () if request .has_data () else None
3024- data = urldecode (data , kb .pageEncoding ) if data and urlencode ( DEFAULT_GET_POST_DELIMITER , None ) not in data else data
3029+ data = urldecode (data , kb .pageEncoding , plusspace = False )
30253030
30263031 if not data and method and method .upper () == HTTPMETHOD .POST :
30273032 debugMsg = "invalid POST form with blank data detected"
0 commit comments