By default, a new RHTTPSession is set to make direct connections to an origin server. To switch it to use a proxy, the following two properties must be set: HTTP::EProxyUsage and HTTP::EProxyAddress.
HTTP::EProxyUsage can take the values HTTP::EDoNotUseProxy (the default) or HTTP::EUseProxy.
HTTP::EProxyAddress must be set using an RStringF value that contains the proxy address as an IP Address and port number separated by a colon, for example, "10.158.7.4:9003".
void CHttpClient::SetProxyL(RStringF aProxyAddr) { RHTTPConnectionInfo connInfo = iSess.ConnectionInfo(); THTTPHdrVal proxyUsage(iSess.StringPool().StringF(HTTP::EUseProxy,RHTTPSession::GetTable())); connInfo.SetPropertyL(iSess.StringPool().StringF(HTTP::EProxyUsage,RHTTPSession::GetTable()), proxyUsage); THTTPHdrVal proxyAddr(aProxyAddr); connInfo.SetPropertyL(iSess.StringPool().StringF(HTTP::EProxyAddress,RHTTPSession::GetTable()), aProxyAddr); Printf(_L("Proxy set to:%S\n\n"), &iProxyName); }
Changes made to the proxy settings will affect only new transactions opened on the session, and not any currently in progress.
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.