/**
Subtest function

@SYMTestCaseID          SYSLIB-BAFL-CT-0490
@SYMTestCaseDesc        Tests for defect number DEF043985
@SYMTestPriority        High
@SYMTestActions         Tests that the table is invalid when creating a folded RString
@SYMTestExpectedResults Tests must not fail
@SYMREQ                 REQ0000
*/
void RStringPoolPanicTest::DEF043985_IndexTest_SubFunctionL()
	{
	__UHEAP_MARK;

	RStringPool stringPool;
	stringPool.OpenL();

	// Create a table and make it so it passes some internal tests
	// for validity as we are testing a particular internal test
	TStringTable testTable;
	testTable.iCaseSensitive = ETrue;
	testTable.iCount = 1;

	RString testString = stringPool.OpenStringL(KDummyString());
	CleanupClosePushL(testString);
	
	// Test for Panic
	testString.Index(testTable);
	
	// Test should never get this far as it Panics
	
	CleanupStack::PopAndDestroy(&testString);
	stringPool.Close();
	
	__UHEAP_MARKEND;
	}
// ----------------------------------------------------------------------------
// CWmDrmDlaDefaultHttpManager::GetCredentialsL
// This function is NOT currently used as authentication is not current used in
// this project at the current time
// ----------------------------------------------------------------------------
TBool CWmDrmDlaDefaultHttpManager::GetCredentialsL(
    const TUriC8& /*aURI*/,
    RString aRealm,
    RStringF aAuthenticationType,
    RString& aUsername,
    RString& aPassword )
    {
    LOGFN( "CWmDrmDlaDefaultHttpManager::GetCredentialsL" );
    iCredentialsOk = EFalse;
    RStringPool pool = aRealm.Pool();
    if ( aAuthenticationType == HTTP_STRING( HTTP::EBasic ) )
        {
        DeleteUsernamePassword();

        // Get the username/password
        iInCallback = ETrue;
        iCredentialsOk =
            iObserver.OnGetUsernamePasswordL( iUsername, iPassword );
        iInCallback = EFalse;

        // authentication = iCredentialsOk && iUsername && iPassword
        // no authentication = !iCredentialsOk && !iUsername && !iPassword
        ASSERT( (iCredentialsOk && iUsername && iPassword) ||
            (!iCredentialsOk && !iUsername && !iPassword ) );

        if (iCredentialsOk)
            {
            aUsername = pool.OpenStringL( *iUsername );
            aPassword = pool.OpenStringL( *iPassword );
            }
        }

    // If the authentication type is not Basic, we simply return EFalse.
    return iCredentialsOk;
    }
// ------------------------------------------------------------------------------------------------
// 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 CPipeliningConfigTest::CheckAndSetSessionSettingsL(RHTTPSession aSession)
{
    RStringPool stringPool = aSession.StringPool();
    RHTTPConnectionInfo sessionSettings = aSession.ConnectionInfo();

    if (iMaxNumberTransactionsToPipeline > 0)
    {
        RStringF maxToPipelineSetting = stringPool.StringF(HTTP::EMaxNumTransactionsToPipeline,
                                        aSession.GetTable());
        THTTPHdrVal value;
        if (sessionSettings.Property(maxToPipelineSetting, value) == EFalse)
        {
            value.SetInt(iMaxNumberTransactionsToPipeline);
            sessionSettings.SetPropertyL(maxToPipelineSetting,value);
        }
    }


    if (iMaxNumberTransportHandlers > 0)
    {
        RStringF maxTransportHandlers = stringPool.StringF(HTTP::EMaxNumTransportHandlers,
                                        aSession.GetTable());
        THTTPHdrVal value;
        if (sessionSettings.Property(maxTransportHandlers, value) == EFalse)
        {
            value.SetInt(iMaxNumberTransportHandlers);
            sessionSettings.SetPropertyL(maxTransportHandlers,value);
        }
    }
}
Esempio n. 5
0
// ---------------------------------------------------------------------------
// SdpUtil::SetDefaultNetTypeAndAddrType
// Sets network type and address type to their "default" values
// ---------------------------------------------------------------------------
//
void SdpUtil::SetDefaultNetTypeAndAddrType( 
    RStringPool aPool, 
    const TInetAddr& aAddress,
    RStringF& aNetType, 
    RStringF& aAddressType )
    {
     // Sets network type to IN
    aNetType.Close();
    aNetType = aPool.StringF( SdpCodecStringConstants::ENetType,
                              SdpCodecStringConstants::Table ).Copy();
    // Address type       
    aAddressType.Close();

    TBuf16 <KMaxAddressLength> output;
    aAddress.Output(output);


    //addresstype for IPv4    
	if((aAddress.Address() &&  !aAddress.IsV4Mapped()) ||
       (!aAddress.Address() && aAddress.IsWildAddr() && 
        output.Match(KWildAddr) == 0))
        {
        aAddressType = aPool.StringF( SdpCodecStringConstants::EAddressTypeIP4,
                                      SdpCodecStringConstants::Table ).Copy();
        }
    else
        {
		//addresstype for IPv4-Mapped IPv6 && IPv6
        aAddressType = aPool.StringF( SdpCodecStringConstants::EAddressType,
                                      SdpCodecStringConstants::Table ).Copy();
        }
    }
Esempio n. 6
0
void CHttpTestCaseGet12::LogConnectionProperties()
	{
	RHTTPConnectionInfo	connectionInfo = iSession.ConnectionInfo();
	RStringPool stringPool = iSession.StringPool();
	THTTPHdrVal value;
	TBool hasValue = connectionInfo.Property (stringPool.StringF(HTTP::EHttpSocketConnection, RHTTPSession::GetTable()), value);
	if (hasValue)
		{
		RConnection* conn = REINTERPRET_CAST(RConnection*, value.Int());
		TUint count;
		//get the no of active connections
		TInt err = conn->EnumerateConnections(count);
		if(err==KErrNone)
			{
			for (TUint i=1; i<=count; ++i)
				{
				TPckgBuf<TConnectionInfo> connInfo;
				conn->GetConnectionInfo(i, connInfo);
				iEngine->Utils().LogIt(_L("Connection %d: IapId=%d, NetId=%d\n"),i, connInfo().iIapId, connInfo().iNetId);
				}
			}
		else
			{
			iEngine->Utils().LogIt(_L("Unable to enumerate number of connections, Error: %d"), err);
			}
		}
	}
Esempio n. 7
0
void CINC097492_3::CreateTransArrayL()
	{
	RStringPool strP = iSession.StringPool();
	TUriParser8 up;

	up.Parse(KHttpUrl1);
	RHTTPTransaction trans1 = iSession.OpenTransactionL(up, *this, strP.StringF(HTTP::EGET,RHTTPSession::GetTable()));
	CleanupClosePushL(trans1);
	iTransArray.Append(trans1);
	CleanupStack::Pop(&trans1);
	
	up.Parse(KHttpUrl2);
	RHTTPTransaction trans2 = iSession.OpenTransactionL(up, *this, strP.StringF(HTTP::EGET,RHTTPSession::GetTable()));
	CleanupClosePushL(trans2);
	iTransArray.Append(trans2);
	CleanupStack::Pop(&trans2);

	up.Parse(KHttpUrl3);
	RHTTPTransaction trans3 = iSession.OpenTransactionL(up, *this, strP.StringF(HTTP::EGET,RHTTPSession::GetTable()));
	CleanupClosePushL(trans3);
	iTransArray.Append(trans3);
	CleanupStack::Pop(&trans3);

	for(TInt i=0; i<iTransArray.Count(); i++)
		{
		iTransArray[i].SubmitL();
		iOpenTransCount++;
		}
	}
COCSPTransportDefault::TTransportScheme COCSPTransportDefault::IdentifySchemeL(const TDesC8& aURI)
	{
	TTransportScheme ret = ETransportSchemeNotSupported;
	
	TUriParser8 uri;
	TInt error = uri.Parse(aURI);
	if (error != KErrNone || !uri.IsPresent(EUriScheme))
		{
		return ret;
		}
	const TPtrC8 scheme = uri.Extract(EUriScheme);
			
	RStringPool stringPool;
	stringPool.OpenL();
	CleanupClosePushL(stringPool);

	RStringF schemeF = stringPool.OpenFStringL(scheme);
	CleanupClosePushL(schemeF);
	RStringF httpF = stringPool.OpenFStringL(KHttpString);
	CleanupClosePushL(httpF);

	if (schemeF == httpF)
		{
		ret = ETransportSchemeHTTP;
		}

	CleanupStack::PopAndDestroy(3); // close httpF, schemeF, stringPool

	return ret;
	}
/**
@SYMTestCaseID          SYSLIB-BAFL-CT-0488
@SYMTestCaseDesc        Tests for defect number DEF043985
@SYMTestPriority        High
@SYMTestActions         Tests that the table is invalid when creating an RString
                        Check for panic    
@SYMTestExpectedResults Tests must not fail
@SYMREQ                 REQ0000
*/
TInt RStringPoolPanicTest::DEF043985_StringTest_ThreadL(TAny*)
	{
	__UHEAP_MARK;

	RStringPool stringPool;
	stringPool.OpenL();

	// Create a table and make it so it passes some internal tests
	// for validity as we are testing a particular internal test
	TStringTable testTable;
	testTable.iCaseSensitive = ETrue;
	testTable.iCount = 1;

	// Test for Panic
	RString testString = stringPool.String(0, testTable);

	// Test should never get this far as it Panics

	testString.Close();
	stringPool.Close();

	__UHEAP_MARKEND;

	return KErrNone;		
	}
void UPPayHttpConnection::AddHeaderL(RHTTPHeaders aHeaders, TInt aHeaderField, const TDesC8& aHeaderValue)
{
	RStringPool stringPool = iSession.StringPool();
	RStringF valStr = stringPool.OpenFStringL(aHeaderValue);
	THTTPHdrVal headerVal(valStr);
	aHeaders.SetFieldL(stringPool.StringF(aHeaderField, RHTTPSession::GetTable()), headerVal);
	valStr.Close();
}
TBool CUPnPArgument::Validate(const RStringPool& aStringPool, const TStringTable& aStringTable ) const
	{
	TBool result=EFalse;
	if(	(Property(aStringPool.String(UPNPDESCRIPTIONXMLTAGS::EName, aStringTable)).Length()!=0) &&
			(Property(aStringPool.String(UPNPDESCRIPTIONXMLTAGS::EArgumentDirection, aStringTable)).Length()!=0) &&	
			(Property(aStringPool.String(UPNPDESCRIPTIONXMLTAGS::ERelatedStateVar, aStringTable)).Length()!=0))
				result = ETrue;
	
	return result;
	
	}
// ----------------------------------------------------------------------------
// CWmDrmDlaDefaultHttpManager::SetHeaderL
// ----------------------------------------------------------------------------
void CWmDrmDlaDefaultHttpManager::SetHeaderL(
    RHTTPHeaders& aHeaders,
    TInt aHdrField,
    const TDesC8& aHdrValue ) const
    {
    RStringPool pool = iHttpSession.StringPool();
    RStringF valStr = pool.OpenFStringL( aHdrValue );
    CleanupClosePushL( valStr );
    THTTPHdrVal val( valStr );
    aHeaders.SetFieldL( HTTP_STRING( aHdrField ), val );
    CleanupStack::PopAndDestroy( &valStr ); // Close
    }
Esempio n. 13
0
TBool CTestTransaction::AddAcceptHeaderL(RHTTPHeaders &aHeaders, RStringPool &aStrPool)
	{
	//	some tests may require specific 'Accept' parameters
	TBuf8<KMaxAcceptLengthSize> acceptBuf;
	acceptBuf.Copy(Machine()->GetDefine(KITHAccept));
	RStringF accept = (acceptBuf.Length() == 0) ?
		aStrPool.StringF(HTTP::EAnyAny, RHTTPSession::GetTable()) : aStrPool.OpenFStringL(acceptBuf);
	THTTPHdrVal acceptHdr(accept);
	aHeaders.SetFieldL(aStrPool.StringF(HTTP::EAccept, RHTTPSession::GetTable()), acceptHdr);
	accept.Close();
	return ETrue;
	}
Esempio n. 14
0
void CHTTPTest::DoTestsL()
	{

	testHarness->StartTestL(_L("Creating the string pool"));
	RStringPool pool;
	pool.OpenL(table);
	testHarness->EndTest(0);
	testHarness->StartTestL(_L("Creating 'hello'"));
	STRDCI_L(hello, KHello);
	RStringF def;
	testHarness->EndTest(hello == def);
	testHarness->StartTestL(_L("Creating another 'hello'"));
	ASTRDCI_L(hello1, KHello1);
	testHarness->EndTest(!(hello == hello1.iObj));
	testHarness->StartTestL(_L("Testing !="));
	testHarness->EndTest(hello != hello1.iObj);
	testHarness->StartTestL(_L("Creating 'goodbye'"));
	STRDCI_L(goodbye, KGoodbye);
	testHarness->EndTest(hello == goodbye);
	testHarness->StartTestL(_L("Creating string tokens"));
	RStringTokenF h1, h2(hello), g;
	h1 = hello;
	testHarness->EndTest(h1 != h2);
	testHarness->StartTestL(_L("Testing == on string tokens"));
	testHarness->EndTest(!(h1 == h2));
	testHarness->StartTestL(_L("Making a string from a token"));
	hello1.iObj =  pool.StringF(h1);
	testHarness->EndTest(hello != hello1.iObj);
	testHarness->StartTestL(_L("Non-equal tokens"));
	g = goodbye;
	testHarness->EndTest(hello == goodbye);
	testHarness->StartTestL(_L("Operator != on non-equal tokens"));
	testHarness->EndTest(!(hello != goodbye));
	testHarness->StartTestL(_L("Copy function"));
	hello1.iObj = hello.Copy();
	testHarness->EndTest(hello != hello1.iObj);
	testHarness->StartTestL(_L("String extraction (same)"));
	testHarness->EndTest(static_cast<const TDesC8&>(hello).Compare(hello1.iObj));
	testHarness->StartTestL(_L("String extraction (different)"));
	testHarness->EndTest(!static_cast<const TDesC8&>(hello).Compare(goodbye));
	testHarness->StartTestL(_L("String extraction (original)"));
	testHarness->EndTest(static_cast<const TDesC8&>(hello).Compare(KHello));
	testHarness->StartTestL(_L("Closing pool"));
	hello.Copy();
	hello.Close();
	hello.Close();
	hello1.iObj.Close();
	// The copys here have got a bit confused
	hello1.iObj.Close();
	goodbye.Close();
	pool.CloseAll();
	testHarness->EndTest(0);	
	}
Esempio n. 15
0
// -----------------------------------------------------------------------------
// 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;
    }
// -----------------------------------------------------------------------------
// CSdpConnectionField::InternalizeL
// Internalizes the object from stream
// -----------------------------------------------------------------------------
//
CSdpConnectionField* CSdpConnectionField::InternalizeL(
    RReadStream& aStream )
    {
    TUint32 length;
    CSdpConnectionField* obj = NULL;
    RStringPool pool = SdpCodecStringPool::StringPoolL();

    // address
    length = aStream.ReadUint32L();
	HBufC8* address = HBufC8::NewLC( length );
    TPtr8 ptr( address->Des() );
    aStream.ReadL( ptr, length );
    // TTL
    TInt ttl = aStream.ReadInt32L();
    // Number of addresses
    TInt numOfAddr = aStream.ReadInt32L();
    // Network type
    length = aStream.ReadUint32L();
    HBufC8* netType = HBufC8::NewLC( length );
    ptr.Set( netType->Des() );
    aStream.ReadL( ptr, length );
    // Address type
    length = aStream.ReadUint32L();
    HBufC8* addrType = HBufC8::NewLC( length );
    ptr.Set( addrType->Des() );
    aStream.ReadL( ptr, length );

    TInetAddr addr;
    HBufC* address16 = HBufC::NewLC( address->Length() ) ;
    address16->Des().Copy( *address );
    TInt err = addr.Input( *address16 );

    if ( !err )
        {
        // Create connection field based on TInetAddr
        obj = CSdpConnectionField::NewL( addr, ttl, numOfAddr );
        }
    else
        {
        // Create connection field from buffer, ttl & numOfAddr
        // are in this case irrelevant
        RStringF netTypeStr = pool.OpenFStringL( *netType );
        CleanupClosePushL( netTypeStr );
        RStringF addrTypeStr = pool.OpenFStringL( *addrType );
        CleanupClosePushL( addrTypeStr );
        obj = CSdpConnectionField::NewL( netTypeStr, addrTypeStr, *address );
        CleanupStack::PopAndDestroy( 2 );   // netTypeStr, addrTypeStr
        }

    CleanupStack::PopAndDestroy( 4 );  // address, netType, addrType, address16
    return obj;
    }
Esempio n. 17
0
// -----------------------------------------------------------------------------
// TSdpTypedTime::DecodeL
// Decodes typed time from TDesC
// -----------------------------------------------------------------------------
//
TSdpTypedTime TSdpTypedTime::DecodeL(const TDesC8& aText)
    {
    TLex8 typedTimeLex(aText);
    TSdpTypedTime typedTime;
    User::LeaveIfError(typedTimeLex.Val(typedTime.iValue, EDecimal));

    if (typedTimeLex.Peek() != 0)
        {
        TPtrC8 unitString = typedTimeLex.NextToken();

        RStringPool pool = SdpCodecStringPool::StringPoolL();
        const TDesC8& timeDays = pool.StringF(
                            SdpCodecStringConstants::ETimeUnitDays,
                            SdpCodecStringConstants::Table).DesC();
        const TDesC8& timeHours = pool.StringF(
                            SdpCodecStringConstants::ETimeUnitHours,
                            SdpCodecStringConstants::Table).DesC();
        const TDesC8& timeMinutes = pool.StringF(
                            SdpCodecStringConstants::ETimeUnitMinutes,
                            SdpCodecStringConstants::Table).DesC();
        const TDesC8& timeSeconds = pool.StringF(
                            SdpCodecStringConstants::ETimeUnitSeconds,
                            SdpCodecStringConstants::Table).DesC();

        if (unitString.Compare(timeDays) == 0)
            {
            typedTime.iUnit = ETimeUnitDays;
            }
        else if (unitString.Compare(timeHours) == 0)
            {
            typedTime.iUnit = ETimeUnitHours;
            }
        else if (unitString.Compare(timeMinutes) == 0)
            {
            typedTime.iUnit = ETimeUnitMinutes;
            }
        else if (unitString.Compare(timeSeconds) == 0)
            {
            typedTime.iUnit = ETimeUnitSeconds;
            }
        else
            {
            User::Leave(KErrSdpCodecTypedTime);
            }
        }
    else
        {
        typedTime.iUnit = ETimeUnitNone;
        }

    return typedTime;
    }
Esempio n. 18
0
TBool CHttpTestCaseGet12::GetCredentialsL(const TUriC8& aURI, RString aRealm, RStringF aAuthenticationType, RString& aUsername, RString& aPassword)
	{
	iEngine->Utils().LogIt(_L("Supplying credentials"));
	iEngine->Utils().DumpData(aURI.UriDes());
	iEngine->Utils().DumpData(aRealm.DesC());	
	iEngine->Utils().DumpData(aAuthenticationType.DesC());	
	_LIT8(KScooby, "scooby");
	_LIT8(KDoo, "doo");
	RStringPool p = aRealm.Pool();
	aUsername = p.OpenStringL(KScooby);
	aPassword = p.OpenStringL(KDoo);
	return ETrue;
	}
Esempio n. 19
0
TBool CTestTransaction::SetContentLengthL(RHTTPHeaders &aHeaders, RStringPool &aStrPool)
	{
	TBuf8<KMaxContentLengthSize> contLengthBuf;
	contLengthBuf.Copy(Machine()->GetDefine(KITHContentLength));
	if (contLengthBuf.Length() != 0)
		{
		RStringF contLengthStr = aStrPool.OpenFStringL(contLengthBuf);
		THTTPHdrVal contLength(contLengthStr);
		aHeaders.SetFieldL(aStrPool.StringF(HTTP::EContentLength, RHTTPSession::GetTable()), contLength);
		contLengthStr.Close();
		}

	return ETrue;
	}
Esempio n. 20
0
TBool CTestTransaction::AcceptEncodingL(RHTTPHeaders &aHeaders, RStringPool &aStrPool)
	{
	TBuf8<KMaxAcceptEncodingSize> acceptEncodingBuf;
	acceptEncodingBuf.Copy(Machine()->GetDefine(KITHAcceptEncoding));
	if (acceptEncodingBuf.Length() > 0)
		{
		RStringF acceptEncoding = aStrPool.OpenFStringL(acceptEncodingBuf);
		THTTPHdrVal acceptEncodingHdr(acceptEncoding);
		aHeaders.SetFieldL(aStrPool.StringF(HTTP::EAcceptCharset, RHTTPSession::GetTable()), acceptEncodingHdr);
		acceptEncoding.Close();
		}

	return ETrue;
	}
/** 
validation
*/
TBool CUPnPStateVariable::Validate(const RStringPool& aStringPool, const TStringTable& aStringTable ) const
	{
	TBool result=ETrue;
	// name cannot be of zero chars
	
	if(	(Property(aStringPool.String(UPNPDESCRIPTIONXMLTAGS::EName, aStringTable)).Length()!=0) &&
			(Property(aStringPool.String(UPNPDESCRIPTIONXMLTAGS::EStateVariableDataType, aStringTable)).Length()!=0) &&
			(Property(aStringPool.String(UPNPDESCRIPTIONXMLTAGS::ESendEvents, aStringTable)).Length()!=0)	)
				result = ETrue;

	
	return result;

	}
Esempio n. 22
0
TBool CTestTransaction::SetUserAgentL(RHTTPHeaders &aHeaders, RStringPool &aStrPool)
	{
	//	get the DEFINE for UserAgent
	TBuf8<KMaxUserAgentSize> userAgentBuf;
	userAgentBuf.Copy(Machine()->GetDefine(KITHUserAgent));

	TInt iLen = userAgentBuf.Length();
	//	assign the selection
	RStringF agent = (iLen == 0) ? aStrPool.OpenFStringL(KUserAgent) : aStrPool.OpenFStringL(userAgentBuf);
	THTTPHdrVal userAgent(agent);
	aHeaders.SetFieldL(aStrPool.StringF(HTTP::EUserAgent, RHTTPSession::GetTable()), userAgent);
	agent.Close();

	return ETrue;
	}
Esempio n. 23
0
// ---------------------------------------------------------------------------
// SdpUtil::EncodeBufferL
// Encodes headername and a value to the stream
// ---------------------------------------------------------------------------
//
void SdpUtil::EncodeBufferL(
    const TDesC8& aValue, 
    TInt aIndex,
    RWriteStream& aStream )
	{
	if( aValue.Length() != 0 )
		{
        RStringPool pool = SdpCodecStringPool::StringPoolL();
		RStringF headername = pool.StringF( aIndex, 
                                        SdpCodecStringPool::StringTableL() );
		aStream.WriteL( headername.DesC() );
		aStream.WriteL( aValue );
		aStream.WriteL( KCRLFStr );
		}
	}
// -----------------------------------------------------------------------------
// CHttpCacheManager::VSSRequestCheck
//
// -----------------------------------------------------------------------------
//
TBool CHttpCacheManager::VSSRequestCheckL( const RHTTPTransaction& aTrans,
                                           const RHTTPHeaders& aHttpHeader,
                                           const TDesC8& aUrl )
    {
    TBool VSSTransaction ( EFalse );
    if ( iVSSCacheEnabled && HttpCacheUtil::VSSCacheContent( aUrl, iVSSWhiteList ) )
        {
        RStringPool strP = aTrans.Session().StringPool();

#ifdef __CACHELOG__
        RHTTPHeaders headers ( aHttpHeader );
        HBufC8* responseHeaderStr8 = HttpCacheUtil::HeadersToBufferLC( headers, strP );
        HBufC* responseHeaderStr;
        if( responseHeaderStr8 )
            {
            responseHeaderStr = HBufC::NewL( responseHeaderStr8->Length() );
            responseHeaderStr->Des().Copy( responseHeaderStr8->Des() );
            CleanupStack::PopAndDestroy(); //  responseHeaderStr8;
            TPtrC headerStr( responseHeaderStr->Des() );
            HttpCacheUtil::WriteLog( 0, _L("========== VSS Header Start =========\n") );
            HttpCacheUtil::WriteLog( 0, responseHeaderStr->Des() );
            HttpCacheUtil::WriteLog( 0, _L("========== VSS Header End =========\n") );
            delete responseHeaderStr;
            }
#endif

        TPtrC8 nameStr ( KVSSHeaderFieldName() );

        RStringF VSSnameStr = strP.OpenFStringL( nameStr );
        CleanupClosePushL<RStringF>( VSSnameStr);

        THTTPHdrVal tempVal;
        if ( aHttpHeader.GetField( VSSnameStr, 0, tempVal ) == KErrNone )
            {
            TPtrC8 valueStr ( KVSSHeaderFieldValue() );
            RStringF VSSValueStr = strP.OpenFStringL( valueStr );
            CleanupClosePushL<RStringF>( VSSValueStr );

            if ( tempVal == VSSValueStr )
                {
                VSSTransaction      = ETrue;
                }
            CleanupStack::PopAndDestroy(); // VSSValueStr
            }
        CleanupStack::PopAndDestroy(); // VSSnameStr
        } //end if( iVSSCacheEnabled && HttpCacheUtil::VSSCacheContent( aUrl, iVSSWhiteList ) )
    return VSSTransaction;
    }
// ---------------------------------------------------------------------------
// TIRXMLElementFormat::CloseStringPoolL
// Closes the StringPool
// ---------------------------------------------------------------------------
//
void TIRXMLElementFormat::CloseStringPoolL( RStringPool&  aStringPool )
    {
    IRLOG_DEBUG( "TIRXMLElementFormat::CloseStringPoolL" );
    aStringPool.Close();
    IRLOG_DEBUG( "TIRXMLElementFormat::CloseStringPoolL - Exiting." );
    return;
    }    
Esempio n. 26
0
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);
	}
/**
	This function is called to initiate the tests.
	It may leave with one of the system-wide error codes.
*/
void CTextModeTestPostBodyChunks::DoRunL()
	{
	// Open the HTTP session
	iSession.OpenL();
	CleanupClosePushL(iSession);
	RStringPool strP = iSession.StringPool();

	// Open a POST transactions, specifying this object as the request body 
	// data supplier
	TUriParser8 up;

	HBufC8* newUrl8 = TSrvAddrVal::ReplaceHostNameL(KHttpPostBodyChunksUrl(), iIniSettingsFile);
	CleanupStack::PushL(newUrl8);
	TPtr8 newUrlPtr8 = newUrl8->Des();

	up.Parse(newUrlPtr8);
	
	iTransaction = iSession.OpenTransactionL(up, *this, strP.StringF(HTTP::EPOST,RHTTPSession::GetTable()));
	RHTTPRequest rq = iTransaction.Request();
	rq.SetBody(*this);
	RHTTPHeaders hdr = rq.GetHeaderCollection();
	THTTPHdrVal length(OverallDataSize());
	hdr.SetFieldL(strP.StringF(HTTP::EContentLength,RHTTPSession::GetTable()), length);
	THTTPHdrVal contType(strP.StringF(HTTP::EApplicationXWwwFormUrlEncoded, RHTTPSession::GetTable()));
	hdr.SetFieldL(strP.StringF(HTTP::EContentType, RHTTPSession::GetTable()), contType);
	
	// Create the delayed notifier
	iReleaseTimer = CDelayedBodyDataNotifier::NewL(iTransaction);
	CleanupStack::PushL(iReleaseTimer);
	CActiveScheduler::Add(iReleaseTimer);

	// Submit the transaction
	iTransaction.SubmitL();
	iFailureError = KErrNone;
	CActiveScheduler::Start();

	// Get the completion code and inform the engine.  Anything other than 
	// HTTP/200 status is a failure for this test.
	iEngine->SetCurrentStatusCode(iTransaction.Response().StatusCode());
	iExpectedStatusCode = 200;

	// Close anything opened
	CleanupStack::PopAndDestroy(3, &iSession); // and iReleaseTimer, newUrl8;

	// Check for failure error codes caught in MHFRunL
	User::LeaveIfError(iFailureError);
	}
Esempio n. 28
0
TBool CHttpEventHandler::GetHdrVal( THTTPHdrVal& hdrVal, RStringPool& pool)
{
	TBool retval = ETrue;
	TPtrC8 auth_token((const TUint8*)"auth_token");
	
	switch (hdrVal.Type())
	{
		case THTTPHdrVal::KStrFVal:
			{
				RStringF fieldNameStr = pool.StringF(hdrVal.StrF());
				const TDesC8& fieldNameDesC = fieldNameStr.DesC();
				
				if (iVerbose)
				{
					TBuf<CHttpConstants::KMaxHeaderValueLen>  value;
					value.Copy(fieldNameDesC.Left(CHttpConstants::KMaxHeaderValueLen));
					iTest->Console()->Printf(_L("%S:\n"), &value);
				}

				if ( fieldNameDesC.Length() > 0 && fieldNameDesC.Compare(auth_token) )
					iCookies.Append(fieldNameDesC);
				else
					retval = EFalse;
			}
			break;
		case THTTPHdrVal::KStrVal:
			{
				RString fieldNameStr = pool.String(hdrVal.Str());
				const TDesC8& fieldNameDesC = fieldNameStr.DesC();
				
				if (iVerbose)
				{
					TBuf<CHttpConstants::KMaxHeaderValueLen>  value;
					value.Copy(fieldNameDesC.Left(CHttpConstants::KMaxHeaderValueLen));
					iTest->Console()->Printf(_L("%S:\n"), &value);
				}
				
				if ( fieldNameDesC.Length() > 0 && fieldNameDesC.Compare(auth_token) )
					iCookies.Append(fieldNameDesC);
				else
					retval = EFalse;
			}
			break;
	}
	
	return retval;
}
Esempio n. 29
0
CHTTPSession::~CHTTPSession()
	{
	iSessionClosing = ETrue;

	while (iTransactions.Count())
		iTransactions[iTransactions.Count() - 1]->Close();
	iTransactions.Close();

	// We need a RHTTPSession to give to the filters, so fake one up
	RHTTPSession s;
	s.iImplementation = this;

	// If there isn't a manager we must have failed to construct
	// the session so there can't be any filters. So it's safe not
	// to close them.
	if (iManager)
		{
		RStringPool strP = iManager->StringPool();
		for (TInt i = 0; i < iFilterQueue.Count(); i++)
			{
			THTTPFilterHandle h;
			h.iValue = iFilterQueue[i].iHandle;
			iFilterQueue[i].iFilter->MHFUnload(s, h);
			strP.StringF(iFilterQueue[i].iHeader).Close();
			strP.StringF(iFilterQueue[i].iName).Close();
			}
		iFilterQueue.Close();
		}

	delete iProtocolHandler;
	delete iConnectionInfo;
	delete iRequestSessionHeaders;
	delete iResponseSessionHeaders;
	delete iFilterConfigIter;

	// Flush and close the filter arrays
	iFilterInfoList.ResetAndDestroy();
	iEComFilterInfoArray.ResetAndDestroy();

	// No longer need the manager... the last session to close causes the manager
	// (and string pool) to be deleted.
	if (iManager)
		iManager->Release();
	
	// force ECOM to release all - final clean-up 
	REComSession::FinalClose();
	}
Esempio n. 30
0
AMInt32 SetSessionConnectionInfo(AMPVoid session)
	{
	REINTERPRET( RHTTPSession*, temp, session );
    // Set the sessions connection info...
    RStringPool strPool = temp->StringPool();
    RHTTPConnectionInfo connInfo = temp->ConnectionInfo();
    
    REINTERPRET( CNetworkAccessPoint*, NetworkAccessPoint, AMSocketIAPGet() );
    
    // ...to use our socket server and connection
    connInfo.SetPropertyL ( strPool.StringF(HTTP::EHttpSocketServ,
        RHTTPSession::GetTable() ), THTTPHdrVal (NetworkAccessPoint->GetRSocketServ().Handle()) );
    // ...to use our connection
    connInfo.SetPropertyL ( strPool.StringF(HTTP::EHttpSocketConnection,
        RHTTPSession::GetTable() ), 
        THTTPHdrVal (REINTERPRET_CAST(TInt, &(NetworkAccessPoint->GetRConnection()))) );
	}