Index: Cookie.py =================================================================== --- Cookie.py (revision 41632) +++ Cookie.py (working copy) @@ -624,6 +624,7 @@ i = 0 # Our starting point n = len(str) # Length of string M = None # current morsel + keys = {} # Keys found in string while 0 <= i < n: # Start looking for a cookie @@ -633,6 +634,13 @@ K,V = match.group("key"), match.group("val") i = match.end(0) + # If a key is duplicated in the string, + # only use the first value and ignore duplicates + if K in keys: + continue + else: + keys[K] = True + # Parse the key, value in case it's metainfo if K[0] == "$": # We ignore attributes which pertain to the cookie