|
@@ -98,32 +98,31 @@ httplib::Client cli("https://example.com");
|
|
|
auto res = cli.Get("/");
|
|
auto res = cli.Get("/");
|
|
|
if (!res) {
|
|
if (!res) {
|
|
|
// Check the error type
|
|
// Check the error type
|
|
|
- auto err = res.error();
|
|
|
|
|
|
|
+ const auto err = res.error();
|
|
|
|
|
|
|
|
switch (err) {
|
|
switch (err) {
|
|
|
case httplib::Error::SSLConnection:
|
|
case httplib::Error::SSLConnection:
|
|
|
std::cout << "SSL connection failed, SSL error: "
|
|
std::cout << "SSL connection failed, SSL error: "
|
|
|
- << res->ssl_error() << std::endl;
|
|
|
|
|
|
|
+ << res.ssl_error() << std::endl;
|
|
|
break;
|
|
break;
|
|
|
|
|
|
|
|
case httplib::Error::SSLLoadingCerts:
|
|
case httplib::Error::SSLLoadingCerts:
|
|
|
std::cout << "SSL cert loading failed, OpenSSL error: "
|
|
std::cout << "SSL cert loading failed, OpenSSL error: "
|
|
|
- << std::hex << res->ssl_openssl_error() << std::endl;
|
|
|
|
|
|
|
+ << std::hex << res.ssl_openssl_error() << std::endl;
|
|
|
break;
|
|
break;
|
|
|
|
|
|
|
|
case httplib::Error::SSLServerVerification:
|
|
case httplib::Error::SSLServerVerification:
|
|
|
std::cout << "SSL verification failed, X509 error: "
|
|
std::cout << "SSL verification failed, X509 error: "
|
|
|
- << res->ssl_openssl_error() << std::endl;
|
|
|
|
|
|
|
+ << res.ssl_openssl_error() << std::endl;
|
|
|
break;
|
|
break;
|
|
|
|
|
|
|
|
case httplib::Error::SSLServerHostnameVerification:
|
|
case httplib::Error::SSLServerHostnameVerification:
|
|
|
std::cout << "SSL hostname verification failed, X509 error: "
|
|
std::cout << "SSL hostname verification failed, X509 error: "
|
|
|
- << res->ssl_openssl_error() << std::endl;
|
|
|
|
|
|
|
+ << res.ssl_openssl_error() << std::endl;
|
|
|
break;
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
default:
|
|
|
std::cout << "HTTP error: " << httplib::to_string(err) << std::endl;
|
|
std::cout << "HTTP error: " << httplib::to_string(err) << std::endl;
|
|
|
- }
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
```
|
|
```
|