@@ -696,11 +696,11 @@ ErrorCode NetworkCurl::SendImplementation(
696
696
#ifdef OLP_SDK_CURL_HAS_SUPPORT_SSL_BLOBS
697
697
if (ssl_certificates_blobs_) {
698
698
curl_easy_setopt (curl_handle, CURLOPT_SSLCERT_BLOB,
699
- & ssl_certificates_blobs_->ssl_cert_blob );
699
+ ssl_certificates_blobs_->ssl_cert_blob . get_ptr () );
700
700
curl_easy_setopt (curl_handle, CURLOPT_SSLKEY_BLOB,
701
- & ssl_certificates_blobs_->ssl_key_blob );
701
+ ssl_certificates_blobs_->ssl_key_blob . get_ptr () );
702
702
curl_easy_setopt (curl_handle, CURLOPT_CAINFO_BLOB,
703
- & ssl_certificates_blobs_->ca_info_blob );
703
+ ssl_certificates_blobs_->ca_info_blob . get_ptr () );
704
704
} else
705
705
#endif
706
706
{
@@ -1312,17 +1312,23 @@ void NetworkCurl::Run() {
1312
1312
1313
1313
#ifdef OLP_SDK_CURL_HAS_SUPPORT_SSL_BLOBS
1314
1314
void NetworkCurl::SetupCertificateBlobs () {
1315
- if (certificate_settings_.client_cert_file_blob .empty () ||
1316
- certificate_settings_.client_key_file_blob .empty () ||
1315
+ if (certificate_settings_.client_cert_file_blob .empty () &&
1316
+ certificate_settings_.client_key_file_blob .empty () &&
1317
1317
certificate_settings_.cert_file_blob .empty ()) {
1318
1318
OLP_SDK_LOG_INFO (kLogTag , " No certificate blobs provided" );
1319
1319
return ;
1320
1320
}
1321
1321
1322
- auto setup_blob = [](struct curl_blob & blob, std::string& src) {
1323
- blob.data = const_cast <char *>(src.data ());
1324
- blob.len = src.size ();
1325
- blob.flags = CURL_BLOB_NOCOPY;
1322
+ auto setup_blob = [](SslCertificateBlobs::OptionalBlob& blob,
1323
+ std::string& src) {
1324
+ if (src.empty ()) {
1325
+ blob.reset ();
1326
+ return ;
1327
+ }
1328
+ blob = SslCertificateBlobs::OptionalBlob::value_type{};
1329
+ blob->data = const_cast <char *>(src.data ());
1330
+ blob->len = src.size ();
1331
+ blob->flags = CURL_BLOB_NOCOPY;
1326
1332
};
1327
1333
1328
1334
ssl_certificates_blobs_ = SslCertificateBlobs{};
@@ -1334,7 +1340,17 @@ void NetworkCurl::SetupCertificateBlobs() {
1334
1340
setup_blob (ssl_certificates_blobs_->ca_info_blob ,
1335
1341
certificate_settings_.cert_file_blob );
1336
1342
1337
- OLP_SDK_LOG_INFO (kLogTag , " Certificate blobs provided" );
1343
+ auto to_log_str = [](const SslCertificateBlobs::OptionalBlob& blob) {
1344
+ return blob ? " <provided>" : " <empty>" ;
1345
+ };
1346
+
1347
+ OLP_SDK_LOG_INFO (kLogTag ,
1348
+ " Certificate blobs provided, client_cert_blob="
1349
+ << to_log_str (ssl_certificates_blobs_->ssl_cert_blob )
1350
+ << " , client_key_blob="
1351
+ << to_log_str (ssl_certificates_blobs_->ssl_key_blob )
1352
+ << " , ca_info_blob="
1353
+ << to_log_str (ssl_certificates_blobs_->ca_info_blob ));
1338
1354
}
1339
1355
#endif
1340
1356
0 commit comments