本文整理汇总了C++中THTTPHdrVal类的典型用法代码示例。如果您正苦于以下问题:C++ THTTPHdrVal类的具体用法?C++ THTTPHdrVal怎么用?C++ THTTPHdrVal使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了THTTPHdrVal类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: CheckPathMatch
TBool CExampleCookieManager::CheckPathMatch(CCookie& aCookie, const TUriC8& aUri) const
{
THTTPHdrVal attributeVal;
aCookie.Attribute(CCookie::EPath, attributeVal);
TPtrC8 cookiePath = RemoveQuotes(attributeVal.StrF().DesC());
const TDesC8& uriPath = aUri.Extract(EUriPath);
if(uriPath.Length() == 0)
{
// if the uri has no path then it matches against no cookie path
// or a cookie path of just a /
const TInt pathLength = cookiePath.Length();
if(pathLength == 0 || pathLength == 1)
return ETrue;
}
else if(uriPath.FindF(cookiePath) == 0)
{
TChar separator('/');
// Check that the character after the matched bit is a / otherwise
// /path would match against /path2
const TInt uriLength = uriPath.Length();
const TInt cookieLength = cookiePath.Length();
if(uriLength == cookieLength)
return ETrue;
else if(uriLength > cookieLength)
{
if(cookiePath[cookieLength - 1] == TUint(separator))
return ETrue;
else if(uriPath[cookieLength] == TUint(separator))
return ETrue;
}
}
return EFalse;
}
开发者ID:kuailexs,项目名称:symbiandump-mw2,代码行数:36,代码来源:examplecookiemanager.cpp
示例17: DecodeWellKnownParamTokenL
void CWspHeaderReader::DecodeWellKnownParamTokenL(TWspPrimitiveDecoder& aDecoder, TInt& aBytesRead,
TPtrC8& aRawParamBlock, CHeaderFieldPart& aHeaderFieldPart) const
{
TInt err = 0;
TUint32 parameterToken = 0;
aBytesRead = aDecoder.Integer(parameterToken);
THTTPHdrVal paramValue;
RStringF paramDesValue;
CleanupClosePushL(paramDesValue);
RStringF paramName = iStrPool.StringF(parameterToken, WSPParam::Table);
switch( parameterToken )
{
case WSPParam::EQ:
{
// Decode Q value
TUint32 qIntValue = 0;
err = aDecoder.UintVar(qIntValue);
User::LeaveIfError(err);
aBytesRead += err;
TReal q;
TInt numDecimals = 0;
TBuf8<KMaxNumQDigits> qDesC;
if( qIntValue > 100 )
{
// Value is -100 and then divide by 1000
qIntValue -= 100;
q = ((TReal)(qIntValue/1000.));
numDecimals = 3;
}
else
{
// Value is -1 and then divide by 100
--qIntValue;
if( qIntValue%10 ==0 )
numDecimals = 1;
else
numDecimals = 2;
q = ((TReal)(qIntValue/100.));
}
TRealFormat realFt(KMaxNumQDigits,numDecimals); // set max width and 3 decimal places
// always use a decimal separator rather than the one supplied
// by the current locale
realFt.iPoint = TChar('.');
qDesC.Num(q, realFt);
paramDesValue = iStrPool.OpenFStringL(qDesC);
paramValue.SetStrF(paramDesValue);
} break;
case WSPParam::ECharset:
{
if( aRawParamBlock[aBytesRead] == 128 )
{
paramDesValue = iStrPool.StringF(WSPStdConstants::EAny, WSPStdConstants::Table);
paramValue.SetStrF(paramDesValue);
// Need to call Integer to update offset in WSP Decoder
TUint8 updateDecoder = 0;
err = aDecoder.Val7Bit(updateDecoder);
User::LeaveIfError(err);
aBytesRead += err;
}
else
{
switch( aDecoder.VarType() )
{
case TWspPrimitiveDecoder::E7BitVal:
case TWspPrimitiveDecoder::ELengthVal:
{
TUint32 value = 0;
err = aDecoder.Integer(value);
User::LeaveIfError(err);
aBytesRead += err;
GetCharacterSetFromValueL(value, paramDesValue);
paramValue.SetStrF(paramDesValue);
} break;
default:
User::Leave(KErrCorrupt);
break;
}
}
} break;
case WSPParam::ELevel:
{
// This is a version value
err = aDecoder.VersionL(iStrPool,paramDesValue);
User::LeaveIfError(err);
aBytesRead += err;
paramValue.SetStrF(paramDesValue);
} break;
case WSPParam::EType:
case WSPParam::ESize:
case WSPParam::EPadding:
case WSPParam::ESEC:
case WSPParam::EMaxAge:
{
TUint32 integerValue = 0;
err = aDecoder.Integer(integerValue);
User::LeaveIfError(err);
aBytesRead += err;
paramValue.SetInt(integerValue);
} break;
case WSPParam::ECreationDate:
//.........这里部分代码省略.........
开发者ID:kuailexs,项目名称:symbiandump-mw2,代码行数:101,代码来源:CWspHeaderReader.cpp
示例18: val
TBool CExampleCookieManager::ValidateCookieL(CCookie& aCookie, const TUriC8& aUri)
{
THTTPHdrVal attributeVal;
if(aCookie.Attribute(CCookie::EPath, attributeVal) == KErrNone)
{
// if the path attribute exists check it is a prefix of the path
// of the uri that issued it (if not reject)
RStringF cookiePath = attributeVal.StrF();
const TDesC8& uriPath = aUri.Extract(EUriPath);
if(uriPath.FindF(RemoveQuotes(cookiePath.DesC())) != 0)
return EFalse;
}
else
{
// if the path attribute doesn't exist add it
THTTPHdrVal val(iStringPool.OpenFStringL(aUri.Extract(EUriPath)));
aCookie.SetAttributeL(CCookie::EPath, val);
}
if(aCookie.Attribute(CCookie::EDomain, attributeVal) == KErrNone)
{
const TChar dot('.');
const TDesC8& cookieDomain = attributeVal.StrF().DesC();
const TDesC8& uriDomain = aUri.Extract(EUriHost);
// if the domain does not exactly match the uri and does not begin
// with a dot then add one
if((cookieDomain.Compare(uriDomain) != 0) &&
(cookieDomain.Locate(dot) != 0))
{
_LIT8(KAddDotString, ".%S");
HBufC8* newDomain = HBufC8::NewLC(cookieDomain.Length() + 1);
newDomain->Des().AppendFormat(KAddDotString(), &cookieDomain);
RStringF domain = iStringPool.OpenFStringL(*newDomain);
CleanupStack::PopAndDestroy(newDomain);
THTTPHdrVal val(domain);
aCookie.SetAttributeL(CCookie::EDomain, val);
domain.Close();
}
// if the domain does not contain an embedded dot then reject it
// ie reject .com or .com.
// Start by removing one character from each end. ie start at pos 1 and take a length
// which is 2 shorter than the original descriptor
TPtrC8 domainMiddle = cookieDomain.Mid(1, cookieDomain.Length() - 2);
if(domainMiddle.Locate(dot) == KErrNotFound)
return EFalse;
// Reject the cookie if the domain differs by two or more levels from the uri
// ie if uri=www.x.y.com then accept a cookie with .x.y.com but reject .y.com
TInt pos = uriDomain.FindF(cookieDomain);
if(pos > 2)
{
const TDesC8& domainDiff = uriDomain.Left(pos);
// Remove one character from each end. ie start at pos 1 and take a length
// which is 2 shorter than the original descriptor
const TDesC8& diffMiddle = domainDiff.Mid(1, domainDiff.Length() - 2);
if(diffMiddle.Locate(dot) != KErrNotFound)
return EFalse;
}
}
else
{
// if the domain attribute is not found add it
THTTPHdrVal val(iStringPool.OpenFStringL(aUri.Extract(EUriHost)));
aCookie.SetAttributeL(CCookie::EDomain, val);
val.StrF().Close();
}
if(!CheckPortMatch(aCookie, aUri))
return EFalse;
return ETrue;
}
开发者ID:kuailexs,项目名称:symbiandump-mw2,代码行数:78,代码来源:examplecookiemanager.cpp
示例19: switch
void CSTTrackerConnection::MHFRunL(RHTTPTransaction aTransaction,
const THTTPEvent& aEvent)
{
switch (aEvent.iStatus)
{
case THTTPEvent::EGotResponseHeaders:
{
// HTTP response headers have been received. Use
// aTransaction.Response() to get the response. However, it's not
// necessary to do anything with the response when this event occurs.
LWRITELN(iLog, _L("[Trackerconnection] Got HTTP headers"));
// Get HTTP status code from header (e.g. 200)
RHTTPResponse resp = aTransaction.Response();
TInt status = resp.StatusCode();
if (status != 200) // ERROR, hiba esetén mi legyen? 404-et lekezelni!
{
LWRITE(iLog, _L("[Trackerconnection] Error, status = "));
TBuf<20> numBuf;
numBuf.Num(status);
LWRITELN(iLog, numBuf);
Cancel();
if (iObserver)
iObserver->TrackerConnectionFailedL();
break;
}
// Get status text (e.g. "OK")
HLWRITE(iLog, _L("[Trackerconnection] Status text = "));
TBuf<32> statusText;
statusText.Copy(resp.StatusText().DesC());
HLWRITELN(iLog, statusText);
#ifdef LOG_TO_FILE
RHTTPHeaders headers =
aTransaction.Response().GetHeaderCollection();
THTTPHdrFieldIter i =
headers.Fields();
for (i.First(); !(i.AtEnd()); ++i)
{
RStringF header = iSession.StringPool().StringF(i());
if ((header.DesC() == _L8("Content-Type")))
{
HLWRITE(iLog, header.DesC());
HLWRITE(iLog, _L(": "));
THTTPHdrVal val;
headers.GetField(header, 0, val);
RStringF value = val.StrF();
HLWRITELN(iLog, value.DesC());
}
else
HLWRITELN(iLog, header.DesC());
}
#endif
}
break;
case THTTPEvent::EGotResponseBodyData:
{
// Part (or all) of response's body data received. Use
// aTransaction.Response().Body()->GetNextDataPart() to get the actual
// body data.
// Get the body data supplier
MHTTPDataSupplier* body = aTransaction.Response().Body();
TPtrC8 dataChunk;
// GetNextDataPart() returns ETrue, if the received part is the last
// one.
TBool isLast = body->GetNextDataPart(dataChunk);
//iDownloadedSize += dataChunk.Size();
HLWRITELN(iLog, _L8("[TrackerConnection] HTTP response body chunk received: "));
HLWRITELN(iLog, dataChunk);
if (iReceiveBuffer)
{
HBufC8* temp = HBufC8::NewL(
iReceiveBuffer->Length() + dataChunk.Length());
TPtr8 tempPtr(temp->Des());
tempPtr.Copy(*iReceiveBuffer);
tempPtr.Append(dataChunk);
delete iReceiveBuffer;
iReceiveBuffer = temp;
}
else
iReceiveBuffer = dataChunk.AllocL();
// Always remember to release the body data.
body->ReleaseData();
// NOTE: isLast may not be ETrue even if last data part received.
// (e.g. multipart response without content length field)
// Use EResponseComplete to reliably determine when body is completely
//.........这里部分代码省略.........
开发者ID:Nokia700,项目名称:SymTorrent,代码行数:101,代码来源:STTrackerConnection.cpp
示例20: while
void CTestTransaction::DumpRespHeaders(RHTTPTransaction &aTrans)
{
RHTTPResponse resp = aTrans.Response();
RStringPool strP = aTrans.Session().StringPool();
RHTTPHeaders hdr = resp.GetHeaderCollection();
THTTPHdrFieldIter it = hdr.Fields();
TBuf<32> fieldName16;
TBuf<128> fieldVal16;
while (it.AtEnd() == EFalse)
{
RStringTokenF fieldNameTk = it();
RStringF fieldName = strP.StringF(fieldNameTk);
THTTPHdrVal hVal;
if (hdr.GetField(fieldName, 0, hVal) == KErrNone)
{
TPtrC8 fieldNameStr(strP.StringF(fieldName).DesC());
if (fieldNameStr.Length() > 32)
fieldNameStr.Set(fieldNameStr.Left(32));
fieldName16.Copy(fieldNameStr);
THTTPHdrVal fieldVal;
hdr.GetField(fieldName, 0, fieldVal);
switch (fieldVal.Type())
{
case THTTPHdrVal::KTIntVal: Log(_L("%S: %d"), &fieldName16, fieldVal.Int()); break;
case THTTPHdrVal::KStrVal:
case THTTPHdrVal::KStrFVal:
{
TPtrC8 fieldValStr(strP.StringF(fieldVal.StrF()).DesC());
if (fieldValStr.Length() > 128)
fieldValStr.Set(fieldValStr.Left(128));
fieldVal16.Copy(fieldValStr);
Log(_L("%S: %S"), &fieldName16, &fieldVal16);
// see if we've got the Content-Type header
if (fieldName16.Find(KHTTPContentType) != KErrNotFound)
{
// check that the contenttype script sets matches (in some way) received header
TBuf8<KMaxContentTypeSize> contTypeBuf;
contTypeBuf.Copy(Machine()->GetDefine(KITHContentType));
TInt iPos = fieldValStr.Find(contTypeBuf);
if (iPos == KErrNotFound)
Log(_L(" - Content Type string [%S:%S] is different to ContentType setting"), &fieldName16, &fieldVal16);
else
Log(_L(" - Content Type [%S:%S] acknowledged"), &fieldName16, &fieldVal16);
}
}
break;
case THTTPHdrVal::KDateVal:
{
TDateTime myDate = fieldVal.DateTime();
WriteDateStamp(myDate);
Log(_L(" : %S"), &fieldName16);
}
break;
default: Log(_L("%S: <unrecognised value type>"), &fieldName16); break;
}
}
++it;
}
}
开发者ID:kuailexs,项目名称:symbiandump-mw2,代码行数:68,代码来源:httptransaction.cpp
注:本文中的THTTPHdrVal类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论