aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2018-02-12 11:22:09 +0100
committerGitHub <noreply@github.com>2018-02-12 11:22:09 +0100
commit26cb6b7936a9796a775c5f504713b7cc95937c13 (patch)
tree859b560904467baf9e646c195d8ae1b1f00a629c /test
parentb68013927d179d442eb6c9b82c42d2c4c86c03ea (diff)
parent06f689aa34f43d2ce8fc85a6bc9831ae4ca7c69e (diff)
downloadmitmproxy-26cb6b7936a9796a775c5f504713b7cc95937c13.tar.gz
mitmproxy-26cb6b7936a9796a775c5f504713b7cc95937c13.tar.bz2
mitmproxy-26cb6b7936a9796a775c5f504713b7cc95937c13.zip
Merge pull request #2847 from kira0204/key-cookie-issue
Handling empty key with value for cookies, fix #2827
Diffstat (limited to 'test')
-rw-r--r--test/mitmproxy/net/http/test_cookies.py30
-rw-r--r--test/mitmproxy/net/http/test_response.py2
2 files changed, 26 insertions, 6 deletions
diff --git a/test/mitmproxy/net/http/test_cookies.py b/test/mitmproxy/net/http/test_cookies.py
index 77549d9e..e12b0f00 100644
--- a/test/mitmproxy/net/http/test_cookies.py
+++ b/test/mitmproxy/net/http/test_cookies.py
@@ -7,6 +7,10 @@ from mitmproxy.net.http import cookies
cookie_pairs = [
[
+ "=uno",
+ [["", "uno"]]
+ ],
+ [
"",
[]
],
@@ -16,7 +20,7 @@ cookie_pairs = [
],
[
"one",
- [["one", None]]
+ [["one", ""]]
],
[
"one=uno; two=due",
@@ -36,7 +40,7 @@ cookie_pairs = [
],
[
"one=uno; two; three=tre",
- [["one", "uno"], ["two", None], ["three", "tre"]]
+ [["one", "uno"], ["two", ""], ["three", "tre"]]
],
[
"_lvs2=zHai1+Hq+Tc2vmc2r4GAbdOI5Jopg3EwsdUT9g=; "
@@ -79,8 +83,12 @@ def test_read_quoted_string():
def test_read_cookie_pairs():
vals = [
[
+ "=uno",
+ [["", "uno"]]
+ ],
+ [
"one",
- [["one", None]]
+ [["one", ""]]
],
[
"one=two",
@@ -100,7 +108,7 @@ def test_read_cookie_pairs():
],
[
'one="two"; three=four; five',
- [["one", "two"], ["three", "four"], ["five", None]]
+ [["one", "two"], ["three", "four"], ["five", ""]]
],
[
'one="\\"two"; three=four',
@@ -135,6 +143,12 @@ def test_cookie_roundtrips():
def test_parse_set_cookie_pairs():
pairs = [
[
+ "=uno",
+ [[
+ ["", "uno"]
+ ]]
+ ],
+ [
"one=uno",
[[
["one", "uno"]
@@ -150,7 +164,7 @@ def test_parse_set_cookie_pairs():
"one=uno; foo",
[[
["one", "uno"],
- ["foo", None]
+ ["foo", ""]
]]
],
[
@@ -200,6 +214,12 @@ def test_parse_set_cookie_header():
";", []
],
[
+ "=uno",
+ [
+ ("", "uno", ())
+ ]
+ ],
+ [
"one=uno",
[
("one", "uno", ())
diff --git a/test/mitmproxy/net/http/test_response.py b/test/mitmproxy/net/http/test_response.py
index af35bab3..f3470384 100644
--- a/test/mitmproxy/net/http/test_response.py
+++ b/test/mitmproxy/net/http/test_response.py
@@ -113,7 +113,7 @@ class TestResponseUtils:
assert attrs["domain"] == "example.com"
assert attrs["expires"] == "Wed Oct 21 16:29:41 2015"
assert attrs["path"] == "/"
- assert attrs["httponly"] is None
+ assert attrs["httponly"] == ""
def test_get_cookies_no_value(self):
resp = tresp()