Enhance asio ssl authentication through http proxy

I have a boost client that must support proxy connections.

Currently, I can connect to a proxy and successfully communicate with external servers with one exception - ssl servers.

The proxy server is http, and I need to connect / receive information from https sites.

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

- That's where I got stuck. How to execute acknowledgment / sending requests?

I found this old post

boost :: asio handshake via http proxy?

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

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 above message, based on the message that this part worked. It seems to me that this should be _sslSocekt (io_service, ctx), but I don’t see how this will help me}

+4
source share
1 answer

I found the answer, I needed to connect to the proxy using the _socket.next layer. Then, if the connection succeeds in reading / writing responses using _socket.lowest_layer ()

+1
source

All Articles