webengine/osswebengine/WebCore/platform/network/symbian/CookieHandler.cpp
changeset 36 0ed94ceaa377
parent 0 dd21522fd290
child 65 5bfc169077b2
child 70 8bfb9186a8b8
equal deleted inserted replaced
32:9a9a761f03f1 36:0ed94ceaa377
    17 
    17 
    18 
    18 
    19 
    19 
    20 // INCLUDES
    20 // INCLUDES
    21 #include "Cookiehandler.h"
    21 #include "Cookiehandler.h"
    22 #include <CookieManagerClient.h>
    22 #include <cookiemanagerclient.h>
    23 
    23 
    24 // EXTERNAL DATA STRUCTURES
    24 // EXTERNAL DATA STRUCTURES
    25 
    25 
    26 // EXTERNAL FUNCTION PROTOTYPES
    26 // EXTERNAL FUNCTION PROTOTYPES
    27 
    27 
   146         const TDesC8& domainName = uriParser.Extract(EUriHost);
   146         const TDesC8& domainName = uriParser.Extract(EUriHost);
   147         cookieRecord.m_domainName.Set(TPtrC(asciiToUnicodeLC(domainName)->Des()));
   147         cookieRecord.m_domainName.Set(TPtrC(asciiToUnicodeLC(domainName)->Des()));
   148         popAndDestroyCount ++;
   148         popAndDestroyCount ++;
   149     }
   149     }
   150     
   150     
   151     // if the domain is not specified then extract the domain name from the Url
   151     // if the path is not specified then extract the domain name from the Url
       
   152     // Why do we duplicate this code here?  It already exists in Cookie's constructl's call to adddefaultpathl?
       
   153     TPtrC8 requestPath;
   152     if(!cookieRecord.m_pathName.Length()) {
   154     if(!cookieRecord.m_pathName.Length()) {
   153         const TDesC8& pathName= uriParser.Extract(EUriPath);
   155         const TDesC8& pathName= uriParser.Extract(EUriPath);
   154         cookieRecord.m_pathName.Set(TPtrC(asciiToUnicodeLC(pathName)->Des()));
   156         const TUint8 KCookiePathSeparator = '/';
       
   157         requestPath.Set(pathName);
       
   158         TInt sepPos = requestPath.LocateReverse( KCookiePathSeparator );
       
   159         // if / is not the last character
       
   160         if ( 0 <= sepPos && ( ( sepPos + 1 != requestPath.Length() ) ) )
       
   161             {
       
   162             // then remove characters after the right-most /
       
   163             requestPath.Set( requestPath.Left( sepPos + 1 ) );
       
   164             }
       
   165 
       
   166         cookieRecord.m_pathName.Set(TPtrC(asciiToUnicodeLC(requestPath)->Des()));
   155         popAndDestroyCount ++;
   167         popAndDestroyCount ++;
   156     }
   168     }
   157     
   169     
   158     // initialize the strings , to be stored in string pool
   170     // initialize the strings , to be stored in string pool
   159     // note the function 6 items on the cleanupstack , so increment popAndDestroyCount by 6
   171     // note the function 6 items on the cleanupstack , so increment popAndDestroyCount by 6
   160     initAttributesForLongCookieLC(name, nameValue, expiresAttrib, pathAttrib,
   172     initAttributesForLongCookieLC(name, nameValue, expiresAttrib, pathAttrib,
   161         domainAttrib, versionAttrib,
   173         domainAttrib, versionAttrib,
   162         cookieRecord);
   174         cookieRecord);
   163     popAndDestroyCount +=6;
   175     popAndDestroyCount +=6;
   164     // create a cookie
   176     // create a cookie
       
   177     // Why are we using the stringpool only constructor of cookie?
   165     CCookie* cookie = CCookie::NewL( (*m_stringPool) );
   178     CCookie* cookie = CCookie::NewL( (*m_stringPool) );
   166     
   179     
   167     CleanupStack::PushL( cookie );
   180     CleanupStack::PushL( cookie );
   168     popAndDestroyCount ++;
   181     popAndDestroyCount ++;
   169     
   182