webengine/osswebengine/WebCore/platform/network/symbian/CookieHandler.cpp
changeset 36 0ed94ceaa377
parent 0 dd21522fd290
child 65 5bfc169077b2
child 70 8bfb9186a8b8
--- a/webengine/osswebengine/WebCore/platform/network/symbian/CookieHandler.cpp	Tue Nov 24 09:02:20 2009 +0200
+++ b/webengine/osswebengine/WebCore/platform/network/symbian/CookieHandler.cpp	Thu Dec 17 09:20:16 2009 +0200
@@ -19,7 +19,7 @@
 
 // INCLUDES
 #include "Cookiehandler.h"
-#include <CookieManagerClient.h>
+#include <cookiemanagerclient.h>
 
 // EXTERNAL DATA STRUCTURES
 
@@ -148,10 +148,22 @@
         popAndDestroyCount ++;
     }
     
-    // if the domain is not specified then extract the domain name from the Url
+    // if the path is not specified then extract the domain name from the Url
+    // Why do we duplicate this code here?  It already exists in Cookie's constructl's call to adddefaultpathl?
+    TPtrC8 requestPath;
     if(!cookieRecord.m_pathName.Length()) {
         const TDesC8& pathName= uriParser.Extract(EUriPath);
-        cookieRecord.m_pathName.Set(TPtrC(asciiToUnicodeLC(pathName)->Des()));
+        const TUint8 KCookiePathSeparator = '/';
+        requestPath.Set(pathName);
+        TInt sepPos = requestPath.LocateReverse( KCookiePathSeparator );
+        // if / is not the last character
+        if ( 0 <= sepPos && ( ( sepPos + 1 != requestPath.Length() ) ) )
+            {
+            // then remove characters after the right-most /
+            requestPath.Set( requestPath.Left( sepPos + 1 ) );
+            }
+
+        cookieRecord.m_pathName.Set(TPtrC(asciiToUnicodeLC(requestPath)->Des()));
         popAndDestroyCount ++;
     }
     
@@ -162,6 +174,7 @@
         cookieRecord);
     popAndDestroyCount +=6;
     // create a cookie
+    // Why are we using the stringpool only constructor of cookie?
     CCookie* cookie = CCookie::NewL( (*m_stringPool) );
     
     CleanupStack::PushL( cookie );