From 79555c0d1c62ae1536b5016b718ce69bd3d317a7 Mon Sep 17 00:00:00 2001 From: Ira Lun Date: Tue, 29 Aug 2017 19:51:51 +0100 Subject: Add tchar and token regexes. --- src/webob/acceptparse.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/webob/acceptparse.py') 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") ] ) -- cgit v1.2.1