void CTestFilter::DoSubmitL( RHTTPTransaction aTransaction )
{
	RHTTPHeaders hdr = aTransaction.Request().GetHeaderCollection();
	
	RStringF fieldname = aTransaction.Session().StringPool().StringF(HTTP::EUserAgent,RHTTPSession::GetTable());
	
	TBool found = EFalse;
	TPtrC8 rawFieldData;
	
	hdr.GetRawField(fieldname, rawFieldData);
	
	found = rawFieldData.Find(iUserAgent.DesC()) != KErrNotFound;
	
	if(!found)
	    hdr.SetFieldL(fieldname, iUserAgent);
	
    if( iHaveCredentials )
        {
        TBuf8<KB64KeySize> keyBase64(_L8("Aladdin")); 
        TBuf8<KB64KeySize> keyBase64Username(_L8("open sesame"));;
        RString username = iStringPool.OpenStringL( keyBase64 );
        CleanupClosePushL<RString>( username );
        RString password = iStringPool.OpenStringL( keyBase64Username );
        CleanupClosePushL<RString>( password );
		EncodeBasicAuthL(username, password, aTransaction);
        CleanupStack::PopAndDestroy(&password);
        CleanupStack::PopAndDestroy(&username);
        	
        }
}
void CHttpClientFilter::MHFRunL(RHTTPTransaction aTransaction, const THTTPEvent& aEvent)
	{
	switch( aEvent.iStatus )
		{
	case THTTPEvent::ESubmit:
		{
		AlterRequestHeadersL(aTransaction);
		} break;
	case THTTPEvent::EGotResponseHeaders:
		{
		AlterResponseHeadersL(aTransaction);
		} break;
	case KErrHttpNonPipeliningError:
	case KErrHttpPipeliningError:
		{
		// This transaction was being pipelined when an error occurred. Need to
		// cancel and then re-submit.
		aTransaction.Cancel();
		aTransaction.SubmitL();	
		}
		break;
	default:
		break;
		}
	}
// ------------------------------------------------------------------------------------------------
// CHttpFilterConnHandler::MHFRunL
// Process a transaction event.
// ------------------------------------------------------------------------------------------------
//
void CHttpFilterConnHandler::MHFRunL(RHTTPTransaction aTransaction,
                                     const THTTPEvent& aEvent)
{
    TInt state = 0;
    TInt gprsState = 0;
    TInt wcdmaState = 0;
    TApBearerType bearerType;

    if (aEvent.iStatus == THTTPEvent::ESubmit)
    {
        THTTPHdrVal isNewConn;
        RHTTPConnectionInfo	connInfo = iSession->ConnectionInfo();
        RStringPool strPool = aTransaction.Session().StringPool();
        TBool ret = connInfo.Property (strPool.StringF(HttpFilterCommonStringsExt::EHttpNewConnFlag,
                                       HttpFilterCommonStringsExt::GetTable()), isNewConn);

        if ( LocalHostCheckL(aTransaction) && !( ret && isNewConn.Type() == THTTPHdrVal::KTIntVal ) )
            {
            return;
            }

        THTTPHdrVal callback;
        RHTTPTransactionPropertySet propSet = aTransaction.PropertySet();
        RStringF callbackStr = strPool.StringF( HttpFilterCommonStringsExt::EConnectionCallback, 
            HttpFilterCommonStringsExt::GetTable() );

        MConnectionCallback* callbackPtr = NULL;
    
        // this is a transaction, already forwarded to download manager
        if( propSet.Property( callbackStr, callback ) )
        {
            callbackPtr = REINTERPRET_CAST( MConnectionCallback*, callback.Int() );
        }        
void CTestCase2::AddConnectionCloseHeaderL(RHTTPTransaction aTransaction)
	{
	RStringF name = aTransaction.Session().StringPool().StringF(HTTP::EConnection, RHTTPSession::GetTable());
	THTTPHdrVal value = aTransaction.Session().StringPool().StringF(HTTP::EClose, RHTTPSession::GetTable());

	aTransaction.Request().GetHeaderCollection().SetFieldL(name, value);
	}
void CINC052596::ProcessHeadersL(RHTTPTransaction aTrans)
	{
	RStringF haaderName = aTrans.Session().StringPool().StringF(HTTP::EWWWAuthenticate, aTrans.Session().GetTable());
	THTTPHdrVal headerVal;
	RHTTPHeaders headers = aTrans.Response().GetHeaderCollection();
	User::LeaveIfError(headers.GetField(haaderName, 0, headerVal));
	}
void CTextModeTestMultiTrans::MHFRunL(RHTTPTransaction aTransaction,
                                      const THTTPEvent& aEvent)
{
    switch (aEvent.iStatus)
    {
    case THTTPEvent::EGotResponseHeaders:
    {
        // HTTP response headers have been received
        iEngine->Utils().LogIt(_L("<Got response headers>"));
    }
    break;
    case THTTPEvent::ESubmit:
    {
    } break;
    case THTTPEvent::EGotResponseBodyData:
    {
        // Some (more) body data has been received (in the HTTP response)
        iEngine->Utils().LogIt(_L("<Got a chunk of data>"));
        ValidateBodyL(aTransaction);
    }
    break;
    case THTTPEvent::EResponseComplete:
    {
        // The transaction's response is complete
        iEngine->Utils().LogIt(_L("<Transaction Complete>"));
    }
    break;
    case THTTPEvent::ESucceeded:
    {
        iEngine->Utils().LogIt(_L("<Transaction validated successfully>"));
        aTransaction.Close();
        if (--iOpenTransactionCount == 0)
            CActiveScheduler::Stop();
    }
    break;
    case THTTPEvent::EFailed:
    {
        iEngine->Utils().LogIt(_L("<Transaction NOT validated successfully>"));
        aTransaction.Close();
        if (--iOpenTransactionCount == 0)
        {
            CActiveScheduler::Stop();
        }
        iFailureError = KErrTestFailed;
    }
    break;
    default:
    {
        iEngine->Utils().LogIt(_L("<unrecognised event> %d"),aEvent.iStatus);
        if (aEvent.iStatus < 0)
        {
            iFailureError = aEvent.iStatus;
            CActiveScheduler::Stop();
        }
    }
    break;
    }
}
Exemple #7
0
void CHttpTestCase9::MHFRunL(RHTTPTransaction aTransaction,
							 const THTTPEvent& aEvent)
	{
	switch (aEvent.iStatus)
		{
	case THTTPEvent::EGotResponseHeaders:
		{
		// HTTP response headers have been received
		iEngine->Utils().LogIt(_L("<EGotResponseHeaders>\n"));
		TInt  statusCode = aTransaction.Response().StatusCode();
		iEngine->Utils().LogIt(_L("Status Code: %d \n"),statusCode);
		DumpRespHeaders(aTransaction);
		iEngine->SetCurrentStatusCode(statusCode);
		} break;
	case THTTPEvent::EGotResponseBodyData:
		{
		// Some (more) body data has been received (in the HTTP response)
		iEngine->Utils().LogIt(_L("<EGotResponseBodyData received>\n"));
		// for each chunk of data received we have to empty the buffer before
		// to be able to receive 
		MHTTPDataSupplier* body = aTransaction.Response().Body();
		body->ReleaseData();
		} break;
	case THTTPEvent::EResponseComplete:
		{
		// The transaction's response is complete
		iEngine->Utils().LogIt(_L("<EResponseComplete received >\n"));
		} break;
	case THTTPEvent::ESucceeded:
		{
		iEngine->Utils().LogIt(_L("<ESucceeded received>\n"));
		iTestFail=1;
		iEngine->Utils().LogIt(_L("<The Test will fail :ESucceeded received instead ofEFailed>\n"));
		CActiveScheduler::Stop();
		} break;
	case THTTPEvent::EFailed:
		{
		iEngine->Utils().LogIt(_L("<EFailed received>\n"));
		iEngine->Utils().LogIt(_L("<Test passed>\n"));		
		CActiveScheduler::Stop();
		} break;
	default:
		{
		iEngine->Utils().LogIt(_L("<unrecognised event>\n %d"),aEvent.iStatus);
		if (aEvent.iStatus < THTTPEvent::ERedirectedPermanently)
			{
			iTestFail=1;
			iEngine->Utils().LogIt(_L("Test Failed: The event received was not expected and it's not just a warning\n"));
			iEngine->PressAnyKey();
			CActiveScheduler::Stop();
			}
		} 
		break;
		}
	}
Exemple #8
0
void CHttpTestCase8::DoRunL()
	{
	// Literals used in the function
	_LIT8(KWapTestUrl,			"http://WapTestIP/perl/protected/dumpform.pl");

	// Replace the host name in the URL
	HBufC8* newUrl8 = TSrvAddrVal::ReplaceHostNameL(KWapTestUrl(), iIniSettingsFile);
	CleanupStack::PushL(newUrl8);
	TPtr8 newUrlPtr8 = newUrl8->Des();

	TUriParser8 testURI;
	testURI.Parse(newUrlPtr8);

	//open a Session
	RHTTPSession mySession;
	mySession.OpenL();
	CleanupClosePushL(mySession);
	iEngine->Utils().LogIt(_L("Session Created(TC8)"));
	iEngine->Utils().LogIt(_L("Session parameters: Default"));
	// Install the authorisation plugin.
	InstallAuthenticationL(mySession);
	//Get the mySession'string pool handle;
	iMyStrP = mySession.StringPool();
	//Create , open and push in the CS a Transaction in mySession 
	RHTTPTransaction myTransaction;
	myTransaction = mySession.OpenTransactionL(testURI, *this, mySession.StringPool().StringF(HTTP::EPOST,RHTTPSession::GetTable()));
	CleanupClosePushL(myTransaction);
	iEngine->Utils().LogIt(_L("Transaction Created in mySession"));	
	//Get a handle of the request in myTransaction
	RHTTPRequest myRequest = myTransaction.Request();
	RHTTPHeaders myHeaders = myRequest.GetHeaderCollection();
	//  provide  some headers 
	THTTPHdrVal v2(iMyStrP.OpenFStringL(_L8("text/plain")));
	THTTPHdrVal v3(iMyStrP.OpenFStringL(_L8("text/html")));
	THTTPHdrVal v4(6);
	myHeaders.SetFieldL(iMyStrP.OpenFStringL(_L8("Accept")),v2 );
	myHeaders.SetFieldL(iMyStrP.OpenFStringL(_L8("Content-Type")), v3);
	myHeaders.SetFieldL(iMyStrP.StringF(HTTP::EContentLength, RHTTPSession::GetTable()),v4);
	iEngine->Utils().LogIt(_L("Testing Authentication. Method:Post"));
	myRequest.SetBody(*this);
	myTransaction.SubmitL();
	CActiveScheduler::Start();
	myTransaction.Close();
	iEngine->Utils().LogIt(_L("Transaction terminated\n"));
	mySession.Close();
	iEngine->Utils().LogIt(_L("Session terminated"));
	if (iTestFail==1)
		{
		User::Leave(-1);
		}
	CleanupStack::Pop(2); // mySession,myTansaction
	CleanupStack::PopAndDestroy(newUrl8);
	}
void CTextModeTestMultiTransMalformedStatusLine::CreateSingleTransactionL(RStringF aGet)
	{
	// create the transaction and submit
	TUriParser8 urlParser;
	urlParser.Parse(*iHostName);
	RHTTPTransaction tr = iSession.OpenTransactionL(urlParser, *this, aGet);
	CleanupClosePushL(tr);
	User::LeaveIfError(iTransArray.Append(tr));
	CleanupStack::Pop(&tr);
	tr.SubmitL();
	iOpenTransactionCount++;
	}
// -----------------------------------------------------------------------------
// LocalHostCheckL
// If the host is a local host, then remove the proxy property. Returns ETrue
// if the transaction request URI was for a localhost.
// -----------------------------------------------------------------------------
//
TBool LocalHostCheckL(RHTTPTransaction& aTransaction, RStringPool& aStringPool)
    {
    _LIT8(KLoopbackIPv4Url, "http://127.0.0.1"); 
    
    RHTTPRequest request = aTransaction.Request();
    TUriC8 uri = request.URI();

    TUriParser8 parserLoopBack;
    parserLoopBack.Parse(KLoopbackIPv4Url());
    TInt match = parserLoopBack.Compare(uri, EUriHost);

    if (KErrNone != match)
        {
        _LIT8(KLocalHostUrl, "http://localhost"); 

        // try another compare - compare against the "localhost".
        TUriParser8 parserLocalHost;
        parserLocalHost.Parse(KLocalHostUrl());
        match = parserLocalHost.Compare(uri, EUriHost);

        if (KErrNone == match) 
            {
            _LIT8(KLoopbackIPv4, "127.0.0.1"); 

            // "localhost" resolves to "::1", manually, replace with "127.0.0.1"
            CUri8* newUri = CUri8::NewLC(uri);
            newUri->SetComponentL(KLoopbackIPv4(), EUriHost);
            request.SetURIL(newUri->Uri());
            CleanupStack::PopAndDestroy(newUri);
            }
        }
              
    if (KErrNone == match)
        {
        // request is for localhost, explicitly state that this transaction
        // must not be sent to proxy.
    	RStringF proxyUsageStrF = aStringPool.StringF(HTTP::EProxyUsage, 
                                                      RHTTPSession::GetTable());
        
    	RStringF dontUseProxyStrF = aStringPool.StringF(HTTP::EDoNotUseProxy, 
                                                        RHTTPSession::GetTable());	

        aTransaction.PropertySet().RemoveProperty(proxyUsageStrF);
        aTransaction.PropertySet().SetPropertyL(proxyUsageStrF, dontUseProxyStrF);

    	//RStringF proxyAddrStrF = aStringPool.StringF(HTTP::EProxyAddress, 
        //                                             RHTTPSession::GetTable());

        //aTransaction.PropertySet().RemoveProperty(proxyAddrStrF);
        return ETrue;                                                          
        }
    return EFalse;
    }
void CRecvBufSizeTest1::MHFRunL(RHTTPTransaction aTransaction, const THTTPEvent& aEvent)
	{
	switch (aEvent.iStatus)
		{
		case THTTPEvent::EGotResponseHeaders:
			{
			iEngine->Utils().LogIt(_L("<Got response headers>"));
			} break;
		case THTTPEvent::EGotResponseBodyData:
			{
			iEngine->Utils().LogIt(_L("<Got a chunk of data>"));

			MHTTPDataSupplier* iRespBody = aTransaction.Response().Body();

			TPtrC8 bodyData;
			TBool lastChunk = iRespBody->GetNextDataPart( bodyData );

			iRespBody->ReleaseData();
			} break;
		case THTTPEvent::EResponseComplete:
			{
			iEngine->Utils().LogIt(_L("<Transaction Complete>"));
			} break;
		case THTTPEvent::ESucceeded:
			{
			iEngine->Utils().LogIt(_L("<Transaction succeeded>"));
			aTransaction.Close();
			CActiveScheduler::Stop();
			}
			break;
		case THTTPEvent::EFailed:
			{
			iEngine->Utils().LogIt(_L("<Transaction failed>"));
			aTransaction.Close();
			CActiveScheduler::Stop();
			} break;
		default:
			{
			_LIT(KLogDescription, "<unrecognised event> %d");
			iEngine->Utils().LogIt(KLogDescription,aEvent.iStatus);
			if (aEvent.iStatus < 0)
				{
				iFailureError = aEvent.iStatus;
				CActiveScheduler::Stop();
				}
			} 
			break;
		}
	
	return;
	
	}
void CHttpEventHandler::ParseCookieL(RHTTPTransaction& aTrans)
{
	RHTTPResponse response = aTrans.Response();
	RHTTPResponse resp = aTrans.Response();
	RStringPool pool = aTrans.Session().StringPool();
    RHTTPHeaders headers = resp.GetHeaderCollection();
    
	RStringF fieldName = pool.StringF(HTTP::ESetCookie,RHTTPSession::GetTable());
	
	_LIT(KSeparator,";");
	_LIT(KPathName,";path=");
	_LIT(KEqual,"=");
	
	THTTPHdrVal val;
	if (headers.GetField(fieldName, 0, val) != KErrNotFound)
	{
		RStringF cookieValueName = pool.StringF(HTTP::ECookieValue,RHTTPSession::GetTable());
		RStringF cookieNameName = pool.StringF(HTTP::ECookieName,RHTTPSession::GetTable());
		RStringF cookiePathName = pool.StringF(HTTP::EPath,RHTTPSession::GetTable());
	
		if (val.StrF() == pool.StringF(HTTP::ECookie, RHTTPSession::GetTable()))
		{
			THTTPHdrVal cookieValue;
			THTTPHdrVal cookieName;
			THTTPHdrVal cookiePath;
			
			TInt parts = headers.FieldPartsL(fieldName);
	
			Mem::Fill((void*)iCookies.Ptr(), 1024, 0);
			
			// Get all the cookies.
			for (TInt i = 0; i < parts; i++)
			{
				headers.GetParam(fieldName, cookieValueName, cookieValue, i);
				headers.GetParam(fieldName, cookieNameName, cookieName, i);
				headers.GetParam(fieldName, cookiePathName, cookiePath, i);
				
				if ( GetHdrVal( cookieName, pool) )
					iCookies.Append(KEqual);
					
				if ( GetHdrVal( cookieValue, pool) )
				{	
					iCookies.Append(KPathName);
					GetHdrVal( cookiePath, pool);
					iCookies.Append(KSeparator);
				}
			}
		}
	}
}
//------------------------------------------------------------------------
// CTestFilter::MHFRunL
// See MHTTPFilterBase::MHFRunL 
//------------------------------------------------------------------------
//
void CTestFilter::MHFRunL(RHTTPTransaction aTransaction, const THTTPEvent& aEvent)
{
	if (aEvent.iUID != KHTTPUid) 
		return;

	switch(aEvent.iStatus)
	{
		case THTTPEvent::ESubmit:
		{
			DoSubmitL(aTransaction);
		}
		break;

		case THTTPEvent::EGotResponseHeaders:
		{
			// Get HTTP status code from header (e.g. 200)
			RHTTPResponse resp = aTransaction.Response();
			CheckHeadersL( aTransaction );
		}
		break;
		default: 
		{
		}
		break;
	}
	
}
void CHttpClientFilter::EnsureContentLengthL(RHTTPTransaction aTransaction)
	{
	RHTTPRequest request = aTransaction.Request();

	if( request.HasBody() )
		{
		THTTPHdrVal hdrVal;
		RStringF teName = iStringPool.StringF(HTTP::ETransferEncoding, iStringTable);

		// Get rid of Content-Length header if present
		// NOTE - cannot use a local variable for the Content-Length as causes a 
		// compiler bug in thumb builds - grand! : (
		RHTTPHeaders headers = request.GetHeaderCollection();
		headers.RemoveField(iStringPool.StringF(HTTP::EContentLength, iStringTable)); 
		
		TInt bodySize = request.Body()->OverallDataSize();
		if( bodySize != KErrNotFound )
			{
			// Size is known - set the ContentLength header.
			headers.SetFieldL(iStringPool.StringF(HTTP::EContentLength, iStringTable), THTTPHdrVal(bodySize));
			}
		else if( headers.GetField(teName, 0, hdrVal) == KErrNotFound )
			{
			// Size is unknown and there's been no Encoding indicated by the 
			// client - set the 'TransferEncoding: chunked'
			hdrVal.SetStrF(iStringPool.StringF(HTTP::EChunked, iStringTable));
			headers.SetFieldL(teName, hdrVal);
			}
		}
	}
Exemple #15
0
// methods derived from MHTTPDataSuplier
void CHttpTestCase2::MHFRunL(RHTTPTransaction aTransaction,
							 const THTTPEvent& aEvent)
	{
	switch (aEvent.iStatus)
			{
	case THTTPEvent::EGotResponseHeaders:
		{
		iEngine->Utils().LogIt(_L("<EGotResponseHeaders received>\n"));
		DumpRespHeaders(aTransaction);
		iEngine->SetCurrentStatusCode(aTransaction.Response().StatusCode());
		} break;
	case THTTPEvent::EGotResponseBodyData:
		{
		// Some (more) body data has been received (in the HTTP response)
		iEngine->Utils().LogIt(_L("<EGotResponseBodyData received>\n"));
		DumpResponseBody(aTransaction);
		} break;
	case THTTPEvent::EResponseComplete:
		{
		// The transaction's response is complete
		iEngine->Utils().LogIt(_L("<EResponseComplete received>\n"));
		} break;
	default:
		{
		iTestFail=1;
		iEngine->Utils().LogIt(_L("<unrecognised event>\n %d"),aEvent.iStatus);
		iEngine->PressAnyKey();
		CActiveScheduler::Stop();
		} 
		break;
		}
	}
void CHttpClientFilter::EnsureNoEndToEndHeadersInConnectionHeaderL(RHTTPTransaction aTransaction)
	{
	RHTTPHeaders headers = aTransaction.Request().GetHeaderCollection();
	RStringF connection = iStringPool.StringF(HTTP::EConnection,iStringTable);
	const TInt numConnectionHeaderParts = headers.FieldPartsL(connection);

	for( TInt ii = numConnectionHeaderParts - 1; ii >= 0; --ii ) 
		{
		// Examine connection-tokens from back to front so index is always valid. 
		// Check for an end to end header and remove it as a connection header
		// must not contain end to end headers.
		THTTPHdrVal value;
		TInt ret = headers.GetField(connection, ii, value);

		if( ( ret != KErrNotFound ) && ( value.Type() == THTTPHdrVal::KStrFVal ) )
			{
			RStringF valueStrF = value.StrF();
			if( valueStrF.Index(iStringTable) != HTTP::EClose  && 
				!IsHopByHopHeader(valueStrF) )
				{
				// The connection-token is not 'close' nor is it a end-to-end
				// header field name - remove it.
				User::LeaveIfError(headers.RemoveFieldPart(connection, ii)); 
				}
			}
		else
			{
			// The connection-token is not a hop-by-hop header field name -
			// remove it.
			User::LeaveIfError(headers.RemoveFieldPart(connection, ii));
			}			
		}
	}
TInt CTextModeTestPostBodyChunks::MHFRunError(TInt aError, RHTTPTransaction aTransaction, const THTTPEvent& aEvent)
	{
	iEngine->Utils().LogIt(
		_L("\nMHFRunL left: error code %d on transaction ID=%d for event %d\n"),
		aError, aTransaction.Id(), aEvent.iStatus);
	return KErrNone;
	}
EXPORT_C void CExampleCookieManager::GetCookiesL(RHTTPTransaction aTransaction, 
												 RArray<CCookie*>& aCookieList,
												 TBool& aCookie2Reqd)
	{
	// For comparing cookies to insert them in the correct order to the returned array
	TLinearOrder<CCookie*> compareFunc(CompareCookiePaths);

	// Ensure the array is empty
	__ASSERT_DEBUG(aCookieList.Count()==0, HTTPCookiePanic::Panic(HTTPCookiePanic::EGetCookiesArrayNotEmpty));

	const TInt numCookies = iCookies.Count();
	for (TInt ii=0; ii<numCookies; ++ii)
		{
		CCookie* cookie = iCookies[ii];
		const TUriC8& uri = aTransaction.Request().URI();

		if(CheckDomainMatch(*cookie, uri) &&
		   CheckPathMatch(*cookie, uri) &&
		   CheckPortMatch(*cookie, uri) &&
		   CheckSecureMatch(*cookie, uri))
			{
			User::LeaveIfError(aCookieList.InsertInOrderAllowRepeats(cookie, compareFunc));

			if(!cookie->FromCookie2())
				aCookie2Reqd = ETrue;
			}
		}
	}
void CHeaderDecode::ProcessHeadersL(RHTTPTransaction aTrans)
	{
	RStringPool stringPool = aTrans.Session().StringPool();
	RHTTPHeaders headers = aTrans.Response().GetHeaderCollection();
	THTTPHdrVal hdrVal;

	//Check Content-Length header parameter is stored correctly
	RStringF contentLengthStr = stringPool.StringF(HTTP::EContentLength, aTrans.Session().GetTable());
	User::LeaveIfError(headers.GetField(contentLengthStr,0,hdrVal));

	if(headers.FieldPartsL(contentLengthStr) != 1)
		User::Leave(KErrArgument);

	if (hdrVal.Int() != 6)
		User::Leave(KErrArgument);
	}
TInt CINC097492_3::MHFRunError(TInt aError, RHTTPTransaction aTransaction, const THTTPEvent& /*aEvent*/)
	{
	_LIT(KLogDescription, "\nTest failed with error code %d on transaction ID=%d\n");
	iEngine->Utils().LogIt(KLogDescription, aError, aTransaction.Id());
	iFailureError = aError;
	CActiveScheduler::Stop();
	return KErrNone;
	}
void CHttpController::CheckStatusCodeL( RHTTPTransaction& aTransaction )
	{
	TInt httpStatus( aTransaction.Response().StatusCode() );
	if ( httpStatus / 100 != 2 )//responce 200 - 299, no redirections allowed
		{
		User::Leave( KHttpErrorBase - httpStatus );
		}
	}
// ------------------------------------------------------------------------------------------------
// CHttpFilterProxy::MHFRunL
// Process a transaction event.
// ------------------------------------------------------------------------------------------------
//
void CHttpFilterProxy::MHFRunL(RHTTPTransaction aTransaction,
                               const THTTPEvent& aEvent)
    {
    switch(aEvent.iStatus)
	    {
		case THTTPEvent::ESubmit:
		    {
            if (LocalHostCheckL(aTransaction, iStringPool))
                {
                return;
                }
			SetProxyL(aTransaction);
		    } 
            break;

		case KErrNotReady:
		    {
            if (LocalHostCheckL(aTransaction, iStringPool))
                {
                return;
                }
			if(iFilterOwnsConnection)
			    {
				// we must re-start the RConnection
		 		TInt err = iConnection.Start();
				if (err == KErrAlreadyExists)
				    {
					// the KErrNotReady must have come from elsewhere
					return;
				    }

				User::LeaveIfError(err);

				// re-submit the transaction
				aTransaction.Cancel();
				aTransaction.SubmitL();				
			    }
			break;
		    }

		default:
			break;
	    }

    }
EXPORT_C void CHttpTestTransBase::MHFRunL(RHTTPTransaction aTransaction,
						 const THTTPEvent& aEvent)
	{
	switch (aEvent.iStatus)
		{
	case THTTPEvent::EGotResponseHeaders:
		{
		// HTTP response headers have been received
		iEngine->Utils().LogIt(_L("<EGotResponseHeaders>\n"));
		DumpRespHeaders(aTransaction);
		iEngine->SetCurrentStatusCode(aTransaction.Response().StatusCode());
		} break;
	case THTTPEvent::EGotResponseBodyData:
		{
		// Some (more) body data has been received (in the HTTP response)
		iEngine->Utils().LogIt(_L("<EGotResponseBodyData received>\n"));
		// for each chunk of data received we have to empty the buffer before to be able to receive 
		MHTTPDataSupplier* body = aTransaction.Response().Body();
		body->ReleaseData();
		} break;
	case THTTPEvent::EResponseComplete:
		{
		// The transaction's response is complete
		iEngine->Utils().LogIt(_L("<EResponseComplete received >\n"));
		} break;
	case THTTPEvent::ESucceeded:
		{
		iEngine->Utils().LogIt(_L("<ESucceeded received from the VF>\n"));
		CActiveScheduler::Stop();
		} break;
	case THTTPEvent::EFailed:
		{
		iEngine->Utils().LogIt(_L("<EFailed received from the VF>\n"));
		CActiveScheduler::Stop();
		} break;
	default:
		{
		iEngine->Utils().LogIt(_L("<unrecognised event>\n %d"),aEvent.iStatus);
		iEngine->Utils().LogIt(_L("Test Failed\n"));
		iEngine->PressAnyKey();
		CActiveScheduler::Stop();
		} 
		break;
		}
	}
void CHttpEventHandler::DumpRespBody(RHTTPTransaction& aTrans)
	{
	MHTTPDataSupplier* body = aTrans.Response().Body();
	TPtrC8 dataChunk;
	TBool isLast = body->GetNextDataPart(dataChunk);
	DumpIt(dataChunk);
	if (isLast)
		iTest->Console()->Printf(_L("Got last data chunk.\n"));
	}
//------------------------------------------------------------------------
// CTestFilter::MHFRunError
// See MHTTPFilterBase::MHFRunError
//------------------------------------------------------------------------
//
TInt CTestFilter::MHFRunError(TInt /*aError*/, RHTTPTransaction aTransaction, const THTTPEvent& )
{
 	TInt error = 0;
	// map aError to global error message
	// pass the errorcode forward
	THTTPEvent httpEvent(error);
	TRAP_IGNORE(aTransaction.SendEventL(httpEvent, THTTPEvent::EIncoming, THTTPFilterHandle::ECurrentFilter ));
	return KErrNone;
}
// -----------------------------------------------------------------------------
// CHttpCacheManager::ReceivedResponseHeadersL
//
// -----------------------------------------------------------------------------
//
EXPORT_C void CHttpCacheManager::ReceivedResponseHeadersL(
  RHTTPTransaction& aTrans,
    THttpCacheEntry& aCacheEntry )
    {
    if ( iCacheEnabled || iVSSCacheEnabled )
        {
        if ( iVSSCacheEnabled &&
             VSSRequestCheckL( aTrans, aTrans.Response().GetHeaderCollection(),
                               aTrans.Request().URI().UriDes() ) )
            {
            //Modify the cache handler if VSS specific
            aCacheEntry.iCacheHandler = iphoneSpecificCache;
            }
        if ( aCacheEntry.iCacheHandler )
            {
            aCacheEntry.iCacheHandler->ReceivedResponseHeadersL( aTrans, aCacheEntry );
            }
        }
    }
// -----------------------------------------------------------------------------
// CHttpFilterProxy::MHFRunError
// Process an error that occured while processing the transaction.
// -----------------------------------------------------------------------------
//
TInt CHttpFilterProxy::MHFRunError(TInt /*aError*/,
                                   RHTTPTransaction aTransaction,
                                   const THTTPEvent& /*aEvent*/)
{
    // Cleanup strings.
    iProxyAddress.Close();
    iExceptions.Close();
    aTransaction.Fail();
    return KErrNone;
}
void CHttpClientFilter::AlterRequestHeadersL(RHTTPTransaction aTransaction)
	{
	AddSessionHeadersL(aTransaction.Request().GetHeaderCollection(), iSession.RequestSessionHeadersL());

	EnsurePathExistsL(aTransaction);
	EnsureContentLengthL(aTransaction);
	EnsureNoEndToEndHeadersInConnectionHeaderL(aTransaction);
//removed the following Expect100 line to fix INC45389 & INC42505 - please do not add back in without checking these defects
//	AddExpect100ContinueL(aTransaction);
	}
void CTextModeTestMultiTrans::ValidateBodyL(RHTTPTransaction aTransaction)
{
    // In this test, the test URLs point to resources that contain just characters from the test number
    // i.e. http:/xxx/1.txt will contain only the char 1, CR or LF.
    // These numbers should also align with the transaction ID, since they were created in order
    RHTTPResponse resp = aTransaction.Response();
    MHTTPDataSupplier* body = resp.Body();
    TPtrC8 data;
    body->GetNextDataPart(data);
    TChar reqdCh = (TChar)(aTransaction.Id() + 48);
    for (TInt ii = 0; ii < data.Length(); ii++)
    {
        TChar ch = data[ii];
        if ((ch != reqdCh) && (ch != (TChar)0x0d) && (ch != (TChar)0x0a))
            User::Leave(KMultiTransFailed);
    }

    // OK - release the block
    body->ReleaseData();
}
EXPORT_C void CHttpTestTransBase::DumpResponseBody(RHTTPTransaction& aTrans)
//dump all the body's chunks 
	{
	MHTTPDataSupplier* body = aTrans.Response().Body();
	TPtrC8 dataChunk;
	TBool isLast = body->GetNextDataPart(dataChunk);
	iEngine->Utils().DumpData(dataChunk);
	if (isLast && !iEngine->IsSilent())
		iEngine->Utils().LogIt(_L("Got last data chunk.\n"));
	body->ReleaseData();
	}