Version: 3.5.6 (using KDE KDE 3.5.6) Installed from: Compiled From Sources Compiler: gcc 4.1.2-1mdv2007.1 OS: Linux When you log into an amazon.com account 5 persistent cookies are set that expire in 30 years. When viewing these cookies in Konqueror's cookie management, it shows the cookies as expiring at the end of session, and they are indeed deleted when Konqueror is closed. My cookie policy is set to enable cookies, automatically accept session cookies, ask for confirmation.
SVN commit 709516 by adawit: Fix for BR# 145244. Persistent cookies are treated like session cookies. BUG: 145244 M +36 -0 kcookiejar.cpp --- branches/KDE/3.5/kdelibs/kioslave/http/kcookiejar/kcookiejar.cpp #709515:709516 @@ -670,6 +670,37 @@ _domains.prepend( _fqdn ); } + +/* + Changes dates in from the following format + + Wed Sep 12 07:00:00 2007 GMT + to + Wed Sep 12 2007 07:00:00 GMT + + to allow KRFCDate::parseDate to properly parse expiration date formats + used in cookies by some servers such as amazon.com. See BR# 145244. +*/ +static QString fixupDateTime(const QString& dt) +{ + const int index = dt.find(QRegExp("[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}")); + + if (index > -1) + { + QStringList dateStrList = QStringList::split(' ', dt.mid(index)); + if (dateStrList.count() > 1) + { + QString date = dateStrList[0]; + dateStrList[0] = dateStrList[1]; + dateStrList[1] = date; + date = dt; + return date.replace(index, date.length(), dateStrList.join(" ")); + } + } + + return dt; +} + // // This function parses cookie_headers and returns a linked list of // KHttpCookie objects for all cookies found in cookie_headers. @@ -795,6 +826,11 @@ { // Parse brain-dead netscape cookie-format lastCookie->mExpireDate = KRFCDate::parseDate(Value); + + // Workaround for servers that send the expiration date in + // 'Wed Sep 12 07:00:00 2007 GMT' format. See BR# 145244. + if (lastCookie->mExpireDate == 0) + lastCookie->mExpireDate = KRFCDate::parseDate(fixupDateTime(Value)); } else if (cName == "path") {
This bug has returned in trunk. I'm currently using svn revision 866463
I can't confirm this on trunk r870274. Can you please try reproducing it?
I probably should have clarified that this bug is now in kde 4 konqueror. It's still present for me in revision 870578. I usually update from svn once a week, and it wasn't present in whichever revision I was using before 866463.
Created attachment 36405 [details] fix time parsing As I'm affected by this bug I did create a patch to fix it. I'm not very familiar with KDE and Qt coding so I don't know if this is the right place to fix this issue or if it might cause other problems. So please tell me if there are any problems with my patch. If not I'd like to see this fixed in svn.
SVN commit 1063612 by adawit: - Fixed parsing of cookie expiration dates. This resolves the problem of non-session cookies being treated as session ones. - Fixed problems with the recent Y2K38 fix. CCBUG: 145244 CCBUG: 176731 CCBUG: 187792 CCBUG: 191318 M +36 -40 kcookiejar.cpp M +5 -1 kcookiejar.h M +9 -4 tests/cookie.test WebSVN link: http://websvn.kde.org/?view=rev&revision=1063612
Looks fine these days..