Skip to content

Commit 83565d7

Browse files
committed
Peer verification using environment variables
1 parent b28c807 commit 83565d7

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

boost/network/protocol/http/client/connection/ssl_delegate.ipp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,11 @@ void boost::network::http::impl::ssl_delegate::connect(
3434
context_->load_verify_file(*certificate_filename_);
3535
if (verify_path_) context_->add_verify_path(*verify_path_);
3636
} else {
37-
if (always_verify_peer_)
38-
context_->set_verify_mode(asio::ssl::context::verify_peer);
37+
if ( always_verify_peer_ )
38+
{
39+
context_->set_verify_mode( asio::ssl::context::verify_peer );
40+
context_->set_default_verify_paths(); // use openssl default verify paths. uses openssl environment variables SSL_CERT_DIR, SSL_CERT_FILE
41+
}
3942
else
4043
context_->set_verify_mode(asio::ssl::context::verify_none);
4144
}

boost/network/protocol/http/client/options.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,11 @@ struct client_options {
9595
return *this;
9696
}
9797

98+
client_options& always_verify_peer(bool v) {
99+
always_verify_peer_ = v;
100+
return *this;
101+
}
102+
98103
client_options& timeout(int v) {
99104
timeout_ = v;
100105
return *this;

0 commit comments

Comments
 (0)