aboutsummaryrefslogtreecommitdiffstats
path: root/mitmproxy
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@corte.si>2018-02-24 10:49:33 +1300
committerGitHub <noreply@github.com>2018-02-24 10:49:33 +1300
commit16dd7f3ddf012426f2ddcb5792cf35be528c6e09 (patch)
tree408b440b179279d84546fb2b2a96717e99768a42 /mitmproxy
parent946c56d1a9d1b944654d7ffdd9df450982f8e40e (diff)
parent97e534e76b189176bf704098673f33079f68b14a (diff)
downloadmitmproxy-16dd7f3ddf012426f2ddcb5792cf35be528c6e09.tar.gz
mitmproxy-16dd7f3ddf012426f2ddcb5792cf35be528c6e09.tar.bz2
mitmproxy-16dd7f3ddf012426f2ddcb5792cf35be528c6e09.zip
Merge pull request #2886 from tran-tien-dat/set-cookie
Parse Set-Cookie header more permissively. Fix #2829
Diffstat (limited to 'mitmproxy')
-rw-r--r--mitmproxy/net/http/cookies.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/mitmproxy/net/http/cookies.py b/mitmproxy/net/http/cookies.py
index 7bef8757..39e8d60f 100644
--- a/mitmproxy/net/http/cookies.py
+++ b/mitmproxy/net/http/cookies.py
@@ -159,13 +159,17 @@ 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
- if rhs or lhs:
+
+ # as long as there's a "=", we consider it a pair
+ pairs.append([lhs, rhs])
+
+ elif lhs:
pairs.append([lhs, rhs])
- # comma marks the beginning of a new cookie
- if off < len(s) and s[off] == ",":
- cookies.append(pairs)
- pairs = []
+ # comma marks the beginning of a new cookie
+ if off < len(s) and s[off] == ",":
+ cookies.append(pairs)
+ pairs = []
off += 1