src/network/access/qnetworkcookiejar.cpp
changeset 3 41300fa6a67c
parent 0 1918ee327afb
child 4 3b1da2848fc7
--- a/src/network/access/qnetworkcookiejar.cpp	Tue Jan 26 12:42:25 2010 +0200
+++ b/src/network/access/qnetworkcookiejar.cpp	Tue Feb 02 00:43:10 2010 +0200
@@ -192,12 +192,20 @@
         // validate the cookie & set the defaults if unset
         if (cookie.path().isEmpty())
             cookie.setPath(defaultPath);
-        else if (!isParentPath(pathAndFileName, cookie.path()))
-            continue;           // not accepted
-
+        // don't do path checking. See http://bugreports.qt.nokia.com/browse/QTBUG-5815
+//        else if (!isParentPath(pathAndFileName, cookie.path())) {
+//            continue;           // not accepted
+//        }
         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))) {