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 |