[tor-commits] [compass/master] Fix for #7924.
karsten at torproject.org
karsten at torproject.org
Wed Jan 16 15:09:56 UTC 2013
commit 7438c0e9427db072359d954fbc969407247ef7f5
Author: Chris Wacek <cwacek at gmail.com>
Date: Tue Jan 15 16:09:30 2013 -0500
Fix for #7924.
In versions below 2.7.3, shlex doesn't properly account for
unicode characters. This only occurred with Apache for some reason,
either because mod_wsgi uses Python_2.7.2+ or because Apache was
handing it Unicode strings.
This fix simply converts the string to ASCII before handing it to
shlex. Since the set of valid characters for an AS parameter are
'AS1234567890[],' and should always encode to ASCII, this should be
safe.
---
util.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/util.py b/util.py
index 5577ba9..77cb02b 100644
--- a/util.py
+++ b/util.py
@@ -9,7 +9,7 @@ def JSON(val):
def List(val):
if val:
- lex = shlex.shlex(val)
+ lex = shlex.shlex(val.encode('ascii','ignore'))
lex.whitespace += "[],"
return list(lex)
else:
More information about the tor-commits
mailing list