diff --git a/Lib/http/cookies.py b/Lib/http/cookies.py --- a/Lib/http/cookies.py +++ b/Lib/http/cookies.py @@ -576,8 +576,14 @@ # Start looking for a cookie match = patt.match(str, i) if not match: - # No more cookies - break + temp = str.find(';', i) + if temp == -1: + break + else: + i = temp + i += 1 + morsel_seen = False; + continue key, value = match.group("key"), match.group("val") i = match.end(0) diff --git a/Lib/test/test_http_cookies.py b/Lib/test/test_http_cookies.py --- a/Lib/test/test_http_cookies.py +++ b/Lib/test/test_http_cookies.py @@ -56,7 +56,16 @@ 'Set-Cookie: d=r', 'Set-Cookie: f=h' )) - } + }, + { + 'data': 'a=b; messages=["\"]; c=d;', + 'dict': {'a':'b', 'c':'d'}, + 'repr': "", + 'output': '\n'.join(( + 'Set-Cookie: a=b', + 'Set-Cookie: c=d', + )) + }, ] for case in cases: