4
votes

I have a boost client that needs to support connections through a proxy.

Currently I am able to connect to the proxy and successfully communicate with external servers with one exception - ssl servers.

The proxy is http and I need to connect/retreive information from https sites.

What my code does now connect to proxy asio::ip::tcp::socket _socket; -succeeds send CONNECT host: ssl server to the proxy (connected above) -succeeds

-- This is where I am stuck. How do I execute the handshake/send requests?

I found this old post

boost::asio handshake through http proxy?

The problem is: sslsocket_(socket_,context) //this does not compile (the constructor is expecting an io_Service not a socket) --using boost 1.52

Ok below is the code

//Parse the header and check the response

boost::asio::ssl::stream<boost::asio::ip::tcp::socket> _socket;
boost::asio::ip::tcp::socket _httpSocket;
...

int response= _httpHeader.getResult(header.c_str());
if(response==200) { 
boost::asio::ssl::context ctx(io_service,boost::asio::ssl::context::sslv23);
 _sslSocket(_httpSocket,ctx); //this fails 

Note:I copied the above from the post above,based on the post this part worked. It looks to me it should be _sslSocekt(io_service,ctx) but I don't see how that would help me }

1
post your code demonstrating the compile failure - Sam Miller

1 Answers

1
votes

I found the answer, what I needed to to is connect to the proxy using _socket.next layer. Then if the connection succeeds read/write the responses using _socket.lowest_layer()