|
39 | 39 |
|
40 | 40 | #include "cpprest/base_uri.h" |
41 | 41 | #include "cpprest/details/http_helpers.h" |
42 | | -#include "cpprest/details/x509_cert_utilities.h" |
| 42 | +#include "../common/x509_cert_utilities.h" |
43 | 43 | #include "http_client_impl.h" |
44 | 44 | #include "pplx/threadpool.h" |
45 | 45 | #include <memory> |
@@ -468,7 +468,7 @@ class asio_context final : public request_context, public std::enable_shared_fro |
468 | 468 | , m_needChunked(false) |
469 | 469 | , m_timer(client->client_config().timeout<std::chrono::microseconds>()) |
470 | 470 | , m_connection(connection) |
471 | | -#if defined(__APPLE__) || (defined(ANDROID) || defined(__ANDROID__)) |
| 471 | +#ifdef CPPREST_PLATFORM_ASIO_CERT_VERIFICATION_AVAILABLE |
472 | 472 | , m_openssl_failed(false) |
473 | 473 | #endif |
474 | 474 | { |
@@ -1032,11 +1032,11 @@ class asio_context final : public request_context, public std::enable_shared_fro |
1032 | 1032 | // finally by the root CA self signed certificate. |
1033 | 1033 |
|
1034 | 1034 | const auto& host = utility::conversions::to_utf8string(m_http_client->base_uri().host()); |
1035 | | -#if defined(__APPLE__) || (defined(ANDROID) || defined(__ANDROID__)) |
1036 | | - // On OS X, iOS, and Android, OpenSSL doesn't have access to where the OS |
1037 | | - // stores keychains. If OpenSSL fails we will doing verification at the |
1038 | | - // end using the whole certificate chain so wait until the 'leaf' cert. |
1039 | | - // For now return true so OpenSSL continues down the certificate chain. |
| 1035 | +#ifdef CPPREST_PLATFORM_ASIO_CERT_VERIFICATION_AVAILABLE |
| 1036 | + // Attempt to use platform certificate validation when it is available: |
| 1037 | + // If OpenSSL fails we will doing verification at the end using the whole certificate chain, |
| 1038 | + // so wait until the 'leaf' cert. For now return true so OpenSSL continues down the certificate |
| 1039 | + // chain. |
1040 | 1040 | if (!preverified) |
1041 | 1041 | { |
1042 | 1042 | m_openssl_failed = true; |
@@ -1757,7 +1757,7 @@ class asio_context final : public request_context, public std::enable_shared_fro |
1757 | 1757 | boost::asio::streambuf m_body_buf; |
1758 | 1758 | std::shared_ptr<asio_connection> m_connection; |
1759 | 1759 |
|
1760 | | -#if defined(__APPLE__) || (defined(ANDROID) || defined(__ANDROID__)) |
| 1760 | +#ifdef CPPREST_PLATFORM_ASIO_CERT_VERIFICATION_AVAILABLE |
1761 | 1761 | bool m_openssl_failed; |
1762 | 1762 | #endif |
1763 | 1763 | }; |
|
0 commit comments