Skip to content

Commit

Permalink
format, changelog.
Browse files Browse the repository at this point in the history
  • Loading branch information
marcalff committed Dec 6, 2023
1 parent c7bb4f5 commit 862b728
Show file tree
Hide file tree
Showing 10 changed files with 61 additions and 59 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,19 @@ Increment the:

## [Unreleased]

* [REMOVAL] Remove option WITH_OTLP_HTTP_SSL_PREVIEW
[#2435](https://github.com/open-telemetry/opentelemetry-cpp/pull/2435)

Important changes:

Breaking changes:

* [REMOVAL] Remove option WITH_OTLP_HTTP_SSL_PREVIEW
[#2435](https://github.com/open-telemetry/opentelemetry-cpp/pull/2435)
* CMake options `WITH_OTLP_HTTP_SSL_PREVIEW`
and `WITH_OTLP_HTTP_SSL_TLS_PREVIEW` are removed.
Building opentelemetry-cpp without SSL support is no longer possible.

## [1.13.0] 2023-12-06

* [BUILD] Remove WITH_REMOVE_METER_PREVIEW, use WITH_ABI_VERSION_2 instead
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@ struct OtlpHttpClientOptions
input_ssl_min_tls,
input_ssl_max_tls,
input_ssl_cipher,
input_ssl_cipher_suite
),
input_ssl_cipher_suite),
content_type(input_content_type),
json_bytes_mapping(input_json_bytes_mapping),
use_json_name(input_use_json_name),
Expand Down
11 changes: 5 additions & 6 deletions exporters/otlp/test/otlp_http_exporter_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,15 @@ OtlpHttpClientOptions MakeOtlpHttpClientOptions(HttpRequestContentType content_t
options.http_headers.insert(
std::make_pair<const std::string, std::string>("Custom-Header-Key", "Custom-Header-Value"));
OtlpHttpClientOptions otlp_http_client_options(
options.url,
false, /* ssl_insecure_skip_verify */
options.url, false, /* ssl_insecure_skip_verify */
"", /* ssl_ca_cert_path */ "", /* ssl_ca_cert_string */
"", /* ssl_client_key_path */
"", /* ssl_client_key_string */ "", /* ssl_client_cert_path */
"", /* ssl_client_cert_string */
"", /* ssl_min_tls */
"", /* ssl_max_tls */
"", /* ssl_cipher */
"", /* ssl_cipher_suite */
"", /* ssl_min_tls */
"", /* ssl_max_tls */
"", /* ssl_cipher */
"", /* ssl_cipher_suite */
options.content_type, options.json_bytes_mapping, options.use_json_name,
options.console_debug, options.timeout, options.http_headers);
if (!async_mode)
Expand Down
11 changes: 5 additions & 6 deletions exporters/otlp/test/otlp_http_log_record_exporter_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,15 @@ OtlpHttpClientOptions MakeOtlpHttpClientOptions(HttpRequestContentType content_t
options.http_headers.insert(
std::make_pair<const std::string, std::string>("Custom-Header-Key", "Custom-Header-Value"));
OtlpHttpClientOptions otlp_http_client_options(
options.url,
false, /* ssl_insecure_skip_verify */
options.url, false, /* ssl_insecure_skip_verify */
"", /* ssl_ca_cert_path */ "", /* ssl_ca_cert_string */
"", /* ssl_client_key_path */
"", /* ssl_client_key_string */ "", /* ssl_client_cert_path */
"", /* ssl_client_cert_string */
"", /* ssl_min_tls */
"", /* ssl_max_tls */
"", /* ssl_cipher */
"", /* ssl_cipher_suite */
"", /* ssl_min_tls */
"", /* ssl_max_tls */
"", /* ssl_cipher */
"", /* ssl_cipher_suite */
options.content_type, options.json_bytes_mapping, options.use_json_name,
options.console_debug, options.timeout, options.http_headers);
if (!async_mode)
Expand Down
11 changes: 5 additions & 6 deletions exporters/otlp/test/otlp_http_metric_exporter_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,15 @@ OtlpHttpClientOptions MakeOtlpHttpClientOptions(HttpRequestContentType content_t
options.http_headers.insert(
std::make_pair<const std::string, std::string>("Custom-Header-Key", "Custom-Header-Value"));
OtlpHttpClientOptions otlp_http_client_options(
options.url,
false, /* ssl_insecure_skip_verify */
options.url, false, /* ssl_insecure_skip_verify */
"", /* ssl_ca_cert_path */ "", /* ssl_ca_cert_string */
"", /* ssl_client_key_path */
"", /* ssl_client_key_string */ "", /* ssl_client_cert_path */
"", /* ssl_client_cert_string */
"", /* ssl_min_tls */
"", /* ssl_max_tls */
"", /* ssl_cipher */
"", /* ssl_cipher_suite */
"", /* ssl_min_tls */
"", /* ssl_max_tls */
"", /* ssl_cipher */
"", /* ssl_cipher_suite */
options.content_type, options.json_bytes_mapping, options.use_json_name,
options.console_debug, options.timeout, options.http_headers);
if (!async_mode)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,7 @@ class HttpClientSync : public opentelemetry::ext::http::client::HttpClientSync
opentelemetry::ext::http::client::Body body;

HttpOperation curl_operation(opentelemetry::ext::http::client::Method::Get, url.data(),
ssl_options,
nullptr, headers, body);
ssl_options, nullptr, headers, body);

curl_operation.SendSync();
auto session_state = curl_operation.GetSessionState();
Expand All @@ -253,8 +252,7 @@ class HttpClientSync : public opentelemetry::ext::http::client::HttpClientSync
const opentelemetry::ext::http::client::Headers &headers) noexcept override
{
HttpOperation curl_operation(opentelemetry::ext::http::client::Method::Post, url.data(),
ssl_options,
nullptr, headers, body);
ssl_options, nullptr, headers, body);
curl_operation.SendSync();
auto session_state = curl_operation.GetSessionState();
if (curl_operation.WasAborted())
Expand Down
3 changes: 1 addition & 2 deletions ext/include/opentelemetry/ext/http/client/http_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,7 @@ struct HttpSslOptions
nostd::string_view input_ssl_min_tls,
nostd::string_view input_ssl_max_tls,
nostd::string_view input_ssl_cipher,
nostd::string_view input_ssl_cipher_suite
)
nostd::string_view input_ssl_cipher_suite)
: use_ssl(false),
ssl_insecure_skip_verify(input_ssl_insecure_skip_verify),
ssl_ca_cert_path(input_ssl_ca_cert_path),
Expand Down
3 changes: 1 addition & 2 deletions ext/src/http/client/curl/http_client_curl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ void Session::SendRequest(
reuse_connection = session_id_ % http_client_.GetMaxSessionsPerConnection() != 0;
}

curl_operation_.reset(new HttpOperation(http_request_->method_, url,
http_request_->ssl_options_,
curl_operation_.reset(new HttpOperation(http_request_->method_, url, http_request_->ssl_options_,
callback_ptr, http_request_->headers_,
http_request_->body_, false, http_request_->timeout_ms_,
reuse_connection));
Expand Down
44 changes: 22 additions & 22 deletions ext/src/http/client/curl/http_operation_curl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ void HttpOperation::Cleanup()

static long parse_min_ssl_version(std::string version)
{
# ifdef HAVE_TLS_VERSION
#ifdef HAVE_TLS_VERSION
if (version == "1.0")
{
return CURL_SSLVERSION_TLSv1_0;
Expand All @@ -456,14 +456,14 @@ static long parse_min_ssl_version(std::string version)
{
return CURL_SSLVERSION_TLSv1_3;
}
# endif
#endif

return 0;
}

static long parse_max_ssl_version(std::string version)
{
# ifdef HAVE_TLS_VERSION
#ifdef HAVE_TLS_VERSION
if (version == "1.0")
{
return CURL_SSLVERSION_MAX_TLSv1_0;
Expand All @@ -483,7 +483,7 @@ static long parse_max_ssl_version(std::string version)
{
return CURL_SSLVERSION_MAX_TLSv1_3;
}
# endif
#endif

return 0;
}
Expand Down Expand Up @@ -611,7 +611,7 @@ CURLcode HttpOperation::Setup()
}
else if (!ssl_options_.ssl_ca_cert_string.empty())
{
# if LIBCURL_VERSION_NUM >= CURL_VERSION_BITS(7, 77, 0)
#if LIBCURL_VERSION_NUM >= CURL_VERSION_BITS(7, 77, 0)
const char *data = ssl_options_.ssl_ca_cert_string.c_str();
size_t data_len = ssl_options_.ssl_ca_cert_string.length();

Expand All @@ -625,11 +625,11 @@ CURLcode HttpOperation::Setup()
{
return rc;
}
# else
#else
// CURL 7.77.0 required for CURLOPT_CAINFO_BLOB.
OTEL_INTERNAL_LOG_ERROR("CURL 7.77.0 required for CA CERT STRING");
return CURLE_UNKNOWN_OPTION;
# endif
#endif
}

/* 2 - CLIENT KEY */
Expand All @@ -652,7 +652,7 @@ CURLcode HttpOperation::Setup()
}
else if (!ssl_options_.ssl_client_key_string.empty())
{
# if LIBCURL_VERSION_NUM >= CURL_VERSION_BITS(7, 71, 0)
#if LIBCURL_VERSION_NUM >= CURL_VERSION_BITS(7, 71, 0)
const char *data = ssl_options_.ssl_client_key_string.c_str();
size_t data_len = ssl_options_.ssl_client_key_string.length();

Expand All @@ -672,11 +672,11 @@ CURLcode HttpOperation::Setup()
{
return rc;
}
# else
#else
// CURL 7.71.0 required for CURLOPT_SSLKEY_BLOB.
OTEL_INTERNAL_LOG_ERROR("CURL 7.71.0 required for CLIENT KEY STRING");
return CURLE_UNKNOWN_OPTION;
# endif
#endif
}

/* 3 - CLIENT CERT */
Expand All @@ -699,7 +699,7 @@ CURLcode HttpOperation::Setup()
}
else if (!ssl_options_.ssl_client_cert_string.empty())
{
# if LIBCURL_VERSION_NUM >= CURL_VERSION_BITS(7, 71, 0)
#if LIBCURL_VERSION_NUM >= CURL_VERSION_BITS(7, 71, 0)
const char *data = ssl_options_.ssl_client_cert_string.c_str();
size_t data_len = ssl_options_.ssl_client_cert_string.length();

Expand All @@ -719,11 +719,11 @@ CURLcode HttpOperation::Setup()
{
return rc;
}
# else
#else
// CURL 7.71.0 required for CURLOPT_SSLCERT_BLOB.
OTEL_INTERNAL_LOG_ERROR("CURL 7.71.0 required for CLIENT CERT STRING");
return CURLE_UNKNOWN_OPTION;
# endif
#endif
}

/* 4 - TLS */
Expand All @@ -732,36 +732,36 @@ CURLcode HttpOperation::Setup()

if (!ssl_options_.ssl_min_tls.empty())
{
# ifdef HAVE_TLS_VERSION
#ifdef HAVE_TLS_VERSION
min_ssl_version = parse_min_ssl_version(ssl_options_.ssl_min_tls);

if (min_ssl_version == 0)
{
OTEL_INTERNAL_LOG_ERROR("Unknown min TLS version <" << ssl_options_.ssl_min_tls << ">");
return CURLE_UNKNOWN_OPTION;
}
# else
#else
OTEL_INTERNAL_LOG_ERROR("CURL 7.54.0 required for MIN TLS");
return CURLE_UNKNOWN_OPTION;
# endif
#endif
}

long max_ssl_version = 0;

if (!ssl_options_.ssl_max_tls.empty())
{
# ifdef HAVE_TLS_VERSION
#ifdef HAVE_TLS_VERSION
max_ssl_version = parse_max_ssl_version(ssl_options_.ssl_max_tls);

if (max_ssl_version == 0)
{
OTEL_INTERNAL_LOG_ERROR("Unknown max TLS version <" << ssl_options_.ssl_max_tls << ">");
return CURLE_UNKNOWN_OPTION;
}
# else
#else
OTEL_INTERNAL_LOG_ERROR("CURL 7.54.0 required for MAX TLS");
return CURLE_UNKNOWN_OPTION;
# endif
#endif
}

long version_range = min_ssl_version | max_ssl_version;
Expand Down Expand Up @@ -790,16 +790,16 @@ CURLcode HttpOperation::Setup()

if (!ssl_options_.ssl_cipher_suite.empty())
{
# if LIBCURL_VERSION_NUM >= CURL_VERSION_BITS(7, 61, 0)
#if LIBCURL_VERSION_NUM >= CURL_VERSION_BITS(7, 61, 0)
/* TLS 1.3 */
const char *cipher_list = ssl_options_.ssl_cipher_suite.c_str();

rc = SetCurlStrOption(CURLOPT_TLS13_CIPHERS, cipher_list);
# else
#else
// CURL 7.61.0 required for CURLOPT_TLS13_CIPHERS.
OTEL_INTERNAL_LOG_ERROR("CURL 7.61.0 required for CIPHER SUITE");
return CURLE_UNKNOWN_OPTION;
# endif
#endif

if (rc != CURLE_OK)
{
Expand Down
15 changes: 6 additions & 9 deletions ext/test/http/curl_http_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -300,19 +300,16 @@ TEST_F(BasicCurlHttpTests, CurlHttpOperations)
http_client::Headers headers = {
{"name1", "value1_1"}, {"name1", "value1_2"}, {"name2", "value3"}, {"name3", "value3"}};

curl::HttpOperation http_operations1(http_client::Method::Head, "/get",
no_ssl,
handler, headers, body, true);
curl::HttpOperation http_operations1(http_client::Method::Head, "/get", no_ssl, handler, headers,
body, true);
http_operations1.Send();

curl::HttpOperation http_operations2(http_client::Method::Get, "/get",
no_ssl,
handler, headers, body, true);
curl::HttpOperation http_operations2(http_client::Method::Get, "/get", no_ssl, handler, headers,
body, true);
http_operations2.Send();

curl::HttpOperation http_operations3(http_client::Method::Get, "/get",
no_ssl,
handler, headers, body, false);
curl::HttpOperation http_operations3(http_client::Method::Get, "/get", no_ssl, handler, headers,
body, false);
http_operations3.Send();
delete handler;
}
Expand Down

0 comments on commit 862b728

Please sign in to comment.