Exemplo n.º 1
0
void CPodcastModel::SetProxyUsageIfNeededL(RHTTPSession& aSession)
	{
	TBool useProxy = EFalse;
	HBufC* serverName = NULL;
	TUint32 port = 0;
	
	TRAPD(err,GetProxyInformationForConnectionL(useProxy, serverName, port));
	if (err == KErrNone && useProxy)
		{
		CleanupStack::PushL(serverName);
		TBuf8<128> proxyAddr;
		proxyAddr.Append(*serverName);
		proxyAddr.Append(':');
		proxyAddr.AppendNum(port);
				
		RStringF prxAddr = aSession.StringPool().OpenFStringL(proxyAddr);
		CleanupClosePushL(prxAddr);
		THTTPHdrVal prxUsage(aSession.StringPool().StringF(HTTP::EUseProxy,RHTTPSession::GetTable()));

		aSession.ConnectionInfo().SetPropertyL(
						aSession.StringPool().StringF(HTTP::EProxyUsage,RHTTPSession::GetTable()), 
						aSession.StringPool().StringF(HTTP::EUseProxy,RHTTPSession::GetTable()));

		aSession.ConnectionInfo().SetPropertyL(aSession.StringPool().StringF(HTTP::EProxyAddress,RHTTPSession::GetTable()), prxAddr); 
		
		CleanupStack::PopAndDestroy(&prxAddr);
		CleanupStack::PopAndDestroy(serverName);
		}
	}
void UPPayHttpConnection::AddProxy()
{
	RHTTPTransactionPropertySet transactionProperties = iTransaction.PropertySet();
	_LIT8(KAddress,"10.0.0.172:80");
	TBuf8<20> aProxy8(KAddress);
	RStringF prxAddr = iSession.StringPool().OpenFStringL(aProxy8);
	CleanupClosePushL(prxAddr);

	THTTPHdrVal prxUsage(iSession.StringPool().StringF(HTTP::EUseProxy, RHTTPSession::GetTable()));
	transactionProperties.SetPropertyL(iSession.StringPool().StringF(HTTP::EProxyUsage, RHTTPSession::GetTable()), prxUsage);
	transactionProperties.SetPropertyL(iSession.StringPool().StringF(HTTP::EProxyAddress, RHTTPSession::GetTable()), prxAddr);

	CleanupStack::PopAndDestroy(); // prxAddr
}