Revision: 201021
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Fri, 11 Jun 2010 14:06:05 +0300
changeset 23 ea9c9681bbaf
parent 19 2f328ce1b263
child 27 974c3ee9bf20
Revision: 201021 Kit: 2010123
applayerpluginsandutils/httpprotocolplugins/httpheadercodec/chttpgeneralheaderwriter.cpp
applayerpluginsandutils/uripermissionservices/Test/tineturilistserverunit.cpp
applayerpluginsandutils/uripermissionservices/group/tineturilistserverunit.mmp
applayerprotocols/httpservice/test/httpservicetest/ctestclienthttpget.cpp
applayerprotocols/httpservice/test/httpservicetest/ctestclienthttppost.cpp
applayerprotocols/httpservice/test/httpservicetest/ctesthttpclientstep.cpp
applayerprotocols/httpservice/test/httpservicetest/ctestserverstreammanager.cpp
applayerprotocols/httptransportfw/Test/T_HttpOffline/t_hdrcodec.cpp
applayerprotocols/httptransportfw/Test/T_HttpOffline/t_hdrcodec.h
applayerprotocols/httptransportfw/Test/TestScriptTest/CPipeliningTestEngine.cpp
applayerprotocols/httptransportfw/Test/testfilter/testhttpfilter.cpp
applayerprotocols/httptransportfw/core/CHeaderField.cpp
applayerprotocols/httptransportfw/core/CTransaction.cpp
applayerprotocols/httptransportfw/core/chttpformencoder.cpp
applayerprotocols/httptransportfw/group/httpcore.iby
--- a/applayerpluginsandutils/httpprotocolplugins/httpheadercodec/chttpgeneralheaderwriter.cpp	Thu May 27 13:21:53 2010 +0300
+++ b/applayerpluginsandutils/httpprotocolplugins/httpheadercodec/chttpgeneralheaderwriter.cpp	Fri Jun 11 14:06:05 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2003-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of "Eclipse Public License v1.0"
@@ -22,6 +22,7 @@
 #include "CHeaderField.h"
 
 _LIT8(KSemiSpaceSep,"; ");
+_LIT8(KCommaSpaceSep,", ");
 
 CHttpGeneralHeaderWriter* CHttpGeneralHeaderWriter::NewL(RStringPool aStringPool)
 /** 
@@ -91,7 +92,53 @@
 				directly
 */
 	{
-	DoTokenCsvListHeaderL(aHeader, KErrHttpEncodeCacheControl);
+	THeaderFieldPartIter iter = aHeader.PartsL();
+    iter.First();
+	if (iter.AtEnd())
+	   User::Leave(KErrHttpEncodeCacheControl);
+	
+	aHeader.BeginRawDataL();
+	do
+	    {
+	    const CHeaderFieldPart* part = iter();
+	    if(part == NULL)
+	        User::Leave(KErrHttpEncodeCacheControl);	    
+	    THTTPHdrVal ptVal = part->Value();
+	    if (ptVal.Type() != THTTPHdrVal::KStrFVal)
+	        User::Leave(KErrHttpEncodeCacheControl);
+	    const TDesC8& val = ptVal.StrF().DesC(); 
+	    if(val.Length() > 0)
+	        {
+	        aHeader.WriteRawDataL(val);
+	        }
+	    else
+	        {
+	        // Now we must have part as the strF value is KNulLDesC8
+	        THeaderFieldParamIter iter2 = part->Parameters();
+	        if(!iter2.AtEnd())
+	            {
+	            const CHeaderFieldParam* param = iter2();
+	            aHeader.WriteRawDataL(param->Name().DesC());
+	            aHeader.WriteRawDataL('=');
+	            THTTPHdrVal val2 = param->Value();
+	            if(val2.Type() == THTTPHdrVal::KTIntVal)
+	                {
+	                TBuf8<32> desc;
+	                desc.AppendNum(val2.Int());
+	                aHeader.WriteRawDataL(desc);
+	                }
+	            else if(val2.Type() == THTTPHdrVal::KStrFVal)
+	                {
+	                aHeader.WriteRawDataL(param->Name().DesC());
+	                }	            
+	            }
+	        }
+	    ++iter;
+	    if(!iter.AtEnd())
+	        aHeader.WriteRawDataL(KCommaSpaceSep());
+	    
+	    }while(!iter.AtEnd());
+	aHeader.CommitRawData();
 	}
 
 void CHttpGeneralHeaderWriter::EncodeConnectionL(RHeaderField& aHeader) const
--- a/applayerpluginsandutils/uripermissionservices/Test/tineturilistserverunit.cpp	Thu May 27 13:21:53 2010 +0300
+++ b/applayerpluginsandutils/uripermissionservices/Test/tineturilistserverunit.cpp	Fri Jun 11 14:06:05 2010 +0300
@@ -100,11 +100,11 @@
 	RSqlDatabase::Delete ( KDatabaseName() );		
 	}
 
-LOCAL_C void TestUriListInitializerL ()
+/*LOCAL_C void TestUriListInitializerL ()
 	{
 	gListInterface = CUriListInterface::NewL ();
 //	delete listInterface;
-	}
+	}*/
 
 LOCAL_C CInetUriImpl* CreateUriL ( const TDesC8& aUri, TListType aListType, const TDesC8& aFavouriteName )
 	{
@@ -183,10 +183,10 @@
 	return uri;	
 	}
 
-LOCAL_C void CountUriL ()
+/*LOCAL_C void CountUriL ()
 	{
 	gTestWrapper->TEST ( gListInterface->CountUriL ( InetUriList::EBrowser, InetUriList::EWhiteList ) == 1 );
-	}
+	}*/
 	
 LOCAL_C void MatchUris ( const CInetUriImpl& aUri, const CInetUriImpl& aUri2 )
 	{
@@ -240,10 +240,11 @@
 	RemoveTestL ( uri3, KErrNone );
 	CInetUriImpl* uri4 = NULL;
 	TRAP ( err, uri4 = OpenUriL ( KTestUri() ) );
+	CleanupStack::PushL ( uri4 );
 	__LEAVEIFOOM__
 	gTestWrapper->TEST ( err == KErrUriNotFound );
 	
-	CleanupStack::PopAndDestroy (4); //uri, uri2, uri3, gListInterface		
+	CleanupStack::PopAndDestroy (5); //uri, uri2, uri3, uri4, gListInterface		
 	}
 
 LOCAL_C void AddMoreUrisTestL ()
--- a/applayerpluginsandutils/uripermissionservices/group/tineturilistserverunit.mmp	Thu May 27 13:21:53 2010 +0300
+++ b/applayerpluginsandutils/uripermissionservices/group/tineturilistserverunit.mmp	Fri Jun 11 14:06:05 2010 +0300
@@ -48,6 +48,8 @@
 SOURCE  tineturilistserverunit.cpp
 SOURCE	testutils.cpp
 
+MW_LAYER_SYSTEMINCLUDE_SYMBIAN
+
 SOURCEPATH	../server/src
 SOURCE 		sqldbaccessor.cpp
 SOURCE 		urilistinterface.cpp
--- a/applayerprotocols/httpservice/test/httpservicetest/ctestclienthttpget.cpp	Thu May 27 13:21:53 2010 +0300
+++ b/applayerprotocols/httpservice/test/httpservicetest/ctestclienthttpget.cpp	Fri Jun 11 14:06:05 2010 +0300
@@ -20,7 +20,6 @@
 #include <tinternetdate.h>
 _LIT8(KAcceptHeader, "Accept");
 _LIT8(KAcceptValue, "text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5");
-_LIT(KTestHttpClientAPITestTitle, "HTTP client API Unit Test Harness");
 _LIT(KTransferProgress, "File size: %d kb , Downloaded so far: %d kb");
 
 CTestClientHttpSimpleGet* CTestClientHttpSimpleGet::NewL(CHttpClientTestParams& aParams, MLocalTestServerObserver& aObserver, CHttpService& aClient, const TDesC8& aUri, CHTTPTestUtils* aUtils)
--- a/applayerprotocols/httpservice/test/httpservicetest/ctestclienthttppost.cpp	Thu May 27 13:21:53 2010 +0300
+++ b/applayerprotocols/httpservice/test/httpservicetest/ctestclienthttppost.cpp	Fri Jun 11 14:06:05 2010 +0300
@@ -18,7 +18,6 @@
 #include <httpstringconstants.h>
 #include "mlocaltestserverobserver.h"
 #include "chttpclienttestparams.h"
-_LIT(KTestHttpClientAPITestTitle, "HTTP client API Unit Test Harness");
 _LIT(KTransferProgress, "File size: %d kb , Uploaded so far: %d kb"); 
 
 CTestClientHttpSimplePost* CTestClientHttpSimplePost::NewL(CHttpClientTestParams& aParams, MLocalTestServerObserver& aObserver, CHttpService& aClient, const TDesC8& aUri, CHTTPTestUtils& aUtils)
--- a/applayerprotocols/httpservice/test/httpservicetest/ctesthttpclientstep.cpp	Thu May 27 13:21:53 2010 +0300
+++ b/applayerprotocols/httpservice/test/httpservicetest/ctesthttpclientstep.cpp	Fri Jun 11 14:06:05 2010 +0300
@@ -52,7 +52,6 @@
 // TEF virtuals
 TVerdict CTestHttpClientStep::doTestStepPreambleL()
     {
-    TInt status;
     iActiveScheduler = new (ELeave) CActiveScheduler();
     CActiveScheduler::Install(iActiveScheduler);
     iTestParamArray = new(ELeave) CHttpClientTestParamArray;
@@ -66,7 +65,7 @@
     connPref.SetIapId(1);
     connPref.SetNetId(0);
     iHttpConnInfo = iHttpClient->HttpNetworkConnection();
-    status = iHttpConnInfo->Start();
+    User::LeaveIfError(iHttpConnInfo->Start());
     THttpHeaderValueVariant variant(KUserAgent());
     if(iHttpClient->AddRequestHeader(HTTP::EUserAgent, variant))
         {
--- a/applayerprotocols/httpservice/test/httpservicetest/ctestserverstreammanager.cpp	Thu May 27 13:21:53 2010 +0300
+++ b/applayerprotocols/httpservice/test/httpservicetest/ctestserverstreammanager.cpp	Fri Jun 11 14:06:05 2010 +0300
@@ -18,10 +18,8 @@
 #include <moutputstream.h>
 #include "httptestutils.h"
 #include "chttpclienttestparams.h"
+#include <escapeutils.h>
 
-const TUint KCarriageReturn = '\r';
-const TUint KLineFeed       = '\n';
-const TUint KSpace          = ' ';
 
 CLocalTestServerStreamManager* CLocalTestServerStreamManager::NewL(CHTTPTestUtils& aTestUtils, MInputStream* aInStream, MOutputStream* aOutStream, CHttpClientTestParamArray& aTestParamArray)
 	{
@@ -68,19 +66,27 @@
 	    }
 	else
 	    {
-	    // Check to see if the buffer needs to grow
-        TInt maxLength  = iRequestStream->Des().MaxLength();
-        TInt reqdLength = iRequestStream->Length() + aBuffer.Length();
-	    if (reqdLength > maxLength)
+	    if(aBuffer.CompareF(iCurrentTestParam->EncodedAuthenticationRequest()) != 0)
 	        {
-	        HBufC8* largerBuffer = iRequestStream->ReAllocL(maxLength + aBuffer.Length());
-
-	        // Switch buffers. The old one was removed by ReAlloc.
-	        iRequestStream = largerBuffer;
+            // Check to see if the buffer needs to grow
+            TInt maxLength  = iRequestStream->Des().MaxLength();
+            TInt reqdLength = iRequestStream->Length() + aBuffer.Length();
+            if (reqdLength > maxLength)
+                {
+                HBufC8* largerBuffer = iRequestStream->ReAllocL(maxLength + aBuffer.Length());
+    
+                // Switch buffers. The old one was removed by ReAlloc.
+                iRequestStream = largerBuffer;
+                }
+    
+            // Can now append confidently
+            iRequestStream->Des().Append(aBuffer);   
+            }
+	    else
+	        {
+	        iRequestStream = aBuffer.AllocL();
+	      	iCurrentTestParam->SetAuthReqRes();
 	        }
-
-	    // Can now append confidently
-	    iRequestStream->Des().Append(aBuffer);
 	    }
 	   iInputStream->ReceivedDataRes();	    
 	ProcessRequestStreamL();
--- a/applayerprotocols/httptransportfw/Test/T_HttpOffline/t_hdrcodec.cpp	Thu May 27 13:21:53 2010 +0300
+++ b/applayerprotocols/httptransportfw/Test/T_HttpOffline/t_hdrcodec.cpp	Fri Jun 11 14:06:05 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2003-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of "Eclipse Public License v1.0"
@@ -87,6 +87,7 @@
 	ResetTimeElapsed();
 
 	// Run tests on parsed -> OTA data conversions, for each header implemented
+	TestDecodeEncodeCacheControlL();
 	TestEncodeAcceptL();
 	TestEncodeAcceptCharsetL();
 	TestEncodeAuthorizationL();
@@ -292,6 +293,53 @@
 	}
 
 
+void CHttpHdrCodecTest::TestDecodeEncodeCacheControlL()
+	{
+	_LIT8(KCacheControlOTAVal, "private, max-age=360, must-revalidate");
+	RStringF cacheControl = iStrP.StringF(HTTP::ECacheControl,RHTTPSession::GetTable());
+	RStringF maxAge = iStrP.StringF(HTTP::EMaxAge,RHTTPSession::GetTable());
+	RHTTPHeaders hdr = GetHeadersLC();
+	hdr.SetRawFieldL(cacheControl, KCacheControlOTAVal, KFieldSeparator);
+	if(hdr.FieldPartsL(cacheControl) != 3)
+	    {
+        iEngine->Utils().LogIt(_L("\nCache-Control OTA comparison  failed -> [parts != 3]"));
+        User::Leave(KErrCorrupt);
+	    }
+	THTTPHdrVal hVal;
+	User::LeaveIfError(hdr.GetField(cacheControl,0,hVal));
+	if(hVal.StrF().DesC().Compare(_L8("private")) != 0)
+	    {
+	    iEngine->Utils().LogIt(_L("\nCache-Control OTA comparison  failed -> [private]"));
+	    User::Leave(KErrCorrupt);
+	    }
+	THTTPHdrVal paramVal;
+	User::LeaveIfError(hdr.GetParam(cacheControl, maxAge, paramVal, 1));
+	if(paramVal.Int() != 360)
+	    {
+	    iEngine->Utils().LogIt(_L("\nCache-Control OTA comparison  failed -> [300]"));
+	    User::Leave(KErrCorrupt);
+	    }
+	THTTPHdrVal hVal2;
+	User::LeaveIfError(hdr.GetField(cacheControl,2,hVal2));
+    if(hVal2.StrF().DesC().Compare(_L8("must-revalidate")) != 0)
+        {
+        iEngine->Utils().LogIt(_L("\nmust-revalidate OTA comparison  failed -> [private, max-age=300, must-revalidate]"));
+        User::Leave(KErrCorrupt);
+        }
+	
+	TPtrC8 rawHeader;
+	hdr.GetRawField(cacheControl, rawHeader);
+	if(rawHeader.CompareF(KCacheControlOTAVal) != 0)
+	    {
+	    iEngine->Utils().LogIt(_L("\nmust-revalidate OTA comparison  failed -> [300]"));
+	    User::Leave(KErrCorrupt);
+	    }
+	
+	ReleaseHeaders();
+	
+	iEngine->Utils().LogIt ( _L ("\nTestDecodeEncodeCacheControlL test success."));
+	}
+
 void CHttpHdrCodecTest::TestEncodeAcceptL()
 	{
 	// the result we expect and that we will validate
--- a/applayerprotocols/httptransportfw/Test/T_HttpOffline/t_hdrcodec.h	Thu May 27 13:21:53 2010 +0300
+++ b/applayerprotocols/httptransportfw/Test/T_HttpOffline/t_hdrcodec.h	Fri Jun 11 14:06:05 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2003-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of "Eclipse Public License v1.0"
@@ -79,6 +79,7 @@
 	void ResetTimeElapsed();
 	void DisplayTimeElapsed();
 	//
+	void TestDecodeEncodeCacheControlL();
 	void TestEncodeAcceptL();
 	void TestEncodeAcceptCharsetL();
 	void TestEncodeAuthorizationL();
--- a/applayerprotocols/httptransportfw/Test/TestScriptTest/CPipeliningTestEngine.cpp	Thu May 27 13:21:53 2010 +0300
+++ b/applayerprotocols/httptransportfw/Test/TestScriptTest/CPipeliningTestEngine.cpp	Fri Jun 11 14:06:05 2010 +0300
@@ -538,7 +538,7 @@
 	iTestUtils->StartTestL( aTestCase.TestCaseName() );
 	__TESTNAME(aTestCase.TestCaseName());
 	
-	CPipeliningTestClient* testClient;
+	CPipeliningTestClient* testClient = NULL;
 	if(aSecName.FindF(_L("TSWDEFECT")) ==0)
 	    {
 	    RDebug::Print(_L("TSWDEFECT"));
@@ -546,6 +546,7 @@
 	    if(aTestCase.TestCaseName().CompareF(KTestCaseLocalAndRemoteHost) == 0)
 	        {
 	        testClient = CTestCaseLocalAndRemoteHost::NewL(*iTestUtils, *this);
+	        CleanupStack::PushL(testClient);
 	        }
 	    else
 	        {
@@ -554,10 +555,10 @@
 	    }
 	else
 	    {
-	    testClient = CPipeliningTestClient::NewL(*iTestUtils, *this);    
+	    testClient = CPipeliningTestClient::NewL(*iTestUtils, *this);   
+	    CleanupStack::PushL(testClient);
 	    }	
-	CleanupStack::PushL(testClient);
-	
+		
 	testClient->SetTestCase(&aTestCase);
 	iTestServer->SetTestCase(&aTestCase);
 	testClient->StartClientL();
--- a/applayerprotocols/httptransportfw/Test/testfilter/testhttpfilter.cpp	Thu May 27 13:21:53 2010 +0300
+++ b/applayerprotocols/httptransportfw/Test/testfilter/testhttpfilter.cpp	Fri Jun 11 14:06:05 2010 +0300
@@ -18,17 +18,15 @@
 #include <http/rhttpresponse.h>
 #include <httperr.h>
 #include <httpstringconstants.h>
-#include <imcvcodc.h>      //for base64 en/decoding
 #include <bautils.h>
 #include <e32math.h>
 #include <hash.h>
 #include <e32const.h>
-#include <tconvbase64.h>
+#include <tconvbase64.h>  //for base64 en/decoding
 #include "testhttpfilter.h"
 _LIT8( KTESTHTTPFilterName, "TestHttp");
 _LIT8( KAuthenticationInfoStr, "Authentication-Info" );
 _LIT8( KUserAgentProductToken,"3gpp-gba");
-_LIT8( KColon, ":" );
 const TInt KB64KeySize = 64;
 _LIT(KTestHttpFilter, "TEST HTTP FILTER ");
 
@@ -243,7 +241,6 @@
 	
 	   TInt headerPart=0;    	
 	   THTTPHdrVal headerVal;
-       TInt cred = KErrNotFound;
        RStringF wwwAuthHeader = iStringPool.StringF(HTTP::EWWWAuthenticate,RHTTPSession::GetTable());
 	   RHTTPHeaders headers(aTrans.Response().GetHeaderCollection());
 
@@ -320,8 +317,6 @@
 	if(!found)
 	    hdr.SetFieldL(fieldname, iUserAgent);
 	
-    TInt cred = KErrNotFound;
-    
     if( iHaveCredentials )
         {
         TBuf8<KB64KeySize> keyBase64(_L8("Aladdin")); 
--- a/applayerprotocols/httptransportfw/core/CHeaderField.cpp	Thu May 27 13:21:53 2010 +0300
+++ b/applayerprotocols/httptransportfw/core/CHeaderField.cpp	Fri Jun 11 14:06:05 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2003-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of "Eclipse Public License v1.0"
@@ -118,7 +118,9 @@
 	if ((aIndex < NumPartsL()) && (aIndex >= 0))
 		return iParts[aIndex];
 	else
-		return NULL;
+		User::Leave(KErrNotFound);
+	
+	return NULL;
 	}
 
 EXPORT_C
--- a/applayerprotocols/httptransportfw/core/CTransaction.cpp	Thu May 27 13:21:53 2010 +0300
+++ b/applayerprotocols/httptransportfw/core/CTransaction.cpp	Fri Jun 11 14:06:05 2010 +0300
@@ -38,10 +38,13 @@
 	{
 	// Delete all current events.
 	iEventQueue.Reset();
-	// Cancel the active object
-	Cancel();
-	// And send the cancel event
-	SynchronousSendEvent(THTTPEvent::ECancel, THTTPEvent::EOutgoing, aStart);
+	if(iStatus != ECancelled)
+		{
+		// Cancel the active object
+		Cancel();
+		// And send the cancel event
+		SynchronousSendEvent(THTTPEvent::ECancel, THTTPEvent::EOutgoing, aStart);
+		}
 	if (iStatus != EInFilter && iStatus != ECancelled)
 		iStatus = EPassive;
 	else
@@ -58,6 +61,7 @@
 		{
 		CHeaderFieldPart::ClosePropertySet(iPropertySet);
 		delete iRequest;
+		iRequest = NULL;
 		delete this;
 		return;
 		}
@@ -81,7 +85,9 @@
 	iSession.RemoveTransaction(this);
 	CHeaderFieldPart::ClosePropertySet(iPropertySet);
 	delete iRequest;
+	iRequest = NULL;
 	delete iResponse;
+	iResponse = NULL;
 
 	// Cancel the active object
 	Cancel();
--- a/applayerprotocols/httptransportfw/core/chttpformencoder.cpp	Thu May 27 13:21:53 2010 +0300
+++ b/applayerprotocols/httptransportfw/core/chttpformencoder.cpp	Fri Jun 11 14:06:05 2010 +0300
@@ -70,8 +70,8 @@
 	
 TInt CHTTPFormEncoder::Reset()
 	{
-	// Not implemented here
-	return KErrNotSupported;
+    iState = EAllowAppendData;
+	return KErrNone;
 	}
 
 EXPORT_C void CHTTPFormEncoder::AddFieldL(const TDesC8& aFieldName, const TDesC8& aFieldValue)
--- a/applayerprotocols/httptransportfw/group/httpcore.iby	Thu May 27 13:21:53 2010 +0300
+++ b/applayerprotocols/httptransportfw/group/httpcore.iby	Fri Jun 11 14:06:05 2010 +0300
@@ -20,7 +20,6 @@
 #include <InetProtUtil.iby>
 #endif
 
-#include <GtEmailMtm.iby>
 #include <httpservice.iby>
 
 // HTTP Core