[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:       Dirk Mueller <mueller () kde ! org>
Date:       2005-08-23 1:48:53
Message-ID: 1124761733.440354.25661.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 452328 by mueller:

fix language selector on novell.com


 M  +12 -2     kcookiejar.cpp  
 M  +5 -0      tests/cookie_rfc.test  


--- branches/KDE/3.5/kdelibs/kioslave/http/kcookiejar/kcookiejar.cpp #452327:452328
@@ -773,14 +773,24 @@
         while ((*cookieStr == ';') || (*cookieStr == ' '))
         {
             cookieStr++;
-            
+
             // Name-Value pair follows
             cookieStr = parseNameValue(cookieStr, Name, Value);
 
             QCString cName = Name.lower().latin1();
             if (cName == "domain")
             {
-                lastCookie->mDomain = Value.lower();
+                QString dom = Value.lower();
+                // RFC2965 3.2.2: If an explicitly specified value does not
+                // start with a dot, the user agent supplies a leading dot
+                if(dom.length() && dom[0] != '.')
+                    dom.prepend(".");
+                // remove a trailing dot
+                if(dom.length() > 2 && dom[dom.length()-1] == '.')
+                    dom = dom.left(dom.length()-1);
+
+                if(dom.contains('.') > 1 || dom == ".local")
+                    lastCookie->mDomain = dom;
             }
             else if (cName == "max-age")
             {
--- branches/KDE/3.5/kdelibs/kioslave/http/kcookiejar/tests/cookie_rfc.test \
#452327:452328 @@ -38,6 +38,11 @@
 COOKIE ASK http://w.y.z/ Set-Cookie2: some_value=; Version=1; Path="/"; Max-Age=0
 CHECK http://w.y.z/ Cookie: $Version=1; some_value2=foobar; $Path="/"
 CLEAR COOKIES
+## Check if we prepend domain with a dot
+COOKIE ASK http://w.y.z/ Set-Cookie2: some_value=value2; Version=1; Path="/"; \
Domain=.y.z; Max-Age=3600 +COOKIE ASK http://w.y.z/ Set-Cookie2: some_value=value3; \
Version=1; Path="/"; Domain=y.z.; Max-Age=3600 +CHECK http://w.y.z/ Cookie: \
$Version=1; some_value=value3; $Path="/"; $Domain=".y.z" +CLEAR COOKIES
 ## Check if multiple cookies on a single line work
 ## FIXME
 #COOKIE ASK http://w.y.z/ Set-Cookie2: some_value=value3; Version=1; Path="/"; \
Max-Age=3600, some_value2=foobar; Version=1; Path="/"; Max-Age=3600


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic