2008-08-10 15:59:59 +00:00
|
|
|
Index: kioslave/http/kcookiejar/kcookiejar.cpp
|
|
|
|
===================================================================
|
2008-08-10 16:52:21 +00:00
|
|
|
--- kioslave/http/kcookiejar/kcookiejar.cpp (revision 844829)
|
|
|
|
+++ kioslave/http/kcookiejar/kcookiejar.cpp (revision 844830)
|
|
|
|
@@ -1366,16 +1366,18 @@
|
|
|
|
if ((line[0] == '#') || (line[0] == '['))
|
2008-08-10 15:59:59 +00:00
|
|
|
continue;
|
|
|
|
|
2008-08-10 16:52:21 +00:00
|
|
|
- const char *host( parseField(line) );
|
|
|
|
- const char *domain( parseField(line) );
|
|
|
|
- const char *path( parseField(line) );
|
|
|
|
- const char *expStr( parseField(line) );
|
|
|
|
- if (!expStr) continue;
|
|
|
|
- int expDate = (time_t) strtoul(expStr, 0, 10);
|
|
|
|
- const char *verStr( parseField(line) );
|
|
|
|
- if (!verStr) continue;
|
|
|
|
- int protVer = (time_t) strtoul(verStr, 0, 10);
|
|
|
|
- const char *name( parseField(line) );
|
|
|
|
+ const QString host = QString::fromLatin1( parseField(line) );
|
|
|
|
+ const QString domain = QString::fromLatin1( parseField(line) );
|
|
|
|
+ if (host.isEmpty() && domain.isEmpty())
|
|
|
|
+ continue;
|
|
|
|
+ const QString path = QString::fromLatin1( parseField(line) );
|
|
|
|
+ const QString expStr = QString::fromLatin1( parseField(line) );
|
|
|
|
+ if (expStr.isEmpty()) continue;
|
|
|
|
+ const int expDate = expStr.toInt();
|
|
|
|
+ const QString verStr = QString::fromLatin1( parseField(line) );
|
|
|
|
+ if (verStr.isEmpty()) continue;
|
|
|
|
+ int protVer = verStr.toInt();
|
|
|
|
+ QString name = QString::fromLatin1( parseField(line) );
|
|
|
|
bool keepQuotes = false;
|
|
|
|
bool secure = false;
|
|
|
|
bool httpOnly = false;
|
|
|
|
@@ -1412,11 +1414,11 @@
|
|
|
|
if ((expDate == 0) || (expDate < curTime))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
- KHttpCookie cookie(QString::fromLatin1(host),
|
|
|
|
- QString::fromLatin1(domain),
|
|
|
|
- QString::fromLatin1(path),
|
|
|
|
- QString::fromLatin1(name),
|
|
|
|
- QString::fromLatin1(value),
|
|
|
|
+ KHttpCookie cookie(host,
|
|
|
|
+ domain,
|
|
|
|
+ path,
|
|
|
|
+ name,
|
|
|
|
+ value,
|
|
|
|
expDate, protVer,
|
|
|
|
secure, httpOnly, explicitPath);
|
|
|
|
addCookie(cookie);
|
|
|
|
Index: kioslave/http/kcookiejar/tests/kcookiejartest.cpp
|
|
|
|
===================================================================
|
|
|
|
--- kioslave/http/kcookiejar/tests/kcookiejartest.cpp (revision 844829)
|
|
|
|
+++ kioslave/http/kcookiejar/tests/kcookiejartest.cpp (revision 844830)
|
|
|
|
@@ -80,6 +80,13 @@
|
|
|
|
QString file = KStandardDirs::locateLocal("config", "kcookiejar-testcookies");
|
|
|
|
QFile::remove(file);
|
|
|
|
jar->saveCookies(file);
|
|
|
|
+
|
|
|
|
+ // Add an empty domain to the cookies file, just for testing robustness
|
|
|
|
+ QFile f(file);
|
|
|
|
+ f.open(QIODevice::Append);
|
|
|
|
+ f.write("[]\n \"\" \"/\" 1584320400 0 h 4 x\n");
|
|
|
|
+ f.close();
|
|
|
|
+
|
|
|
|
delete jar;
|
|
|
|
jar = new KCookieJar();
|
|
|
|
clearConfig();
|