diff options
| author | Chris Larson <clarson@kergoth.com> | 2004-12-09 09:47:41 +0000 |
|---|---|---|
| committer | Chris Larson <clarson@kergoth.com> | 2004-12-09 09:47:41 +0000 |
| commit | 2c5b8ec6d95cf68650265941530e5ce38c8dd6d9 (patch) | |
| tree | bf879bea7ef8517ba8c3d1286ef300401d3d484c /konqueror | |
| parent | 101e2f1623def0a355d20aacb8bd93810703e834 (diff) | |
Merge oe-devel@oe-devel.bkbits.net:openembedded
into hyperion.kergoth.com:/home/kergoth/code/openembedded
2004/12/09 03:39:39-06:00 kergoth.com!kergoth
Break people's builds again.. this time moving the packages into a packages/ subdir to clean things up a bit.
BKrev: 41b81f3dvlp3rU7_8MUXLcI8LDdDoA
Diffstat (limited to 'konqueror')
9 files changed, 0 insertions, 5937 deletions
diff --git a/konqueror/konqueror-embedded-20030705/flashpart.patch b/konqueror/konqueror-embedded-20030705/flashpart.patch deleted file mode 100644 index d1bef8043f..0000000000 --- a/konqueror/konqueror-embedded-20030705/flashpart.patch +++ /dev/null @@ -1,10 +0,0 @@ -diff -ur konqe.old/konq-embed/add-ons/kflashpart/flashlib/Makefile.am konqueror-embedded-snapshot-20030705/konq-embed/add-ons/kflashpart/flashlib/Makefile.am ---- konqe.old/konq-embed/add-ons/kflashpart/flashlib/Makefile.am 2003-05-29 17:08:45.000000000 +0200 -+++ konqueror-embedded-snapshot-20030705/konq-embed/add-ons/kflashpart/flashlib/Makefile.am 2004-08-22 21:40:24.000000000 +0200 -@@ -1,5 +1,6 @@ - # Comment out the following line if you use egcs : - CXXFLAGS=-O3 -Wall -fno-rtti -fno-exceptions -DDISABLE_NONQIMAGE_DEPTHS -+INCLUDES = $(QTOPIA_INCLUDES) $(all_includes) - - noinst_LTLIBRARIES = libflash.la - diff --git a/konqueror/konqueror-embedded-20030705/include_qconfig.patch b/konqueror/konqueror-embedded-20030705/include_qconfig.patch deleted file mode 100644 index 245d031863..0000000000 --- a/konqueror/konqueror-embedded-20030705/include_qconfig.patch +++ /dev/null @@ -1,14 +0,0 @@ -We need to have the defines available before -we try to evaluate them - - - ---- konqueror-embedded-snapshot-20030705/konq-embed/src/popuphandler.cc~ 2002-12-05 13:47:07.000000000 +0100 -+++ konqueror-embedded-snapshot-20030705/konq-embed/src/popuphandler.cc 2004-08-22 17:10:44.000000000 +0200 -@@ -1,3 +1,6 @@ -+ -+#include <qnamespace.h> -+ - #include "popuphandler.h" - - #if defined(_WS_QWS_) && defined(QT_NO_QWS_CURSOR) diff --git a/konqueror/konqueror-embedded-20030705/kcookiejar-merge.patch b/konqueror/konqueror-embedded-20030705/kcookiejar-merge.patch deleted file mode 100644 index 24e84bc5b2..0000000000 --- a/konqueror/konqueror-embedded-20030705/kcookiejar-merge.patch +++ /dev/null @@ -1,2924 +0,0 @@ - -# -# Patch managed by http://www.holgerschurig.de/patcher.html -# - ---- konqueror-embedded-snapshot-20030705/konq-embed/kdesrc/kio/http/kcookiejar/kcookiejar.cpp~kcookiejar-merge.patch -+++ konqueror-embedded-snapshot-20030705/konq-embed/kdesrc/kio/http/kcookiejar/kcookiejar.cpp -@@ -1,8 +1,8 @@ - /* This file is part of the KDE File Manager - -- Copyright (C) 1998,1999,2000,2001 Waldo Bastian (bastian@kde.org) -- Copyright (C) 2000,2001 Dawit Alemayehu (adawit@kde.org) -- -+ Copyright (C) 1998-2000 Waldo Bastian (bastian@kde.org) -+ Copyright (C) 2000,2001 Dawit Alemayehu (adawit@kde.org) -+ - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights -@@ -22,17 +22,18 @@ - */ - //---------------------------------------------------------------------------- - // --// KDE HTTP Cookie Manager --// $Id$ -+// KDE File Manager -- HTTP Cookies -+// $Id$ - - // - // The cookie protocol is a mess. RFC2109 is a joke since nobody seems to --// use it. Apart from that it is badly written. We try to implement Netscape --// Cookies and try to behave according to RFC2109 as much as we can. -+// use it. Apart from that it is badly written. -+// We try to implement Netscape Cookies and try to behave us according to -+// RFC2109 as much as we can. -+// -+// We assume cookies do not contain any spaces (Netscape spec.) -+// According to RFC2109 this is allowed though. - // --// We assume cookies do not contain any spaces (Netscape spec.) According to --// RFC2109 this is allowed though. -- - - #include <config.h> - #include <sys/types.h> -@@ -44,12 +45,23 @@ - #include <unistd.h> - #include <stdio.h> - #include <string.h> -+ -+#ifdef USE_SOLARIS -+#include <strings.h> -+#endif -+ - #include <stdlib.h> - -+//#include <netinet/in.h> -+//#include <arpa/inet.h> -+ - #include <qstring.h> - #include <qstrlist.h> - #include <qlist.h> - #include <qdict.h> -+#include <qfile.h> -+#include <qdir.h> -+#include <qregexp.h> - - #include <kurl.h> - #include <krfcdate.h> -@@ -61,6 +73,13 @@ - - #define READ_BUFFER_SIZE 8192 - -+// Note with respect to QString::fromLatin1( ) -+// Cookies are stored as 8 bit data and passed to kio_http as -+// latin1 regardless of their actual encoding. -+ -+// L1 is used to indicate latin1 constants -+#define L1(x) QString::fromLatin1(x) -+ - template class QList<KHttpCookie>; - template class QDict<KHttpCookieList>; - -@@ -68,10 +87,10 @@ - { - switch( _advice ) - { -- case KCookieAccept: return "Accept"; -- case KCookieReject: return "Reject"; -- case KCookieAsk: return "Ask"; -- default: return "Dunno"; -+ case KCookieAccept: return L1("Accept"); -+ case KCookieReject: return L1("Reject"); -+ case KCookieAsk: return L1("Ask"); -+ default: return L1("Dunno"); - } - } - -@@ -80,7 +99,7 @@ - if (_str.isEmpty()) - return KCookieDunno; - -- QString advice = _str.lower(); -+ QCString advice = _str.lower().latin1(); - - if (advice == "accept") - return KCookieAccept; -@@ -105,17 +124,20 @@ - const QString &_value, - time_t _expireDate, - int _protocolVersion, -- bool _secure) : -+ bool _secure, -+ bool _httpOnly, -+ bool _explicitPath) : - mHost(_host), - mDomain(_domain), -- mPath(_path), -+ mPath(_path.isEmpty() ? QString::null : _path), - mName(_name), - mValue(_value), - mExpireDate(_expireDate), - mProtocolVersion(_protocolVersion), -- mSecure(_secure) -+ mSecure(_secure), -+ mHttpOnly(_httpOnly), -+ mExplicitPath(_explicitPath) - { -- nextCookie = 0; - } - - // -@@ -135,16 +157,17 @@ - - if (useDOMFormat || (mProtocolVersion == 0)) - { -- result = mName + "=" + mValue; -+ if ( !mName.isEmpty() ) -+ result = mName + '='; -+ result += mValue; - } - else - { -- result.sprintf("$Version=\"%d\"; ", mProtocolVersion); -- result += mName + "=\"" + mValue + "\""; -- if (!mPath.isEmpty()) -- result += "; $Path=\""+ mPath + "\""; -+ result = mName + '=' + mValue; -+ if (mExplicitPath) -+ result += L1("; $Path=\"") + mPath + L1("\""); - if (!mDomain.isEmpty()) -- result += "; $Domain=\""+ mDomain + "\""; -+ result += L1("; $Domain=\"") + mDomain + L1("\""); - } - return result; - } -@@ -157,8 +180,7 @@ - // Cookie domain match check - if (mDomain.isEmpty()) - { -- // No domain set, check hostname. -- if (fqdn != mHost) -+ if (fqdn != mHost) - return false; - } - else if (!domains.contains(mDomain)) -@@ -167,17 +189,30 @@ - return false; - - // Maybe the domain needs an extra dot. -- QString domain = "." + mDomain; -+ QString domain = '.' + mDomain; - if ( !domains.contains( domain ) ) - if ( fqdn != mDomain ) - return false; - } - - // Cookie path match check -- if( !path.isEmpty() && !path.startsWith(mPath) ) -- return false; // Path of URL does not start with cookie-path -+ if (mPath.isEmpty()) -+ return true; - -- return true; -+ // According to the netscape spec both http://www.acme.com/foobar, -+ // http://www.acme.com/foo.bar and http://www.acme.com/foo/bar -+ // match http://www.acme.com/foo. -+ // We only match http://www.acme.com/foo/bar -+ -+ if( path.startsWith(mPath) && -+ ( -+ (path.length() == mPath.length() ) || // Paths are exact match -+ (path[mPath.length()-1] == '/') || // mPath ended with a slash -+ (path[mPath.length()] == '/') // A slash follows. -+ )) -+ return true; // Path of URL starts with cookie-path -+ -+ return false; - } - - // KHttpCookieList -@@ -188,9 +223,9 @@ - int pathLen1 = ((KHttpCookie *)item1)->path().length(); - int pathLen2 = ((KHttpCookie *)item2)->path().length(); - if (pathLen1 > pathLen2) -- return 1; -- if (pathLen1 < pathLen2) - return -1; -+ if (pathLen1 < pathLen2) -+ return 1; - return 0; - } - -@@ -205,10 +240,18 @@ - // - KCookieJar::KCookieJar() - { -- cookieDomains.setAutoDelete( true ); -- globalAdvice = KCookieDunno; -- configChanged = false; -- cookiesChanged = false; -+ m_cookieDomains.setAutoDelete( true ); -+ m_globalAdvice = KCookieDunno; -+ m_configChanged = false; -+ m_cookiesChanged = false; -+ -+ QString twoLevelTLD="name,ai,au,bd,bh,ck,eg,et,fk,il,in,kh,kr,mk,mt,na,np,nz,pg,pk,qa,sa,sb,sg,sv,ua,ug,uk,uy,vn,za,zw"; -+ QStringList countries = QStringList::split(',', twoLevelTLD); -+ for(QStringList::ConstIterator it = countries.begin(); -+ it != countries.end(); ++it) -+ { -+ m_twoLevelTLD.replace(*it, (int *) 1); -+ } - } - - // -@@ -221,89 +264,184 @@ - // Not much to do here - } - -+static void removeDuplicateFromList(KHttpCookieList *list, KHttpCookie *cookiePtr, bool nameMatchOnly=false, bool updateWindowId=false) -+{ -+ QString domain1 = cookiePtr->domain(); -+ if (domain1.isEmpty()) -+ domain1 = cookiePtr->host(); -+ -+ for ( KHttpCookiePtr cookie=list->first(); cookie != 0; ) -+ { -+ QString domain2 = cookie->domain(); -+ if (domain2.isEmpty()) -+ domain2 = cookie->host(); -+ -+ if ( -+ (cookiePtr->name() == cookie->name()) && -+ ( -+ nameMatchOnly || -+ ( (domain1 == domain2) && (cookiePtr->path() == cookie->path()) ) -+ ) -+ ) -+ { -+ if (updateWindowId) -+ { -+ for(QValueList<long>::ConstIterator it = cookie->windowIds().begin(); -+ it != cookie->windowIds().end(); ++it) -+ { -+ long windowId = *it; -+ if (windowId && (cookiePtr->windowIds().find(windowId) == cookiePtr->windowIds().end())) -+ { -+ cookiePtr->windowIds().append(windowId); -+ } -+ } -+ } -+ KHttpCookiePtr old_cookie = cookie; -+ cookie = list->next(); -+ list->removeRef( old_cookie ); -+ break; -+ } -+ else -+ { -+ cookie = list->next(); -+ } -+ } -+} -+ -+ - // - // Looks for cookies in the cookie jar which are appropriate for _url. - // Returned is a string containing all appropriate cookies in a format - // which can be added to a HTTP-header without any additional processing. - // --QString KCookieJar::findCookies(const QString &_url, bool useDOMFormat) -+QString KCookieJar::findCookies(const QString &_url, bool useDOMFormat, long windowId, KHttpCookieList *pendingCookies) - { - QString cookieStr; - QStringList domains; - QString fqdn; - QString path; - KHttpCookiePtr cookie; -- int protVersion = 1; -- int cookieCount = 0; -+ KCookieAdvice advice = m_globalAdvice; - - if (!parseURL(_url, fqdn, path)) -- { - return cookieStr; -- } -+ -+ bool secureRequest = (_url.find( L1("https://"), 0, false) == 0 || -+ _url.find( L1("webdavs://"), 0, false) == 0); - - extractDomains(fqdn, domains); -- bool secureRequest = (_url.find( "https://", 0, false) == 0); -+ -+ KHttpCookieList allCookies; -+ - for(QStringList::ConstIterator it = domains.begin(); -- it != domains.end(); -+ true; - ++it) - { -- KHttpCookieList *cookieList = cookieDomains[(*it)]; -+ KHttpCookieList *cookieList; -+ if (it == domains.end()) -+ { -+ cookieList = pendingCookies; // Add pending cookies -+ pendingCookies = 0; -+ if (!cookieList) -+ break; -+ } -+ else -+ { -+ QString key = (*it).isNull() ? L1("") : (*it); -+ cookieList = m_cookieDomains[key]; -+ if (!cookieList) -+ continue; // No cookies for this domain -+ } - -- if (!cookieList) -- continue; // No cookies for this domain -+ if (cookieList->getAdvice() != KCookieDunno) -+ advice = cookieList->getAdvice(); -+ -+ // Do not send cookies for this domain if policy is set to reject -+ // and we are not setup to automatically accept all cookies as -+ // session cookies... -+ if (advice == KCookieReject && -+ !(m_ignoreCookieExpirationDate && m_autoAcceptSessionCookies)) -+ { -+ if (it == domains.end()) -+ break; // Finished. -+ continue; -+ } - - for ( cookie=cookieList->first(); cookie != 0; cookie=cookieList->next() ) - { -- if (!cookie->match(fqdn, domains, path) && cookie->domain().isEmpty()) -- { -- // The following code is added because RFC 2109 is completely -- // ambigious when it comes what needs to be done when cookies -- // with empty "domain=" fields are present! The following code -- // makes such cookies available to all the domains/hosts under -- // the TLD of the cookie in question! -- QStringList cookieDomainList; -- extractDomains( cookie->host(), cookieDomainList ); -- -- int fqdnCount = domains.count(); -- int cookieDomainCount = cookieDomainList.count(); -- -- if ( domains[fqdnCount-2] != cookieDomainList[cookieDomainCount-2] && -- domains[fqdnCount-1] != cookieDomainList[cookieDomainCount-1] ) -- continue; -- } -+ if (!cookie->match(fqdn, domains, path)) -+ continue; - - if( cookie->isSecure() && !secureRequest ) - continue; - -- // Use first cookie to determine protocol version -- if (cookieCount == 0) -+ if( cookie->isHttpOnly() && useDOMFormat ) -+ continue; -+ -+ // Do not send expired cookies. -+ if ( cookie->isExpired (time(0)) ) - { -- protVersion = cookie->protocolVersion(); -+ // Note there is no need to actually delete the cookie here -+ // since the cookieserver will invoke ::saveCookieJar because -+ // of the state change below. This will then do the job of -+ // deleting the cookie for us. -+ m_cookiesChanged = true; -+ continue; - } -- if (useDOMFormat) -+ -+ if (windowId && (cookie->windowIds().find(windowId) == cookie->windowIds().end())) - { -- if (cookieCount > 0) -- cookieStr += "; "; -- cookieStr += cookie->cookieStr(true); -+ cookie->windowIds().append(windowId); - } -- else if (protVersion == 0) -+ -+ if (it == domains.end()) // Only needed when processing pending cookies -+ removeDuplicateFromList(&allCookies, cookie); -+ -+ allCookies.append(cookie); -+ } -+ if (it == domains.end()) -+ break; // Finished. -+ } -+ -+ -+ int cookieCount = 0; -+ -+ int protVersion=0; -+ for ( cookie=allCookies.first(); cookie != 0; cookie=allCookies.next() ) -+ { -+ if (cookie->protocolVersion() > protVersion) -+ protVersion = cookie->protocolVersion(); -+ } -+ -+ for ( cookie=allCookies.first(); cookie != 0; cookie=allCookies.next() ) -+ { -+ if (useDOMFormat) -+ { -+ if (cookieCount > 0) -+ cookieStr += L1("; "); -+ cookieStr += cookie->cookieStr(true); -+ } -+ else -+ { -+ if (cookieCount == 0) - { -- if (cookieCount == 0) -- cookieStr += "Cookie: "; -- else -- cookieStr += "; "; -- cookieStr += cookie->cookieStr(false); -+ cookieStr += L1("Cookie: "); -+ if (protVersion > 0) -+ { -+ QString version; -+ version.sprintf("$Version=%d; ", protVersion); // Without quotes -+ cookieStr += version; -+ } - } - else - { -- if (cookieCount > 0) -- cookieStr += "\r\n"; -- cookieStr += "Cookie: "; -- cookieStr += cookie->cookieStr(false); -+ cookieStr += L1("; "); - } -- cookieCount++; -+ cookieStr += cookie->cookieStr(false); - } -+ cookieCount++; - } -+ - return cookieStr; - } - -@@ -323,17 +461,17 @@ - bool keepQuotes=false) - { - const char *s = header; -- - // Parse 'my_name' part - for(; (*s != '='); s++) - { - if ((*s=='\0') || (*s==';') || (*s=='\n')) - { -- // End of Name -- Value = ""; -- Name = header; -- Name.truncate( s - header ); -- Name = Name.stripWhiteSpace(); -+ // No '=' sign -> use string as the value, name is empty -+ // (behavior found in Mozilla and IE) -+ Name = ""; -+ Value = QString::fromLatin1(header); -+ Value.truncate( s - header ); -+ Value = Value.stripWhiteSpace(); - return (s); - } - } -@@ -366,12 +504,12 @@ - if ((*s=='\0') || (*s=='\n')) - { - // End of Name -- Value = header; -+ Value = QString::fromLatin1(header); - Value.truncate(s - header); - return (s); - } - } -- Value = header; -+ Value = QString::fromLatin1(header); - Value.truncate( s - header ); - - // *s == '\"'; -@@ -390,7 +528,7 @@ - while ((*s != '\0') && (*s != ';') && (*s != '\n')) - s++; - // End of Name -- Value = header; -+ Value = QString::fromLatin1(header); - Value.truncate( s - header ); - Value = Value.stripWhiteSpace(); - } -@@ -398,14 +536,14 @@ - - } - --static void stripDomain(const QString &_fqdn, QString &_domain) -+void KCookieJar::stripDomain(const QString &_fqdn, QString &_domain) - { - QStringList domains; -- KCookieJar::extractDomains(_fqdn, domains); -+ extractDomains(_fqdn, domains); - _domain = domains[0]; - } - --static QString stripDomain( KHttpCookiePtr cookiePtr) -+QString KCookieJar::stripDomain( KHttpCookiePtr cookiePtr) - { - QString domain; // We file the cookie under this domain. - if (cookiePtr->domain().isEmpty()) -@@ -420,10 +558,18 @@ - QString &_path) - { - KURL kurl(_url); -- if (kurl.isMalformed()) -+ if (!kurl.isValid()) - return false; - - _fqdn = kurl.host().lower(); -+ if (kurl.port()) -+ { -+ if (((kurl.protocol() == L1("http")) && (kurl.port() != 80)) || -+ ((kurl.protocol() == L1("https")) && (kurl.port() != 443))) -+ { -+ _fqdn = L1("%1:%2").arg(kurl.port()).arg(_fqdn); -+ } -+ } - - // Cookie spoofing protection. Since there is no way a path separator - // or escape encoded character is allowed in the hostname according -@@ -435,19 +581,44 @@ - - _path = kurl.path(); - if (_path.isEmpty()) -- _path = "/"; -+ _path = L1("/"); -+ -+ QRegExp exp(L1("[\\\\/]\\.\\.[\\\\/]")); -+ // Weird path, cookie stealing attempt? -+ if (_path.find(exp) != -1) { -+ return false; // Deny everything!! -+ } -+ - return true; - } - - void KCookieJar::extractDomains(const QString &_fqdn, - QStringList &_domains) - { -- // Use fqdn only if the fqdn consists of numbers. -- if ((_fqdn[0] >= '0') && (_fqdn[0] <= '9')) -+ // Return numeric IPv6 addresses as is... -+ if (_fqdn[0] == '[') - { - _domains.append( _fqdn ); - return; - } -+ // Return numeric IPv4 addresses as is... -+ if ((_fqdn[0] >= '0') && (_fqdn[0] <= '9')) -+ { -+ bool allNumeric = true; -+ for(int i = _fqdn.length(); i--;) -+ { -+ if (!strchr("0123456789:.", _fqdn[i].latin1())) -+ { -+ allNumeric = false; -+ break; -+ } -+ } -+ if (allNumeric) -+ { -+ _domains.append( _fqdn ); -+ return; -+ } -+ } - - QStringList partList = QStringList::split('.', _fqdn, false); - -@@ -458,29 +629,36 @@ - { - if (partList.count() == 1) - break; // We only have a TLD left. -- if (partList.count() == 2) -+ -+ if ((partList.count() == 2) && (m_twoLevelTLD[partList[1].lower()])) -+ { -+ // This domain uses two-level TLDs in the form xxxx.yy -+ break; -+ } -+ -+ if ((partList.count() == 2) && (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) && -- (partList[1].length() == 2)) -+ 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); -+ -+ QString domain = partList.join(L1(".")); -+ _domains.append('.' + domain); - _domains.append(domain); - partList.remove(partList.begin()); // Remove part - } - -- // Only URLs that would get in here are of type -- // "host.foo" or "host.co.fo" so simply append -- // a '.' on top to make sure they are stored under -- // the proper cookie domain. -- if (_domains.isEmpty()) -- _domains.append( "." + _fqdn ); -- - // Always add the FQDN at the end of the list for - // hostname == cookie-domainname checks! -+ _domains.append( '.' + _fqdn ); - _domains.append( _fqdn ); - } - -@@ -492,55 +670,73 @@ - // cookie_headers should be a concatenation of all lines of a HTTP-header - // which start with "Set-Cookie". The lines should be separated by '\n's. - // --KHttpCookiePtr KCookieJar::makeCookies(const QString &_url, -+KHttpCookieList KCookieJar::makeCookies(const QString &_url, - const QCString &cookie_headers, - long windowId) - { -- KHttpCookiePtr cookieChain = 0; -+ KHttpCookieList cookieList; -+ KHttpCookieList cookieList2; - KHttpCookiePtr lastCookie = 0; - const char *cookieStr = cookie_headers.data(); - QString Name; - QString Value; - QString fqdn; - QString path; -+ bool crossDomain = false; - - if (!parseURL(_url, fqdn, path)) - { - // Error parsing _url -- return 0; -+ return KHttpCookieList(); - } -+ QString defaultPath; -+ int i = path.findRev('/'); -+ if (i > 0) -+ defaultPath = path.left(i); - - // The hard stuff :) - for(;;) - { - // check for "Set-Cookie" -- if (strncasecmp(cookieStr, "Set-Cookie:", 11) == 0) -+ if (strncmp(cookieStr, "Cross-Domain\n", 13) == 0) -+ { -+ cookieStr += 13; -+ crossDomain = true; -+ } -+ else if (strncasecmp(cookieStr, "Set-Cookie:", 11) == 0) - { - cookieStr = parseNameValue(cookieStr+11, Name, Value, true); - -- if (Name.isEmpty()) -- continue; -- - // Host = FQDN - // Default domain = "" -- // Default path = "" -- KHttpCookie *cookie = new KHttpCookie(fqdn, "", "", Name, Value); -- cookie->mWindowId = windowId; -+ // Default path according to rfc2109 -+ -+ KHttpCookie *cookie = new KHttpCookie(fqdn, L1(""), defaultPath, Name, Value); -+ if (windowId) -+ cookie->mWindowIds.append(windowId); -+ cookie->mCrossDomain = crossDomain; - - // Insert cookie in chain -- if (lastCookie) -- lastCookie->nextCookie = cookie; -- else -- cookieChain = cookie; -+ cookieList.append(cookie); - lastCookie = cookie; - } -- else if (lastCookie && (strncasecmp(cookieStr, "Set-Cookie2:", 12) == 0)) -+ else if (strncasecmp(cookieStr, "Set-Cookie2:", 12) == 0) - { -- // What the fuck is this? -- // Does anyone invent his own headers these days? -- // Read the fucking RFC guys! This header is not there! -- cookieStr +=12; -- // Continue with lastCookie -+ // Attempt to follow rfc2965 -+ cookieStr = parseNameValue(cookieStr+12, Name, Value, true); -+ -+ // Host = FQDN -+ // Default domain = "" -+ // Default path according to rfc2965 -+ -+ KHttpCookie *cookie = new KHttpCookie(fqdn, L1(""), defaultPath, Name, Value); -+ if (windowId) -+ cookie->mWindowIds.append(windowId); -+ cookie->mCrossDomain = crossDomain; -+ -+ // Insert cookie in chain -+ cookieList2.append(cookie); -+ lastCookie = cookie; - } - else - { -@@ -564,13 +760,12 @@ - // Name-Value pair follows - cookieStr = parseNameValue(cookieStr, Name, Value); - -- Name = Name.lower(); -- -- if (Name == "domain") -+ QCString cName = Name.lower().latin1(); -+ if (cName == "domain") - { - lastCookie->mDomain = Value.lower(); - } -- else if (Name == "max-age") -+ else if (cName == "max-age") - { - int max_age = Value.toInt(); - if (max_age == 0) -@@ -578,23 +773,33 @@ - else - lastCookie->mExpireDate = time(0)+max_age; - } -- else if (Name == "expires") -+ else if (cName == "expires") - { - // Parse brain-dead netscape cookie-format - lastCookie->mExpireDate = KRFCDate::parseDate(Value); - } -- else if (Name == "path") -+ else if (cName == "path") - { -- lastCookie->mPath = Value; -+ if (Value.isEmpty()) -+ lastCookie->mPath = QString::null; // Catch "" <> QString::null -+ else -+ lastCookie->mPath = KURL::decode_string(Value); -+ lastCookie->mExplicitPath = true; - } -- else if (Name == "version") -+ else if (cName == "version") - { - lastCookie->mProtocolVersion = Value.toInt(); - } -- else if (Name == "secure") -+ else if ((cName == "secure") || -+ (cName.isEmpty() && Value.lower() == L1("secure"))) - { - lastCookie->mSecure = true; - } -+ else if ((cName == "httponly") || -+ (cName.isEmpty() && Value.lower() == L1("httponly"))) -+ { -+ lastCookie->mHttpOnly = true; -+ } - } - - if (*cookieStr == '\0') -@@ -604,7 +809,14 @@ - cookieStr++; - } - -- return cookieChain; -+ // RFC2965 cookies come last so that they override netscape cookies. -+ while( !cookieList2.isEmpty() && (lastCookie = cookieList2.take(0)) ) -+ { -+ removeDuplicateFromList(&cookieList, lastCookie, true); -+ cookieList.append(lastCookie); -+ } -+ -+ return cookieList; - } - - /** -@@ -613,12 +825,12 @@ - * pairs. Any whitespace before "name" or around '=' is discarded. - * If no cookies are found, 0 is returned. - */ --KHttpCookiePtr KCookieJar::makeDOMCookies(const QString &_url, -+KHttpCookieList KCookieJar::makeDOMCookies(const QString &_url, - const QCString &cookie_domstring, - long windowId) - { - // A lot copied from above -- KHttpCookiePtr cookieChain = 0; -+ KHttpCookieList cookieList; - KHttpCookiePtr lastCookie = 0; - - const char *cookieStr = cookie_domstring.data(); -@@ -630,7 +842,7 @@ - if (!parseURL(_url, fqdn, path)) - { - // Error parsing _url -- return 0; -+ return KHttpCookieList(); - } - - // This time it's easy -@@ -638,35 +850,25 @@ - { - cookieStr = parseNameValue(cookieStr, Name, Value); - -- if (Name.isEmpty()) { -- if (*cookieStr != '\0') -- cookieStr++; // Skip ';' or '\n' -- -- continue; -- } -- - // Host = FQDN - // Default domain = "" - // Default path = "" - KHttpCookie *cookie = new KHttpCookie(fqdn, QString::null, QString::null, - Name, Value ); -- cookie->mWindowId = windowId; -- -- // Insert cookie in chain -- if (lastCookie) -- lastCookie->nextCookie = cookie; -- else -- cookieChain = cookie; -+ if (windowId) -+ cookie->mWindowIds.append(windowId); - -+ cookieList.append(cookie); - lastCookie = cookie; - - if (*cookieStr != '\0') - cookieStr++; // Skip ';' or '\n' - } - -- return cookieChain; -+ return cookieList; - } - -+ - // - // This function hands a KHttpCookie object over to the cookie jar. - // -@@ -674,7 +876,6 @@ - // - void KCookieJar::addCookie(KHttpCookiePtr &cookiePtr) - { -- QString domain; - QStringList domains; - KHttpCookieList *cookieList = 0L; - -@@ -686,42 +887,31 @@ - (it != domains.end() && !cookieList); - ++it ) - { -- KHttpCookieList *list= cookieDomains[(*it)]; -+ QString key = (*it).isNull() ? L1("") : (*it); -+ KHttpCookieList *list= m_cookieDomains[key]; - if ( !list ) continue; - -- for ( KHttpCookiePtr cookie=list->first(); cookie != 0; ) -- { -- if ( cookiePtr->name() == cookie->name() && -- cookie->match(cookiePtr->host(),domains,cookiePtr->path()) ) -- { -- KHttpCookiePtr old_cookie = cookie; -- cookie = list->next(); -- list->removeRef( old_cookie ); -- break; -- } -- else -- { -- cookie = list->next(); -- } -- } -+ removeDuplicateFromList(list, cookiePtr, false, true); - } - -- domain = stripDomain( cookiePtr ); -- cookieList = cookieDomains[ domain ]; -+ QString domain = stripDomain( cookiePtr ); -+ QString key = domain.isNull() ? L1("") : domain; -+ cookieList = m_cookieDomains[ key ]; - if (!cookieList) - { - // Make a new cookie list - cookieList = new KHttpCookieList(); -+ cookieList->setAutoDelete(true); - - // All cookies whose domain is not already - // known to us should be added with KCookieDunno. - // KCookieDunno means that we use the global policy. - cookieList->setAdvice( KCookieDunno ); - -- cookieDomains.insert( domain, cookieList); -+ m_cookieDomains.insert( domain, cookieList); - - // Update the list of domains -- domainList.append(domain); -+ m_domainList.append(domain); - } - - // Add the cookie to the cookie list -@@ -729,7 +919,7 @@ - if (!cookiePtr->isExpired(time(0))) - { |
