diff options
author | Thomas Kriechbaumer <thomas@kriechbaumer.name> | 2016-05-08 13:13:48 -0500 |
---|---|---|
committer | Thomas Kriechbaumer <thomas@kriechbaumer.name> | 2016-05-10 11:13:12 -0500 |
commit | 08002282e84394cb86508c51f2d7adfd1ece6da4 (patch) | |
tree | 2eb50695b55cdc2bf65e1e47211cdfb23d2cd6b4 /test/netlib | |
parent | 595a01de4e141eb494c2f698e3177c24071ca461 (diff) | |
download | mitmproxy-08002282e84394cb86508c51f2d7adfd1ece6da4.tar.gz mitmproxy-08002282e84394cb86508c51f2d7adfd1ece6da4.tar.bz2 mitmproxy-08002282e84394cb86508c51f2d7adfd1ece6da4.zip |
improve cookie parsing
allows '/' to be within a cookie name
removes deprecated cookie getter/setter
fixes #1118
Diffstat (limited to 'test/netlib')
-rw-r--r-- | test/netlib/http/test_cookies.py | 13 | ||||
-rw-r--r-- | test/netlib/http/test_request.py | 2 | ||||
-rw-r--r-- | test/netlib/http/test_response.py | 2 |
3 files changed, 13 insertions, 4 deletions
diff --git a/test/netlib/http/test_cookies.py b/test/netlib/http/test_cookies.py index 3b520a44..da28850f 100644 --- a/test/netlib/http/test_cookies.py +++ b/test/netlib/http/test_cookies.py @@ -228,7 +228,16 @@ def test_refresh_cookie(): c = "MOO=BAR; Expires=Tue, 08-Mar-2011 00:20:38 GMT; Path=foo.com; Secure" assert "00:21:38" in cookies.refresh_set_cookie_header(c, 60) + c = "foo,bar" + with raises(ValueError): + cookies.refresh_set_cookie_header(c, 60) + # https://github.com/mitmproxy/mitmproxy/issues/773 c = ">=A" - with raises(ValueError): - cookies.refresh_set_cookie_header(c, 60)
\ No newline at end of file + assert cookies.refresh_set_cookie_header(c, 60) + + # https://github.com/mitmproxy/mitmproxy/issues/1118 + c = "foo:bar=bla" + assert cookies.refresh_set_cookie_header(c, 0) + c = "foo/bar=bla" + assert cookies.refresh_set_cookie_header(c, 0) diff --git a/test/netlib/http/test_request.py b/test/netlib/http/test_request.py index 91fd8ce3..ae231a8e 100644 --- a/test/netlib/http/test_request.py +++ b/test/netlib/http/test_request.py @@ -172,7 +172,7 @@ class TestRequestUtils(object): def test_get_cookies_none(self): request = treq() request.headers = Headers() - assert len(request.cookies) == 0 + assert not request.cookies def test_get_cookies_single(self): request = treq() diff --git a/test/netlib/http/test_response.py b/test/netlib/http/test_response.py index a0c44d90..5440176c 100644 --- a/test/netlib/http/test_response.py +++ b/test/netlib/http/test_response.py @@ -98,7 +98,7 @@ class TestResponseUtils(object): resp = tresp() v = resp.cookies v.add("foo", ["bar", ODictCaseless()]) - resp.set_cookies(v) + resp.cookies = v v = resp.cookies assert len(v) == 1 |