1025 { |
1025 { |
1026 totalsize-= At( 0 )->Size( ETrue ); |
1026 totalsize-= At( 0 )->Size( ETrue ); |
1027 Remove( 0 ); |
1027 Remove( 0 ); |
1028 }; |
1028 }; |
1029 } |
1029 } |
|
1030 // --------------------------------------------------------- |
|
1031 // CCookieArray::ReserveL |
|
1032 // --------------------------------------------------------- |
|
1033 // |
|
1034 void CCookieArray::ReserveL( TInt aNumberOfCookies ) |
|
1035 { |
|
1036 iCookies.ReserveL( aNumberOfCookies ); |
|
1037 } |
|
1038 // --------------------------------------------------------- |
|
1039 // CCookieArray::GetCookies |
|
1040 // --------------------------------------------------------- |
|
1041 // |
|
1042 TInt CCookieArray::GetCookies( const TDesC8& aRequestUri, |
|
1043 RPointerArray<CCookie>& aCookies, TBool& aFound )// harendra: aFound is redundant |
|
1044 { |
|
1045 CLOG( ( ECookieArray, 0, |
|
1046 _L( "-> CCookieArray::GetCookies for an URI" ) ) ); |
|
1047 TUriParser8 uriParser; |
|
1048 TInt err = uriParser.Parse( aRequestUri ); |
|
1049 if ( !err ) |
|
1050 { |
|
1051 // first get the details of the current requestUri, |
|
1052 // that is, Domain, Path and port |
|
1053 TPtrC8 requestPath( uriParser.IsPresent( EUriPath ) ? |
|
1054 uriParser.Extract( EUriPath ) : KNullDesC8() ); |
|
1055 TPtrC8 requestDomain( uriParser.IsPresent( EUriHost ) ? |
|
1056 uriParser.Extract( EUriHost ) : KNullDesC8() ); |
|
1057 TPtrC8 requestPort( uriParser.IsPresent( EUriPort ) ? |
|
1058 uriParser.Extract( EUriPort ) : KCookieDefaultRequestPort() ); |
|
1059 TPtrC8 requestScheme( uriParser.IsPresent( EUriScheme ) ? |
|
1060 uriParser.Extract( EUriScheme ) : KNullDesC8() ); |
|
1061 |
|
1062 // now check the existing cookies |
|
1063 // remove expired ones first, if there are any |
|
1064 RemoveExpired(); |
|
1065 // and finally, find the cookies... |
|
1066 TInt count = iCookies.Count(); |
|
1067 for ( TInt i = 0; i < count && err == KErrNone; i++ ) |
|
1068 { |
|
1069 // Does the cookie have Path attribute? |
|
1070 TPtrC8 cookiePath; |
|
1071 if ( !GetFoldedCookieAttr( *iCookies[i], |
|
1072 CCookie::EPath, |
|
1073 cookiePath ) ) |
|
1074 { |
|
1075 continue; |
|
1076 } |
|
1077 |
|
1078 // Does the cookie have Domain attribute? |
|
1079 TPtrC8 cookieDomain; |
|
1080 if ( !GetFoldedCookieAttr( *iCookies[i], |
|
1081 CCookie::EDomain, |
|
1082 cookieDomain ) ) |
|
1083 { |
|
1084 continue; |
|
1085 } |
|
1086 |
|
1087 TPtrC8 cookiePort; |
|
1088 GetFoldedCookiePortAttr( *iCookies[i], cookiePort ); |
|
1089 |
|
1090 if ( PathMatch( requestPath, cookiePath ) && |
|
1091 DomainMatch( requestDomain, cookieDomain, ETrue ) && |
|
1092 PortMatch( requestPort, cookiePort ) && |
|
1093 SecureMatch( requestScheme, *iCookies[i] ) ) |
|
1094 { |
|
1095 CCookie* clone = CCookie::CloneL( *iCookies[i] ); |
|
1096 CleanupStack::PushL( clone ); |
|
1097 err = aCookies.Append(clone); |
|
1098 CleanupStack::Pop(clone); |
|
1099 aFound = ETrue; |
|
1100 } |
|
1101 } |
|
1102 aCookies.Sort( TLinearOrder<CCookie> (CCookieArray::CompareCookiesPath) ); |
|
1103 } |
|
1104 |
|
1105 |
|
1106 |
|
1107 CLOG( ( ECookieArray, 0, |
|
1108 _L( "<- CCookieArray::GetCookies for an URI" ) ) ); |
|
1109 return err; |
|
1110 } |