diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2016-09-28 15:10:31 +1000 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2016-09-28 15:10:31 +1000 |
commit | 070aa27cf5f88d2036c88c110e00421c427c0c9b (patch) | |
tree | 7d3da73fe7ce629edfce2dbbe0365bf00cf08e3d /netlib | |
parent | b21f076cc81c67ec9e65b57c6c41ad5b395e6f51 (diff) | |
download | mitmproxy-070aa27cf5f88d2036c88c110e00421c427c0c9b.tar.gz mitmproxy-070aa27cf5f88d2036c88c110e00421c427c0c9b.tar.bz2 mitmproxy-070aa27cf5f88d2036c88c110e00421c427c0c9b.zip |
parse_set_cookie header returns an empty list if no cookies are found
This matches parse_cookie, and is more idiomatic.
Diffstat (limited to 'netlib')
-rw-r--r-- | netlib/http/cookies.py | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/netlib/http/cookies.py b/netlib/http/cookies.py index a3ac4806..cb816ca0 100644 --- a/netlib/http/cookies.py +++ b/netlib/http/cookies.py @@ -241,21 +241,16 @@ def parse_set_cookie_header(line): """ Parse a Set-Cookie header value - Returns a list of (name, value, attrs) tuple for each cokie, or None. - Where attrs is a CookieAttrs dict of attributes. No attempt is made - to parse attribute values - they are treated purely as strings. + Returns a list of (name, value, attrs) tuples, where attrs is a + CookieAttrs dict of attributes. No attempt is made to parse attribute + values - they are treated purely as strings. """ cookie_pairs, off = _read_set_cookie_pairs(line) - cookies = [ (pairs[0][0], pairs[0][1], CookieAttrs(tuple(x) for x in pairs[1:])) for pairs in cookie_pairs if pairs ] - - if cookies: - return cookies - else: - return None + return cookies def parse_set_cookie_headers(headers): |