minor update

This commit is contained in:
Miroslav Stampar 2010-01-15 11:45:48 +00:00
parent f5c422efb4
commit dcf0b2a3c1

View File

@ -811,17 +811,14 @@ def searchEnvPath(fileName):
return result return result
def urlEncodeCookieValues(cookieStr, warn=False): def urlEncodeCookieValues(cookieStr):
if cookieStr: if cookieStr:
result = "" result = ""
changed = False
for part in cookieStr.split(';'): for part in cookieStr.split(';'):
index = part.find('=') + 1 index = part.find('=') + 1
if index > 0: if index > 0:
name = part[:index - 1].strip() name = part[:index - 1].strip()
value = urlencode(part[index:], convall=True) value = urlencode(part[index:], convall=True)
if value != part[index:]:
changed = True
result += "; %s=%s" % (name, value) result += "; %s=%s" % (name, value)
elif part.strip().lower() != "secure": elif part.strip().lower() != "secure":
result += "%s%s" % ("%3B", urlencode(part, convall=True)) result += "%s%s" % ("%3B", urlencode(part, convall=True))
@ -831,10 +828,6 @@ def urlEncodeCookieValues(cookieStr, warn=False):
result = result[2:] result = result[2:]
elif result.startswith('%3B'): elif result.startswith('%3B'):
result = result[3:] result = result[3:]
if changed and warn:
warnMsg = "cookie is provided in HTTP unsafe format containing one "
warnMsg += "of problematic characters: ' ,;'. temporary sanitized."
logger.warn(warnMsg)
return result return result
else: else:
return None return None