Bug 183720

Summary: cookie policies are filed twice and they don't work anyway
Product: [Applications] konqueror Reporter: Juha Tuomala <tuju>
Component: generalAssignee: Konqueror Developers <konq-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: faure, greg_g, rdieter
Priority: NOR    
Version: 4.2.0   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Unspecified   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Juha Tuomala 2009-02-08 19:20:48 UTC
Version:            (using KDE 4.2.0)
Installed from:    Fedora RPMs

I have had recently lot of problems with cookies. For some domains I frequently visit, a cookie policy is asked by konqueror/whateverlib and I keep answering them. Sometimes, I'm not sure, is that due false answers or non-working cookie jar, I have problems to use sessions since cookies are not working.

A screenshot from manager:

http://tuju.fi/kde/kde-4.2-cookie.problem-20090208.png

IMO that shouldn't even be possible since kde.org is already there once, right?
Comment 1 Gregorio Guidi 2009-03-10 20:38:21 UTC
I had a similar problem with respect to unreliable domain-specific policies.

I tracked it down to this fact:
when the cookie settings module reads and then rewrites the config file (kcookiejarrc) it uses the QUrl::fromAce() and QUrl::toAce() functions (decoding/encoding of localized domain names), but this has unintended consequence: it produces
    .kde.org -> fromACE() -> kde.org -> toACE() -> kde.org
the dot is lost and the policy stops working as intended.

This happens in Qt-4.4, then in Qt-4.5 fromAce()/toAce() were rewritten in a cleaner way and the problem stops.

If you have Qt-4.4, I suggest to clean all cookies and policies and give Qt-4.5 a try.

Note that this behaviour could in part explain other bugs, such as bug 179968, bug 182806, bug 184973.
Comment 2 David Faure 2009-03-25 11:34:31 UTC
Gregorio: thanks for this excellent analysis. Indeed fromAce/toAce was buggy in 4.4 and fixed in 4.5, I can confirm this (unittest committed in kurltest.cpp).

Unfortunately this doesn't explain all the other bugs, I just had the loss of cookie policies with Qt-4.5.
Comment 3 Kevin Kofler 2009-03-25 11:57:32 UTC
FWIW, Qt 4.5 is coming soon to Fedora 9 and 10. (The plan is to push it out together with the KDE 4.2.2 update.)
Comment 4 David Faure 2009-03-26 00:29:17 UTC
SVN commit 944701 by dfaure:

Workaround the Qt-4.4 fromAce/toAce bug for the kdelibs-4.2.2 release.
I thought this affected the cookie handling, but in fact it doesn't, it only affects the configuration module :(
CCBUG: 183720


 M  +22 -4     kcookiespolicies.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=944701
Comment 5 David Faure 2009-10-06 12:54:14 UTC
For the record: in 4.6 fromAce/toAce again doesn't accept leading dots, by design. So the "workaround" is actually the long-term solution now ;)