boost::asio handshake through http proxy?

ε祈祈猫儿з 提交于 2019-12-12 04:03:09

问题


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


回答1:


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.




回答2:


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



来源:https://stackoverflow.com/questions/3079742/boostasio-handshake-through-http-proxy

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!