@@ -1045,7 +1045,7 @@ class coro_http_client : public std::enable_shared_from_this<coro_http_client> {
1045
1045
else {
1046
1046
host = std::string{u.host };
1047
1047
}
1048
- bool r = init_ssl (asio::ssl::verify_peer , " " , host);
1048
+ bool r = init_ssl (asio::ssl::verify_none , " " , host);
1049
1049
if (!r) {
1050
1050
data.net_err = std::make_error_code (std::errc::invalid_argument);
1051
1051
co_return data;
@@ -1102,21 +1102,23 @@ class coro_http_client : public std::enable_shared_from_this<coro_http_client> {
1102
1102
1103
1103
async_simple::coro::Lazy<std::error_code> handle_shake () {
1104
1104
#ifdef CINATRA_ENABLE_SSL
1105
- if (has_init_ssl_) {
1106
- if (socket_->ssl_stream_ == nullptr ) {
1107
- co_return std::make_error_code (std::errc::not_a_stream);
1105
+ if (!has_init_ssl_) {
1106
+ bool r = init_ssl (asio::ssl::verify_none, " " , host_);
1107
+ if (!r) {
1108
+ co_return std::make_error_code (std::errc::invalid_argument);
1108
1109
}
1110
+ }
1109
1111
1110
- auto ec = co_await coro_io::async_handshake (
1111
- socket_->ssl_stream_ , asio::ssl::stream_base::client);
1112
- if (ec) {
1113
- CINATRA_LOG_ERROR << " handle failed " << ec.message ();
1114
- }
1115
- co_return ec;
1112
+ if (socket_->ssl_stream_ == nullptr ) {
1113
+ co_return std::make_error_code (std::errc::not_a_stream);
1116
1114
}
1117
- else {
1118
- co_return std::error_code{};
1115
+
1116
+ auto ec = co_await coro_io::async_handshake (socket_->ssl_stream_ ,
1117
+ asio::ssl::stream_base::client);
1118
+ if (ec) {
1119
+ CINATRA_LOG_ERROR << " handle failed " << ec.message ();
1119
1120
}
1121
+ co_return ec;
1120
1122
#else
1121
1123
// please open CINATRA_ENABLE_SSL before request https!
1122
1124
co_return std::make_error_code (std::errc::protocol_error);
0 commit comments