本文整理汇总了C++中TUriParser8::Compare方法的典型用法代码示例。如果您正苦于以下问题:C++ TUriParser8::Compare方法的具体用法?C++ TUriParser8::Compare怎么用?C++ TUriParser8::Compare使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TUriParser8
的用法示例。
在下文中一共展示了TUriParser8::Compare方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LocalHostCheckL
// -----------------------------------------------------------------------------
// 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;
}
示例2: LocalHostCheckL
// -----------------------------------------------------------------------------
// LocalHostCheckL
// If the host is a local host. Returns ETrue
// if the transaction request URI was for a localhost.
// -----------------------------------------------------------------------------
//
TBool LocalHostCheckL(RHTTPTransaction& aTransaction)
{
_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)
{
return ETrue;
}
return EFalse;
}