aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShadab Zafar <dufferzafar0@gmail.com>2016-05-28 10:55:58 +0530
committerThomas Kriechbaumer <thomas@kriechbaumer.name>2016-06-04 12:49:11 +0200
commit1c8223112900c26386560677134092cab5dbeea6 (patch)
tree3e559e6c235d86c98a06a2d38ed9183ad50f2def
parentcfb5efc96f2c73f9542bac63b29095382c548b1c (diff)
downloadmitmproxy-1c8223112900c26386560677134092cab5dbeea6.tar.gz
mitmproxy-1c8223112900c26386560677134092cab5dbeea6.tar.bz2
mitmproxy-1c8223112900c26386560677134092cab5dbeea6.zip
Use encode to detect if string is valid ASCII
-rw-r--r--pathod/language/__init__.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/pathod/language/__init__.py b/pathod/language/__init__.py
index 0841196e..a43424ea 100644
--- a/pathod/language/__init__.py
+++ b/pathod/language/__init__.py
@@ -31,7 +31,7 @@ def parse_pathod(s, use_http2=False):
May raise ParseException
"""
try:
- s = s.decode("ascii")
+ s.encode("ascii")
except UnicodeError:
raise exceptions.ParseException("Spec must be valid ASCII.", 0, 0)
try:
@@ -53,7 +53,7 @@ def parse_pathod(s, use_http2=False):
def parse_pathoc(s, use_http2=False):
try:
- s = s.decode("ascii")
+ s.encode("ascii")
except UnicodeError:
raise exceptions.ParseException("Spec must be valid ASCII.", 0, 0)
try: