Bug 284299

Summary: Cookie management dialog not showing some cookies
Product: [Applications] konqueror Reporter: Gregorio Guidi <greg_g>
Component: kcookiejarAssignee: David Faure <faure>
Status: RESOLVED FIXED    
Severity: normal CC: adawit, kde_bugs
Priority: NOR    
Version: Git   
Target Milestone: ---   
Platform: Unlisted Binaries   
OS: Linux   
Latest Commit: Version Fixed In: 4.8.3
Sentry Crash Report:
Attachments: Fix cookie management dialog not showing some cookies

Description Gregorio Guidi 2011-10-17 19:30:32 UTC
Created attachment 64645 [details]
Fix cookie management dialog not showing some cookies

Version:           Git (using Devel) 
OS:                Linux

In "Configure konqueror..." -> cookies -> management, sometimes cookies are not shown when clicking on an item. An example is given by cookies from forums.gentoo.org.

This happens after commit ee6b38ff9c989e9dff9a6646fd68d0878868027e
which does the following:

--- a/kioslave/http/kcookiejar/kcookiejar.cpp
+++ b/kioslave/http/kcookiejar/kcookiejar.cpp
@@ -1110,7 +1110,7 @@ KHttpCookieList *KCookieJar::getCookieList(const QString & _domain,
     if (_domain.isEmpty())
         stripDomain(_fqdn, domain);
     else
-        stripDomain (_domain, domain);
+        domain = _domain;
 
     return m_cookieDomains.value(domain);
 }

The problem is fixed by integrating that commit with an analogous change in stripDomain(const KHttpCookie& cookie): (see also attached patch)


--- a/kioslave/http/kcookiejar/kcookiejar.cpp
+++ b/kioslave/http/kcookiejar/kcookiejar.cpp
@@ -532,7 +532,7 @@ QString KCookieJar::stripDomain(const KHttpCookie& cookie)
     if (cookie.domain().isEmpty())
        stripDomain( cookie.host(), domain);
     else
-       stripDomain( cookie.domain(), domain);
+       domain = cookie.domain();
     return domain;
 }
 


Reproducible: Always

Steps to Reproduce:
Visit forums.gentoo.org, go to "Configure konqueror..." -> cookies -> management and click on cookie list.

Actual Results:  
Cookie details not shown.

Expected Results:  
Cookie details shown.
Comment 1 Dawit Alemayehu 2011-10-17 20:14:40 UTC
This has already been fixed in the kdelibs 4.7 and frameworks branches. See

https://projects.kde.org/projects/kde/kdelibs/repository/revisions/ee6b38ff9c989e9dff9a6646fd68d0878868027e

Hopefully you generated the patch against an older version of kdelibs code base because the master branch of kdelibs is dead and should not be used.
Comment 2 Gregorio Guidi 2011-10-18 17:11:13 UTC
> https://projects.kde.org/projects/kde/kdelibs/repository/revisions/ee6b38ff9c989e9dff9a6646fd68d0878868027e

Hi Dawit, actually what I wanted to say is that the commit above fixes the cookies not showing for some sites, but causes cookies not showing for other sites.

That commit changes the logic in KCookieJar::getCookieList(...), however the same logic is duplicated in KCookieJar::stripDomain(const KHttpCookie& cookie). With the attached patch the logic is changed there in the same way. In my testing, this fixes all the occurrences of cookies not showing, both old testcases and new ones.
Comment 3 Anguo 2012-03-31 10:32:11 UTC
I have the same or at least a very similar issue and I am not sure if it has been fixed since.

With KDE 4.6.5, cookies where the domain value is empty are not listed in the cookie management dialog. They are listed in the file  ~/.kde/share/apps/kcookiejar/cookies.

I am a bit confused about the different between the 'host' and the 'domain' values. In any case, cookies without a domain value are not listed under the relevant host.

Apparently, this is the issue that Dawitt said got fixed in the 4.7 branch, but since Gregorio seems to be having further issues despite the fix, I thought I'd report this, just in case...

Thanks.
Comment 4 Dawit Alemayehu 2012-04-20 14:57:42 UTC
Git commit 01c0d95e025d8c6e297db7a89a3d2929b05ca1f9 by Dawit Alemayehu.
Committed on 20/04/2012 at 16:54.
Pushed by adawit into branch 'KDE/4.8'.

Fixed the issue of some cookies not showing up in the cookie management dialog.
FIXED-IN: 4.8.3

M  +1    -1    kioslave/http/kcookiejar/kcookiejar.cpp

http://commits.kde.org/kdelibs/01c0d95e025d8c6e297db7a89a3d2929b05ca1f9
Comment 5 Anguo 2012-04-20 15:00:01 UTC
Thank you, Dawit!
Comment 6 Ivan Čukić 2012-05-09 10:25:32 UTC
Git commit 2b0f80a196425724080ff4af9e5fc9375e9a592a by Ivan Čukić, on behalf of Dawit Alemayehu.
Committed on 20/04/2012 at 16:54.
Pushed by ivan into branch 'ivan/plasma-active-patches'.

Fixed the issue of some cookies not showing up in the cookie management dialog.
FIXED-IN: 4.8.3

M  +1    -1    kioslave/http/kcookiejar/kcookiejar.cpp

http://commits.kde.org/kdelibs/2b0f80a196425724080ff4af9e5fc9375e9a592a