Closed Bug 12702 Opened 27 years ago Closed 27 years ago

Cookies not working at all (well a little now)

Categories

(Core :: Networking: Cookies, defect, P3)

defect

Tracking

()

VERIFIED FIXED

People

(Reporter: paulmac, Assigned: dougt)

References

Details

I can't get cookies to work at all using 8/27 builds on all platforms. This is postM9 merge. I tested three different ways: 1. goto home.netscape.com and shutdown. Then look at your cookies file. It's empty except for comments. 2. Goto bugzilla.mozilla.org then click on enter bug, then browser, then enter your username/password. It will bring up the enter bug page. Go back to bugzilla.mozilla.org and repeat the process. You will again be asked to enter your username/password. 3. Goto http://slip/projects/dogbert/test/web/internal/cookies/wa_cookie_name1.html and set one of the cookies then click on 'see the cookies'. There won't be a cookie shown.
note: all of these were working on the final M9 builds.
Assignee: neeti → dougt
It looks like cookies broke when dougt changed the nsHTTPResponseListener to use proxy objects for the nsNetModuleMgr... Now, when nsCookieHTTPNotify::AsyncExamineResponse(...) calls pHTTPConnection->GetResponseHeader(...) the nsIAtom for the "set-cookie" header is no longer an nsIAtom (but a nsProxyEventObject) this causes the atom lookup to fail and return null. So, the cookie code *never* thinks that cookies have been set by the server :-( I'm reassigning this bug to doug since he should know what to do. -- rick
Status: NEW → ASSIGNED
The real bug I believe is a comparison on line 176 of nsHTTPHeaderArray.cpp. The line compares pointers rather than values. Since the nsIAtom needs to be wrapped, this comparison fails.
Status: ASSIGNED → RESOLVED
Closed: 27 years ago
Resolution: --- → FIXED
cool that was it. check it out: # Netscape HTTP Cookie File # http://www.netscape.com/newsref/std/cookie_spec.html # This is a generated file! Do not edit. .netscape.com TRUE / FALSE 1293843501 UIDC 206.222.244.90:0935878540:693772 home.netscape.com FALSE / FALSE 942189054 NGUserID cfc84b06-10646-935878558-1 (sorry about the wrapping). Index: nsHTTPHeaderArray.cpp =================================================================== RCS file: /cvsroot/mozilla/netwerk/protocol/http/src/nsHTTPHeaderArray.cpp,v retrieving revision 1.4 diff -u -r1.4 nsHTTPHeaderArray.cpp --- nsHTTPHeaderArray.cpp 1999/08/21 00:22:15 1.4 +++ nsHTTPHeaderArray.cpp 1999/08/28 22:22:17 @@ -173,7 +173,14 @@ entry = mHTTPHeaders->ElementAt(i); element = NS_STATIC_CAST(nsHeaderEntry*, entry); - if (aHeader == element->mAtom.get()) { + + PRUnichar* aHeaderString; + PRUnichar* elementString; + aHeader->GetUnicode( &aHeaderString ); + element->mAtom.get()->GetUnicode( &elementString ); + + if (nsCRT::strcmp(aHeaderString, elementString) == 0) + { *aResult = element; NS_ADDREF(*aResult); return i;
Unfortunately, the whole point of using Atoms is to avoid the string compare :-( There should be some way to compare Atoms rather than cracking them open... Otherwise they become useless.
I was hoping that using a strcmp() would not be the final solution. Comparing pointer is just not a good solution. Maybe the best thing to do would be to add an Equal() function to the nsIAtom?
Status: RESOLVED → REOPENED
Summary: Cookies not working at all → Cookies not working at all (well a little now)
Resolution: FIXED → ---
Of the three tests above, only #1 is working now, so re-opening. These were all working with the M9 release builds. Updated summary.
Blocks: 12755
adding 12755 to the depending list.
Status: REOPENED → ASSIGNED
paulmac, I have a fix for this. Both the first two test cases work as expected, but the third does not have any persistance. For instance, I click on the "Set name1=value1" link. Then I can go to the "see the cookie" link and I can see that it is set. But when I restart the browser, this cookie is *not* in the cookie.txt file. Is this "passing" this testcase?
doug, yes, there should not be persistence on that case. If you want to try persistence, you can go to http://slip/projects/dogbert/test/web/internal/cookies/expire1.html and try one of the cookies that are set to expire in future
Status: ASSIGNED → RESOLVED
Closed: 27 years ago → 27 years ago
Resolution: --- → FIXED
checking in fix now.
Status: RESOLVED → VERIFIED
verified
You need to log in before you can comment on or make changes to this bug.