# HG changeset patch # User Pathangi Jatinshravan # Date 1444314316 -28800 # Thu Oct 08 22:25:16 2015 +0800 # Node ID 3eabbaf0cd2b9a55222752821646e0dc48407349 # Parent 3291e6132a674606af028be2d500701e5ff8285a Using str.find() 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,13 @@ # 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 + 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: