Closed Bug 67644 Opened 24 years ago Closed 24 years ago

cookies added to cookie list in wrong order

Categories

(Core :: Networking: Cookies, defect)

x86
Windows NT
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: morse, Assigned: morse)

Details

Attachments

(1 file)

The cookie list needs to be ordered by path length -- the longest length first. The algorithm involving domain cookies depends on this ordering. Assume the cookie list consists of cookies A, B, C, and D in that order and pathlen(A) > pathlen(B) > pathlen(C) > pathlen(D). Suppose that a new cookie X is to be added to the list and pathlen(D) > pathlen(X). Currenlty that cookie will be inserted before D whereas it should be inserted after it. Besides the above problem (which is an outright bug), there is another problem. Philip Van Hoof <freax@pandora.be> reported that the order of cookies sent to the site by mozilla is opposite the order sent out by 4.x. That's not a bug -- nowhere in the cookie spec does it specify what order the cookies are to be sent out. But apparently Philip has an application that is sensitive to that order. Attaching a patch that corrects both problems. The for-loop change in the patch corrects the second problem (ordering of cookies sent back to site) and the chagne for instertElementAt corrects the first problem (the real bug).
In order to q/a this, here are the tests that I received from Philip Van Hoof. 1. Visit the following sites in the order specified. Each one will set a cookie. http://www.websell.eu.org/test.php?Action=add&addthis=one http://www.websell.eu.org/test.php?Action=add&addthis=two http://www.websell.eu.org/test.php?Action=add&addthis=three http://www.websell.eu.org/test.php?Action=add&addthis=four http://www.websell.eu.org/test.php?Action=add&addthis=five http://www.websell.eu.org/test.php?Action=add&addthis=six Then visit the following site and see what cookies are being sent back to the site and in what order http://www.websell.eu.org/test.php?Action=list For the 4.x browser (and also IE according to Van Hoof although I didn't verify that) the final site will display: 1(hash)=one (number in the list=1) 2(hash)=two (number in the list=2) 3(hash)=three (number in the list=3) 4(hash)=four (number in the list=4) 5(hash)=five (number in the list=5) 6(hash)=six (number in the list=6) But for mozilla you get: 1(hash)=one (number in the list=1) 6(hash)=six (number in the list=2) 5(hash)=five (number in the list=3) 4(hash)=four (number in the list=4) 3(hash)=three (number in the list=5) 2(hash)=two (number in the list=6) Cookie one is obviously out of sequence (should be last, not first) and that is due to the real bug here. In fact, the above sequence is what clued me in to the fact that there was a problem. The fact that the sequence is backwords from what it is in 4.x is the other problem (not a bug) described here.
cc'ing alecf for super-review
ok, looks good. sr=alecf
This was checked in last week but I forgot to mark it as closed.
Status: NEW → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: