Verify certificates in client examples:

fix #1237

HTTP client examples now verify the server's certificate
and generate an error if the certificate is invalid or
expired:

* Set certificate verify mode
* Remove duplicate root certificate
This commit is contained in:
PeterW3
2018-09-23 10:12:08 -07:00
committed by Vinnie Falco
parent cd33d4cbb4
commit 4643b0565e
6 changed files with 13 additions and 21 deletions
@@ -225,6 +225,9 @@ int main(int argc, char** argv)
// This holds the root certificate used for verification
load_root_certificates(ctx);
// Verify the remote server's certificate
ctx.set_verify_mode(ssl::verify_peer);
// Launch the asynchronous operation
std::make_shared<session>(ioc, ctx)->run(host, port, target, version);