mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
test: verify TOKEN_RE against common HTTP Methods
This commit is contained in:
parent
13027ef797
commit
42dd4190ac
@ -10,6 +10,17 @@ from gunicorn.http.body import Body, LengthReader, EOFReader
|
|||||||
from gunicorn.http.wsgi import Response
|
from gunicorn.http.wsgi import Response
|
||||||
from gunicorn.http.unreader import Unreader, IterUnreader, SocketUnreader
|
from gunicorn.http.unreader import Unreader, IterUnreader, SocketUnreader
|
||||||
from gunicorn.http.errors import InvalidHeader, InvalidHeaderName
|
from gunicorn.http.errors import InvalidHeader, InvalidHeaderName
|
||||||
|
from gunicorn.http.message import TOKEN_RE
|
||||||
|
|
||||||
|
|
||||||
|
def test_method_pattern():
|
||||||
|
assert TOKEN_RE.fullmatch("GET")
|
||||||
|
assert TOKEN_RE.fullmatch("MKCALENDAR")
|
||||||
|
assert not TOKEN_RE.fullmatch("GET:")
|
||||||
|
assert not TOKEN_RE.fullmatch("GET;")
|
||||||
|
RFC9110_5_6_2_TOKEN_DELIM = r'"(),/:;<=>?@[\]{}'
|
||||||
|
for bad_char in RFC9110_5_6_2_TOKEN_DELIM:
|
||||||
|
assert not TOKEN_RE.match(bad_char)
|
||||||
|
|
||||||
|
|
||||||
def assert_readline(payload, size, expected):
|
def assert_readline(payload, size, expected):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user