aboutsummaryrefslogtreecommitdiffstats
path: root/mitmproxy/net
diff options
context:
space:
mode:
authorkira0204 <rshtmudgal@gmail.com>2018-02-07 04:41:12 +0530
committerkira0204 <rshtmudgal@gmail.com>2018-02-07 04:41:12 +0530
commit4e9d4b37b38a89c0536f3f2169ed8f8d4b6da206 (patch)
tree732d8d6e655c8fc5f6cbd42c29c7b8c038249cc2 /mitmproxy/net
parent05ae3460c018bc33999534ac2dbab8fa3a6c9c96 (diff)
downloadmitmproxy-4e9d4b37b38a89c0536f3f2169ed8f8d4b6da206.tar.gz
mitmproxy-4e9d4b37b38a89c0536f3f2169ed8f8d4b6da206.tar.bz2
mitmproxy-4e9d4b37b38a89c0536f3f2169ed8f8d4b6da206.zip
fixing logic
Diffstat (limited to 'mitmproxy/net')
-rw-r--r--mitmproxy/net/http/cookies.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/mitmproxy/net/http/cookies.py b/mitmproxy/net/http/cookies.py
index 4824bf56..32032f5f 100644
--- a/mitmproxy/net/http/cookies.py
+++ b/mitmproxy/net/http/cookies.py
@@ -114,12 +114,12 @@ def _read_cookie_pairs(s, off=0):
lhs, off = _read_key(s, off)
lhs = lhs.lstrip()
- if lhs:
+ if lhs is not None:
rhs = None
if off < len(s) and s[off] == "=":
rhs, off = _read_value(s, off + 1, ";")
-
- pairs.append([lhs, rhs])
+ if rhs or lhs:
+ pairs.append([lhs, rhs])
off += 1
@@ -143,12 +143,12 @@ def _read_set_cookie_pairs(s: str, off=0) -> Tuple[List[TPairs], int]:
lhs, off = _read_key(s, off, ";=,")
lhs = lhs.lstrip()
- if lhs:
+ if lhs is not None:
rhs = None
if off < len(s) and s[off] == "=":
rhs, off = _read_value(s, off + 1, ";,")
- # Special handliing of attributes
+ # Special handling of attributes
if lhs.lower() == "expires":
# 'expires' values can contain commas in them so they need to
# be handled separately.
@@ -161,8 +161,8 @@ def _read_set_cookie_pairs(s: str, off=0) -> Tuple[List[TPairs], int]:
if len(rhs) <= 3:
trail, off = _read_value(s, off + 1, ";,")
rhs = rhs + "," + trail
-
- pairs.append([lhs, rhs])
+ if rhs or lhs:
+ pairs.append([lhs, rhs])
# comma marks the beginning of a new cookie
if off < len(s) and s[off] == ",":