applayerprotocols/httptransportfw/Test/testfilter/testhttpfilter.cpp
branchRCL_3
changeset 19 c0c2f28ace9c
parent 6 fa2fd8b2d6cc
child 20 a0da872af3fa
equal deleted inserted replaced
18:5f1cd966e0d9 19:c0c2f28ace9c
    16 #include <http/rhttptransaction.h>
    16 #include <http/rhttptransaction.h>
    17 #include <http/rhttpheaders.h>
    17 #include <http/rhttpheaders.h>
    18 #include <http/rhttpresponse.h>
    18 #include <http/rhttpresponse.h>
    19 #include <httperr.h>
    19 #include <httperr.h>
    20 #include <httpstringconstants.h>
    20 #include <httpstringconstants.h>
    21 //#include <imcvcodc.h>      //for base64 en/decoding
       
    22 #include <bautils.h>
    21 #include <bautils.h>
    23 #include <e32math.h>
    22 #include <e32math.h>
    24 #include <hash.h>
    23 #include <hash.h>
    25 #include <e32const.h>
    24 #include <e32const.h>
    26 #include <tconvbase64.h>
    25 #include <tconvbase64.h>  //for base64 en/decoding
    27 #include "testhttpfilter.h"
    26 #include "testhttpfilter.h"
    28 _LIT8( KTESTHTTPFilterName, "TestHttp");
    27 _LIT8( KTESTHTTPFilterName, "TestHttp");
    29 _LIT8( KAuthenticationInfoStr, "Authentication-Info" );
    28 _LIT8( KAuthenticationInfoStr, "Authentication-Info" );
    30 _LIT8( KUserAgentProductToken,"3gpp-gba");
    29 _LIT8( KUserAgentProductToken,"3gpp-gba");
    31 _LIT8( KColon, ":" );
       
    32 const TInt KB64KeySize = 64;
    30 const TInt KB64KeySize = 64;
    33 _LIT(KTestHttpFilter, "TEST HTTP FILTER ");
    31 _LIT(KTestHttpFilter, "TEST HTTP FILTER ");
    34 
    32 
    35 void PanicTestHttpFilters(TInt aErr = 0)
    33 void PanicTestHttpFilters(TInt aErr = 0)
    36 {
    34 {
   241 	if(  status == HTTPStatus::EUnauthorized )
   239 	if(  status == HTTPStatus::EUnauthorized )
   242 	{				
   240 	{				
   243 	
   241 	
   244 	   TInt headerPart=0;    	
   242 	   TInt headerPart=0;    	
   245 	   THTTPHdrVal headerVal;
   243 	   THTTPHdrVal headerVal;
   246        TInt cred = KErrNotFound;
       
   247        RStringF wwwAuthHeader = iStringPool.StringF(HTTP::EWWWAuthenticate,RHTTPSession::GetTable());
   244        RStringF wwwAuthHeader = iStringPool.StringF(HTTP::EWWWAuthenticate,RHTTPSession::GetTable());
   248 	   RHTTPHeaders headers(aTrans.Response().GetHeaderCollection());
   245 	   RHTTPHeaders headers(aTrans.Response().GetHeaderCollection());
   249 
   246 
   250 	    RString realm;
   247 	    RString realm;
   251 	    THTTPHdrVal hdrVal;
   248 	    THTTPHdrVal hdrVal;
   318 	found = rawFieldData.Find(iUserAgent.DesC()) != KErrNotFound;
   315 	found = rawFieldData.Find(iUserAgent.DesC()) != KErrNotFound;
   319 	
   316 	
   320 	if(!found)
   317 	if(!found)
   321 	    hdr.SetFieldL(fieldname, iUserAgent);
   318 	    hdr.SetFieldL(fieldname, iUserAgent);
   322 	
   319 	
   323     TInt cred = KErrNotFound;
       
   324     
       
   325     if( iHaveCredentials )
   320     if( iHaveCredentials )
   326         {
   321         {
   327         TBuf8<KB64KeySize> keyBase64(_L8("Aladdin")); 
   322         TBuf8<KB64KeySize> keyBase64(_L8("Aladdin")); 
   328         TBuf8<KB64KeySize> keyBase64Username(_L8("open sesame"));;
   323         TBuf8<KB64KeySize> keyBase64Username(_L8("open sesame"));;
   329         RString username = iStringPool.OpenStringL( keyBase64 );
   324         RString username = iStringPool.OpenStringL( keyBase64 );