HTTP: fixed cookie parsing.

The fixing supports the cookie value with the '=' character.

This is related to #756 PR on Github.
Thanks to changxiaocui.
This commit is contained in:
Zhidao HONG
2022-09-19 02:45:44 +08:00
parent 5354e05b2f
commit 76df62a623
3 changed files with 22 additions and 5 deletions

View File

@@ -1401,6 +1401,20 @@ class TestRouting(TestApplicationPython):
self.route_match_invalid({"cookies": ["var"]})
self.route_match_invalid({"cookies": [{"foo": {}}]})
def test_routes_match_cookies_complex(self):
self.route_match({"cookies": {"foo": "bar=baz"}})
self.cookie('foo=bar=baz', 200)
self.cookie(' foo=bar=baz ', 200)
self.cookie('=foo=bar=baz', 404)
self.route_match({"cookies": {"foo": ""}})
self.cookie('foo=', 200)
self.cookie('foo=;', 200)
self.cookie(' foo=;', 200)
self.cookie('foo', 404)
self.cookie('', 404)
self.cookie('=', 404)
def test_routes_match_cookies_multiple(self):
self.route_match({"cookies": {"foo": "bar", "blah": "blah"}})