Skip to content

Commit cd06964

Browse files
Log used certificate paths for cURL (#1497)
This may help to investigate issues related to certificates Relates-To: OLPEDGE-2879 Signed-off-by: Andrey Kashcheev <ext-andrey.kashcheev@here.com>
1 parent 02352c7 commit cd06964

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

olp-cpp-sdk-core/src/http/curl/NetworkCurl.cpp

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2019-2023 HERE Europe B.V.
2+
* Copyright (C) 2019-2024 HERE Europe B.V.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -318,6 +318,33 @@ NetworkCurl::NetworkCurl(NetworkInitializationSettings settings)
318318
"CURL does not support SSL info with blobs, required 7.77.0, detected %s",
319319
LIBCURL_VERSION);
320320
#endif
321+
322+
std::string curl_ca_info;
323+
std::string curl_ca_path;
324+
#if CURL_AT_LEAST_VERSION(7, 70, 0)
325+
const auto* version_data = curl_version_info(CURLVERSION_NOW);
326+
curl_ca_path = version_data->capath ? version_data->capath : "<empty>";
327+
curl_ca_info = version_data->cainfo ? version_data->cainfo : "<empty>";
328+
#else
329+
curl_ca_path = "<empty>";
330+
curl_ca_info = "<empty>";
331+
#endif
332+
333+
std::string ca_bundle_path;
334+
#ifdef OLP_SDK_NETWORK_HAS_OPENSSL
335+
ca_bundle_path = CaBundlePath();
336+
if (ca_bundle_path.empty()) {
337+
ca_bundle_path = "<empty>";
338+
}
339+
#else
340+
ca_bundle_path = "<empty>";
341+
#endif
342+
343+
OLP_SDK_LOG_INFO_F(kLogTag,
344+
"Certificate options, curl_ca_path=%s, curl_ca_info=%s, "
345+
"ca_bundle_path=%s",
346+
curl_ca_path.c_str(), curl_ca_info.c_str(),
347+
ca_bundle_path.c_str());
321348
}
322349

323350
NetworkCurl::~NetworkCurl() {

0 commit comments

Comments
 (0)