当前位置: 首页>>代码示例>>C++>>正文


C++ THTTPHdrVal类代码示例

本文整理汇总了C++中THTTPHdrVal的典型用法代码示例。如果您正苦于以下问题:C++ THTTPHdrVal类的具体用法?C++ THTTPHdrVal怎么用?C++ THTTPHdrVal使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了THTTPHdrVal类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: EnsureNoEndToEndHeadersInConnectionHeaderL

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));
			}			
		}
	}
开发者ID:kuailexs,项目名称:symbiandump-mw2,代码行数:33,代码来源:chttpclientfilter.cpp

示例2: CheckPortMatch

TBool CExampleCookieManager::CheckPortMatch(CCookie& aCookie, const TUriC8& aUri) const
	{
	THTTPHdrVal val;
	if(aCookie.Attribute(CCookie::EPort, val) == KErrNone)
		{
		TChar portSeparator(',');
		_LIT8(KDefaultPort, "80");

		const TDesC8& port = aUri.IsPresent(EUriPort)? aUri.Extract(EUriPort) : KDefaultPort();

		const TPtrC8& portList = RemoveQuotes(val.StrF().DesC());
		TInt portPos = portList.FindF(port);
		// if we do not find the port in the list then do not match
		if(portPos == KErrNotFound)
			return EFalse;
		// if the number was the last in the list then match
		else if((portPos + port.Length()) == portList.Length())
			return ETrue;
		// check that the number is followed by a separator ie do not match 80 with 8000
		else if(portList[portPos + port.Length()] == TUint(portSeparator))
			return ETrue;
		// we have not found a match
		else
			return EFalse;
		}

	// If the cookie does not have a portlist return ETrue to match any port
	return ETrue;
	}
开发者ID:kuailexs,项目名称:symbiandump-mw2,代码行数:29,代码来源:examplecookiemanager.cpp

示例3: connInfo

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);
			}
		}
	}
开发者ID:kuailexs,项目名称:symbiandump-mw2,代码行数:27,代码来源:get12.cpp

示例4: CheckAndSetSessionSettingsL

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);
        }
    }
}
开发者ID:kuailexs,项目名称:symbiandump-mw2,代码行数:30,代码来源:cpipeliningconfigtest.cpp

示例5: THTTPHdrVal

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);
			}
		}
	}
开发者ID:kuailexs,项目名称:symbiandump-mw2,代码行数:30,代码来源:chttpclientfilter.cpp

示例6: CheckDomainMatch

TBool CExampleCookieManager::CheckDomainMatch(CCookie& aCookie, const TUriC8& aUri) const
	{
	TChar domainSep = '.';

	if(aUri.IsPresent(EUriHost))
		{
		THTTPHdrVal attributeVal;
		aCookie.Attribute(CCookie::EDomain, attributeVal);

		const TDesC8& domain = aUri.Extract(EUriHost);
		const TPtrC8 cookieDomain = RemoveQuotes(attributeVal.StrF().DesC());

		// Domain matching rules:
		// if the cookie domain doesn't start with a dot then it must match the uri domain exactly
		// if it does start with a dot and it 
		TInt matchLoc = domain.FindF(cookieDomain);
		if((cookieDomain[0] != TUint(domainSep))		&& 
			(matchLoc == 0)								&& 
			(domain.Length() == cookieDomain.Length()))
			return ETrue;
		else if((matchLoc != KErrNotFound) &&
				(domain.Left(matchLoc).Locate(domainSep) == KErrNotFound))
				return ETrue;
		}

	return EFalse;
	}
开发者ID:kuailexs,项目名称:symbiandump-mw2,代码行数:27,代码来源:examplecookiemanager.cpp

示例7: DecodeGenericParamTokenL

TInt CWspHeaderReader::DecodeGenericParamTokenL(TWspPrimitiveDecoder& aDecoder, const TStringTable& aStrTable,
											THTTPHdrVal& aParamValue, RStringF& aParamDesValue) const
	{
	TInt err = 0;
	switch( aDecoder.VarType() )
		{
		case TWspPrimitiveDecoder::EString:
			{
			TPtrC8 fieldNameString;
			err = aDecoder.String(fieldNameString);
			User::LeaveIfError(err);
			aParamDesValue = iStrPool.OpenFStringL(fieldNameString);
			aParamValue.SetStrF(aParamDesValue);
			} break;
		case TWspPrimitiveDecoder::E7BitVal:
			{
			TUint8 fieldNameToken = 0;
			err = aDecoder.Val7Bit(fieldNameToken);
			User::LeaveIfError(err);
			aParamDesValue = iStrPool.StringF(fieldNameToken, aStrTable);
			aParamValue.SetStrF(aParamDesValue);
			} break;
		default:
			User::Leave(KErrCorrupt);
			break;
		}
	return err;
	}
开发者ID:kuailexs,项目名称:symbiandump-mw2,代码行数:28,代码来源:CWspHeaderReader.cpp

示例8: MHFRunL

// ------------------------------------------------------------------------------------------------
// 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() );
        }        
开发者ID:kuailexs,项目名称:symbiandump-mw2,代码行数:38,代码来源:HttpFilterConnHandler.cpp

示例9: q

void CHttpHdrTest::TestLookupPartL()
	{
	// Open strings needed in this test
	RStringF accStr = iStrP.StringF(HTTP::EAccept,RHTTPSession::GetTable());
	RStringF textHtmlStr = iStrP.StringF(HTTP::ETextHtml,RHTTPSession::GetTable());
	RStringF textPlainStr = iStrP.StringF(HTTP::ETextPlain,RHTTPSession::GetTable());
	RStringF anyAnyStr = iStrP.StringF(HTTP::EAnyAny,RHTTPSession::GetTable());
	RStringF qStr = iStrP.StringF(HTTP::EQ,RHTTPSession::GetTable());

	//
	//	  Accept: text/html; q=0.8, text/plain; q=0.2, */*
	//
	CHeaderField* accept = CHeaderField::NewL(accStr, *iHdrColl);
	CleanupStack::PushL(accept);
	//
	CHeaderFieldPart* htmlPt = CHeaderFieldPart::NewL(THTTPHdrVal(textHtmlStr));
	CleanupStack::PushL(htmlPt);
	THTTPHdrVal::TQConv q(0.8);
	CHeaderFieldParam* headerParam = CHeaderFieldParam::NewL(qStr, THTTPHdrVal(q));
	CleanupStack::PushL(headerParam);
	htmlPt->AddParamL(headerParam);
	CleanupStack::Pop(headerParam);
	accept->AddPartL(htmlPt);
	CleanupStack::Pop(htmlPt); // now owned by the header
	//

	CHeaderFieldPart* plainPt = CHeaderFieldPart::NewL(THTTPHdrVal(textPlainStr));
	CleanupStack::PushL(plainPt);
	THTTPHdrVal::TQConv q2(0.2);
	headerParam = CHeaderFieldParam::NewL(qStr, THTTPHdrVal(q2));
	CleanupStack::PushL(headerParam);
	plainPt->AddParamL(headerParam);
	CleanupStack::Pop(headerParam);
	accept->AddPartL(plainPt);
	CleanupStack::Pop(plainPt); // now owned by the header
	//
	CHeaderFieldPart* headerPart = CHeaderFieldPart::NewL(THTTPHdrVal(anyAnyStr));
	CleanupStack::PushL(headerPart);
	accept->AddPartL(headerPart);
	CleanupStack::Pop(headerPart);

	// now lookup the parts by index and check they are correct
	CHeaderFieldPart* pt = accept->PartL(0);
	TestL(pt == htmlPt);
	pt = accept->PartL(1);
	TestL(pt == plainPt);
	pt = accept->PartL(2);
	THTTPHdrVal val = pt->Value();
	TestL(val.Type() == THTTPHdrVal::KStrFVal);
	TestL(val.StrF().Index(RHTTPSession::GetTable()) == anyAnyStr.Index(RHTTPSession::GetTable()));	

	// Now just destroy that lot
	CleanupStack::PopAndDestroy(accept);
	}
开发者ID:kuailexs,项目名称:symbiandump-mw2,代码行数:54,代码来源:t_httphdr.cpp

示例10: ContentLength

TInt CHttpController::ContentLength( RHTTPHeaders aHeaderCollection, RHTTPSession& aSession )
	{
	RStringF contetnLength = aSession.StringPool().StringF( HTTP::EContentLength,
			RHTTPSession::GetTable() );
	THTTPHdrVal contetnLengthValue;
	TInt error( aHeaderCollection.GetField( contetnLength, 0, contetnLengthValue ) );
	if ( error == KErrNone )
		{
		return contetnLengthValue.Int();
		}
	return error;
	}
开发者ID:Symbian9,项目名称:symbian-http-engine,代码行数:12,代码来源:HttpController.cpp

示例11: _LIT

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);
				}
			}
		}
	}
}
开发者ID:DoktahWorm,项目名称:rhodes,代码行数:50,代码来源:HttpEventHandler.cpp

示例12: ProcessHeadersL

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);
	}
开发者ID:kuailexs,项目名称:symbiandump-mw2,代码行数:16,代码来源:CHeaderDecode.cpp

示例13: auth_token

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;
}
开发者ID:DoktahWorm,项目名称:rhodes,代码行数:47,代码来源:HttpEventHandler.cpp

示例14: ReadProxyInfoL

// -----------------------------------------------------------------------------
// CHttpFilterProxy::ReadProxyInfoL
// Purpose:	Reads the Proxy information from the comms database.
// Gives the Proxy usage, a proxy address (<proxy name>:<proxy port>),
// and proxy exceptions through the output arguments.
// -----------------------------------------------------------------------------
//
void CHttpFilterProxy::ReadProxyInfoL(const RStringPool aStringPool,
                                      TBool&      aUsage,
                                      RStringF&   aProxyAddress,
                                      RStringF&   aExceptions)

{
    // Let's find Internet Access point ID (ServiceId) in use from the RConnection associated with the HTTP framework
    THTTPHdrVal connValue;
    TUint32     serviceId;
    TUint pushCount = 0;
    RConnection* connPtr = NULL;
	THTTPHdrVal		iapId;
	TCommDbConnPref pref;
    TBool hasValue = iConnInfo.Property (aStringPool.StringF(HTTP::EHttpSocketConnection, RHTTPSession::GetTable()),
                     connValue);

    if (hasValue && connValue.Type() == THTTPHdrVal::KTIntVal)
    {
        connPtr = REINTERPRET_CAST(RConnection*, connValue.Int());
	}
开发者ID:kuailexs,项目名称:symbiandump-mw2,代码行数:27,代码来源:HttpFilterProxy.cpp

示例15: EnsureContentTypePresentL

void CHttpClientFilter::EnsureContentTypePresentL(RHTTPTransaction aTransaction)
	{
	// From RFC 2616 Section 7.2.1 - 
	//
	// Any HTTP/1.1 message containing an entity-body SHOULD include a Content-Type
	// header field defining the media type of that body. If and only if the 
	// media type is not given by a Content-Type field, the recipient MAY attempt
	// to guess the media type via inspection of its content and/or the name 
	// extension(s) of the URI used to identify the resource. If the media type
	// remains unknown, the recipient SHOULD treat it as type "application/octet-stream".

	RHTTPHeaders headers = aTransaction.Response().GetHeaderCollection();
	THTTPHdrVal contentType;
	RStringF contentTypeString = iStringPool.StringF(HTTP::EContentType, iStringTable);
	if( headers.GetField(contentTypeString, 0, contentType) == KErrNotFound )
		{
		// There is no Content-Type header - add it with a value of 
		// "application/octet-stream".
		contentType.SetStrF(iStringPool.StringF(HTTP::EApplicationOctetStream, iStringTable));
		headers.SetFieldL(contentTypeString, contentType);
		}
	}
开发者ID:kuailexs,项目名称:symbiandump-mw2,代码行数:22,代码来源:chttpclientfilter.cpp


注:本文中的THTTPHdrVal类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。