- -static QString stripDomain( KHttpCookiePtr cookiePtr)
+QString KCookieJar::stripDomain( KHttpCookiePtr cookiePtr)
{
QString domain; // We file the cookie under this domain.
if (cookiePtr->domain().isEmpty())
@@ -504,13 +512,30 @@ void KCookieJar::extractDomains(const QS
{
if (partList.count() == 1)
break; // We only have a TLD left.
+
if (partList.count() == 2)
{
// If this is a TLD, we should stop. (e.g. co.uk)
+ if (m_twoLevelTLD[partList[1].lower()])
+ {
+ // This domain uses two-level TLDs in the form xxxx.yy
+ break;
+ }
+
// We assume this is a TLD if it ends with .xx.yy or .x.yy
- - if ((partList[0].length() <= 2) &&
- - (partList[1].length() == 2))
- - break; // This is a TLD.
+ if (partList[1].length() == 2)
+ {
+ // If this is a TLD, we should stop. (e.g. co.uk)
+ // We assume this is a TLD if it ends with .xx.yy or .x.yy
+ if (partList[0].length() <= 2)
+ break; // This is a TLD.
+
+ // Catch some TLDs that we miss with the previous check
+ // e.g. com.au, org.uk, mil.co
+ QCString t = partList[0].lower().utf8();
+ if ((t == "com") || (t == "net") || (t == "org") || (t == "gov") || (t == "edu") || (t == "mil") || (t == "int"))
+ break;
+ }
}
QString domain = partList.join(".");
_domains.append("." + domain);
Index: kioslave/http/kcookiejar/kcookiejar.h
===================================================================
RCS file: /home/kde/kdelibs/kioslave/http/kcookiejar/kcookiejar.h,v
retrieving revision 1.24
diff -u -p -r1.24 kcookiejar.h
- --- kioslave/http/kcookiejar/kcookiejar.h 22 Sep 2001 22:56:14 -0000 1.24
+++ kioslave/http/kcookiejar/kcookiejar.h 28 Jul 2004 06:51:41 -0000
@@ -297,8 +297,8 @@ public:
/**
* Returns a list of domains (_domainList) relevant for this host.
*/
- - static void extractDomains(const QString &_fqdn,
- - QStringList &_domainList);
+ void extractDomains(const QString &_fqdn,
+ QStringList &_domainList);