未验证 提交 ade517f3 编写于 作者: W wanderingbort 提交者: GitHub

Merge pull request #5874 from EOSIO/https_rfc2818_verification_13x

Perform rfc2818 on HTTPS connections
Subproject commit 4dc8375d7d3e02ab1177ab5c22835f75b45c845a Subproject commit f085773d29ecc457894170fae740b726465f1382
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include <eosio/chain/exceptions.hpp> #include <eosio/chain/exceptions.hpp>
#include <eosio/http_plugin/http_plugin.hpp> #include <eosio/http_plugin/http_plugin.hpp>
#include <eosio/chain_plugin/chain_plugin.hpp> #include <eosio/chain_plugin/chain_plugin.hpp>
#include <boost/asio/ssl/rfc2818_verification.hpp>
#include "httpc.hpp" #include "httpc.hpp"
using boost::asio::ip::tcp; using boost::asio::ip::tcp;
...@@ -240,9 +241,10 @@ namespace eosio { namespace client { namespace http { ...@@ -240,9 +241,10 @@ namespace eosio { namespace client { namespace http {
boost::asio::ssl::stream<boost::asio::ip::tcp::socket> socket(cp.context->ios, ssl_context); boost::asio::ssl::stream<boost::asio::ip::tcp::socket> socket(cp.context->ios, ssl_context);
SSL_set_tlsext_host_name(socket.native_handle(), url.server.c_str()); SSL_set_tlsext_host_name(socket.native_handle(), url.server.c_str());
if(cp.verify_cert) if(cp.verify_cert) {
socket.set_verify_mode(boost::asio::ssl::verify_peer); socket.set_verify_mode(boost::asio::ssl::verify_peer);
socket.set_verify_callback(boost::asio::ssl::rfc2818_verification(url.server));
}
do_connect(socket.next_layer(), url); do_connect(socket.next_layer(), url);
socket.handshake(boost::asio::ssl::stream_base::client); socket.handshake(boost::asio::ssl::stream_base::client);
re = do_txrx(socket, request, status_code); re = do_txrx(socket, request, status_code);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册