PrevUpHomeNext

HTTP/HTTPS Tunneling

Server-side
Client-side

RCF supports tunneling remote calls over the HTTP and HTTPS protocols. In particular, remote calls can be directed through HTTP and HTTPS proxies.

HTTPS is essentially the HTTP protocol layered on top of the SSL protocol. As such, configuration of the SSL aspects of HTTPS, is done in the same way as for the SSL transport protocol (see Transport protocols).

To setup a server with an HTTP endpoint, use RCF::HttpEndpoint:

RCF::RcfServer server( RCF::HttpEndpoint("0.0.0.0", 80) );
HelloWorldImpl helloWorldImpl;
server.bind<I_HelloWorld>(helloWorldImpl);
server.start();

Similarly, for an HTTPS endpoint, use RCF::HttpsEndpoint:

RCF::RcfServer server( RCF::HttpsEndpoint("0.0.0.0", 443) );
HelloWorldImpl helloWorldImpl;
server.bind<I_HelloWorld>(helloWorldImpl);

server.setCertificate( RCF::CertificatePtr( new RCF::PfxCertificate(
    "C:\\serverCert.p12", 
    "password", 
    "CertificateName") ) );

server.start();

Client side configuration is similar, using HttpEndpoint for a HTTP client:

RcfClient<I_HelloWorld> client( RCF::HttpEndpoint("server.acme.com", 80) );
client.Print("Hello World");

, and HttpsEndpoint for a HTTPS client:

RcfClient<I_HelloWorld> client( RCF::HttpsEndpoint("server.acme.com", 443) );
client.getClientStub().setCertificateValidationCallback(&schannelValidate);
client.Print("Hello World");

Finally, to direct remote calls through a HTTP or HTTPS proxy, use the ClientStub::setHttpProxy() and ClientStub::setHttpProxyPort() functions:

client.getClientStub().setHttpProxy("proxy.acme.com");
client.getClientStub().setHttpProxyPort(8080);
client.Print("Hello World");


PrevUpHomeNext