summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJocelyn Turcotte <jocelyn.turcotte@nokia.com>2009-11-09 15:15:32 (GMT)
committerJocelyn Turcotte <jocelyn.turcotte@nokia.com>2009-11-09 15:15:32 (GMT)
commit207970afe90e89dc47f3eb34f5dbf995fdebdce0 (patch)
tree5f9d5eb31b40fef17e523f51d65ac3fe7f2313fb /src
parentf3ec877e6a606304ce766aebbb6886887ded37a2 (diff)
parent4454669fc238171239f8a2f202ec7e26e7409776 (diff)
downloadQt-207970afe90e89dc47f3eb34f5dbf995fdebdce0.zip
Qt-207970afe90e89dc47f3eb34f5dbf995fdebdce0.tar.gz
Qt-207970afe90e89dc47f3eb34f5dbf995fdebdce0.tar.bz2
Merge commit 'qtwebkit/qtwebkit-4.6' into 4.6
Diffstat (limited to 'src')
-rw-r--r--src/network/access/qnetworkcookie.cpp8
-rw-r--r--src/network/access/qnetworkcookiejar.cpp7
2 files changed, 11 insertions, 4 deletions
diff --git a/src/network/access/qnetworkcookie.cpp b/src/network/access/qnetworkcookie.cpp
index 73a8703..7dfb7af 100644
--- a/src/network/access/qnetworkcookie.cpp
+++ b/src/network/access/qnetworkcookie.cpp
@@ -984,14 +984,14 @@ QList<QNetworkCookie> QNetworkCookiePrivate::parseSetCookieHeaderLine(const QByt
cookie.setExpirationDate(dt);
} else if (field.first == "domain") {
QByteArray rawDomain = field.second;
+ QString maybeLeadingDot;
if (rawDomain.startsWith('.')) {
+ maybeLeadingDot = QLatin1Char('.');
rawDomain = rawDomain.mid(1);
}
+
QString normalizedDomain = QUrl::fromAce(QUrl::toAce(QString::fromUtf8(rawDomain)));
- // always add the dot, there are some servers that forget the
- // leading dot. This is actually forbidden according to RFC 2109,
- // but all browsers accept it anyway so we do that as well
- cookie.setDomain(QLatin1Char('.') + normalizedDomain);
+ cookie.setDomain(maybeLeadingDot + normalizedDomain);
} else if (field.first == "max-age") {
bool ok = false;
int secs = field.second.toInt(&ok);
diff --git a/src/network/access/qnetworkcookiejar.cpp b/src/network/access/qnetworkcookiejar.cpp
index 8430966..19f7217 100644
--- a/src/network/access/qnetworkcookiejar.cpp
+++ b/src/network/access/qnetworkcookiejar.cpp
@@ -198,6 +198,13 @@ bool QNetworkCookieJar::setCookiesFromUrl(const QList<QNetworkCookie> &cookieLis
if (cookie.domain().isEmpty()) {
cookie.setDomain(defaultDomain);
} else {
+ // Ensure the domain starts with a dot if its field was not empty
+ // in the HTTP header. There are some servers that forget the
+ // leading dot and this is actually forbidden according to RFC 2109,
+ // but all browsers accept it anyway so we do that as well.
+ if (!cookie.domain().startsWith(QLatin1Char('.')))
+ cookie.setDomain(QLatin1Char('.') + cookie.domain());
+
QString domain = cookie.domain();
if (!(isParentDomain(domain, defaultDomain)
|| isParentDomain(defaultDomain, domain))) {