[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/KDE/3.5/kdelibs/kioslave/http/kcookiejar
From: Dawit Alemayehu <adawit () kde ! org>
Date: 2007-09-07 17:53:18
Message-ID: 1189187598.593832.29092.nullmailer () svn ! kde ! org
[Download RAW message or body]
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")
{
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic