Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2023 HERE Europe B.V.
* Copyright (C) 2023-2025 HERE Europe B.V.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -19,8 +19,9 @@

#pragma once

#include "olp/core/CoreApi.h"
#include "olp/core/http/CertificateSettings.h"
#include <olp/core/CoreApi.h>
#include <olp/core/http/CertificateSettings.h>
#include <olp/core/porting/optional.h>

namespace olp {
namespace http {
Expand All @@ -38,6 +39,15 @@ struct CORE_API NetworkInitializationSettings {
* @brief The custom certificate settings.
*/
CertificateSettings certificate_settings;

/**
* @brief The path to the network diagnostic output.
* If not set, diagnostics will not be produced.
*
* @note Currently, only CURL-based network implementation supports this
* setting.
*/
porting::optional<std::string> diagnostic_output_path = porting::none;
};

} // namespace http
Expand Down
14 changes: 14 additions & 0 deletions olp-cpp-sdk-core/src/http/curl/NetworkCurl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,20 @@ NetworkCurl::NetworkCurl(NetworkInitializationSettings settings)
OLP_SDK_LOG_INFO_F(
kLogTag, "TLS backend: %s",
version_data->ssl_version ? version_data->ssl_version : "<empty>");

if (settings.diagnostic_output_path) {
stderr_ = fopen(settings.diagnostic_output_path->c_str(), "a");
if (!stderr_) {
const auto* path_error = strerror(errno);
OLP_SDK_LOG_ERROR_F(
kLogTag, "Failed to open diagnostic output file, error=%s, path=%s",
path_error, settings.diagnostic_output_path->c_str());
} else {
OLP_SDK_LOG_INFO_F(kLogTag, "Using diagnostic output file, path=%s",
settings.diagnostic_output_path->c_str());
verbose_ = true;
}
}
}

NetworkCurl::~NetworkCurl() {
Expand Down
Loading