tags:

views:

199

answers:

2

quite new to boost and asio, need help

  1. connect to proxy asio::ip::tcp::socket socket_;
  2. send CONNECT host: ssl server to the proxy receive response 200
  3. asio::ssl::context ctx(io_service, asio::ssl::context::sslv23); sslsocket_(socket_,context)
  4. try handshake sslsocket_.async_handshake(asio::ssl::stream_base::client,
    boost::bind(&client::handle_handshake, this, asio::placeholders::error));
  5. and get asio.ssl error Wireshark: host sends FIN after 1st message of handshake

direct async connection to ssl server works fine, same through Proxifier

A: 

You'll probably need to examine the OpenSSL error stack in step 5, which isn't terribly easy since Boost.Asio doesn't map it into the normal system_error codes that it uses. There was a post by Guy Sirton recently on the asio mailing list describing how to modify the source to accomplish this.

Sam Miller
A: 

Forgot to mention that was running the application in VMplayer with NAT network; bridged removed the problem with initial handshake but sometimes after reconnect saw the same message; using the method in Sam's link got to "unexpected record" during handshake - google said on this error about renegotiations but that was not the case; digging into sources of OpenSSL: the new connection used the same BIO for reading and recevied application data from previous connection Don't know how to reset the SSL structure with asio, so made dynamic socket allocation with new|delete