summaryrefslogtreecommitdiff
path: root/src/webob/acceptparse.py
diff options
context:
space:
mode:
authorIra Lun <sammyrosajoe@gmail.com>2017-08-29 19:51:51 +0100
committerIra Lun <sammyrosajoe@gmail.com>2017-08-29 19:51:51 +0100
commit79555c0d1c62ae1536b5016b718ce69bd3d317a7 (patch)
tree436e1fd26cdd41e2381abe74b14bffde5f57d693 /src/webob/acceptparse.py
parent29b6956245cf907bc063c8eb9a95c003e962e860 (diff)
downloadwebob-79555c0d1c62ae1536b5016b718ce69bd3d317a7.tar.gz
Add tchar and token regexes.
Diffstat (limited to 'src/webob/acceptparse.py')
-rw-r--r--src/webob/acceptparse.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/webob/acceptparse.py b/src/webob/acceptparse.py
index db63a34..27a0772 100644
--- a/src/webob/acceptparse.py
+++ b/src/webob/acceptparse.py
@@ -26,6 +26,16 @@ part_re = re.compile(
# ; optional whitespace
OWS_re = '[ \t]*'
+# RFC 7230 Section 3.2.6 "Field Value Components":
+# tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*"
+# / "+" / "-" / "." / "^" / "_" / "`" / "|" / "~"
+# / DIGIT / ALPHA
+tchar_re = r"[!#$%&'*+\-.^_`|~0-9A-Za-z]"
+
+# token = 1*tchar
+token_re = tchar_re + '+'
+token_compiled_re = re.compile('^' + token_re + '$')
+
# RFC 7231 Section 5.3.1 "Quality Values"
# qvalue = ( "0" [ "." 0*3DIGIT ] )
# / ( "1" [ "." 0*3("0") ] )