[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    Re: kdelibs/kioslave/http/kcookiejar
From:       "Dawit A." <adawit () kde ! org>
Date:       2004-10-04 3:06:08
Message-ID: 200410032306.08873.adawit () kde ! org
[Download RAW message or body]

On Sunday 03 October 2004 22:48, Dawit A. wrote:
> Hmm... KCookieJar::cookieAdvice might need this fix as well.

Answering myself I believe we do need to fix cookieAdvice as well. It is 
probably the cause for BR# 81313 and related reports we get from time 
to time. 

Anyways, Waldo please look at the attached patch and feel free 
to commit them if you agree with them. The first part of the patch applies the 
same fix as the one for KCookieServer::getDomainAdvice. The second part fixes 
KCookieJar::getDomainAdvice so that it returns KCookieAccept if the user has 
chosen to automatically accept all cookies as session cookies...


-- 
Regards,
Dawit A.
"Preach what you practice, practice what you preach"

["kcookiejar.diff" (text/x-diff)]

Index: kcookiejar.cpp
===================================================================
RCS file: /home/kde/kdelibs/kioslave/http/kcookiejar/kcookiejar.cpp,v
retrieving revision 1.117
diff -u -p -b -B -w -r1.117 kcookiejar.cpp
--- kcookiejar.cpp	20 Jul 2004 15:29:24 -0000	1.117
+++ kcookiejar.cpp	4 Oct 2004 03:01:11 -0000
@@ -975,15 +975,22 @@ KCookieAdvice KCookieJar::cookieAdvice(K
     KCookieAdvice advice = KCookieDunno;
 
     QStringList::Iterator it = domains.fromLast(); // Start with FQDN which is last in the list.
+    
     while( (advice == KCookieDunno) && (it != domains.end()))
     {
-       QString domain = *it;
+       // Check for advice under both ".domain" and "domain". Note
+       // that we only want to check "domain" if it matches the
+       // FQDN of the cookie URL.
+       if ( (*it)[0] == '.' || cookiePtr->host() == (*it) )
+       {
        // Check if a policy for the FQDN/domain is set.
-       KHttpCookieList *cookieList = m_cookieDomains[domain];
+          KHttpCookieList *cookieList = m_cookieDomains[(*it)];
        if (cookieList)
           advice = cookieList->getAdvice();
+       }
+          
        domains.remove(it);
-       it = domains.begin(); // Continue from begin of remaining list
+       it = domains.begin(); // Continue from the start for remaining items
     }
 
     if (advice == KCookieDunno)
@@ -998,19 +1005,14 @@ KCookieAdvice KCookieJar::cookieAdvice(K
 //
 KCookieAdvice KCookieJar::getDomainAdvice(const QString &_domain)
 {
-    KHttpCookieList *cookieList = m_cookieDomains[_domain];
-    KCookieAdvice advice;
+    // Return accept if we are configured to automatically
+    // accept all session cookies.
+    if( m_autoAcceptSessionCookies && m_ignoreCookieExpirationDate )
+       return KCookieAccept;
 
-    if (cookieList)
-    {
-        advice = cookieList->getAdvice();
-    }
-    else
-    {
-        advice = KCookieDunno;
-    }
+    KHttpCookieList *cookieList = m_cookieDomains[_domain];
 
-    return advice;
+    return ((cookieList) ? cookieList->getAdvice(): KCookieDunno);
 }
 
 //


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic