Skip to content

Commit b2e4069

Browse files
committed
Fix PR pipeline errors
1 parent ae15206 commit b2e4069

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

ext/src/http/client/curl/http_operation_curl.cc

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -576,18 +576,18 @@ int HttpOperation::CurlLoggerCallback(const CURL * /* handle */,
576576
size_t size,
577577
void * /* clientp */) noexcept
578578
{
579-
static const auto kTlsInfo = nostd::string_view("SSL connection using");
580-
static const auto kFailureMsg = nostd::string_view("Recv failure:");
581-
static const auto kHeaderSent = nostd::string_view("Send header => ");
582-
static const auto kHeaderRecv = nostd::string_view("Recv header => ");
579+
nostd::string_view text_to_log{data, size};
583580

584-
if (nostd::string_view text_to_log{data, size};
585-
text_to_log.empty() || std::isspace(text_to_log[0]))
581+
if (text_to_log.empty() || std::iscntrl(text_to_log[0]))
586582
{
587583
return 0;
588584
}
589-
else if (type == CURLINFO_TEXT)
585+
586+
if (type == CURLINFO_TEXT)
590587
{
588+
static const auto kTlsInfo = nostd::string_view("SSL connection using");
589+
static const auto kFailureMsg = nostd::string_view("Recv failure:");
590+
591591
if (text_to_log.substr(0, kTlsInfo.size()) == kTlsInfo)
592592
{
593593
OTEL_INTERNAL_LOG_INFO(text_to_log);
@@ -606,9 +606,13 @@ int HttpOperation::CurlLoggerCallback(const CURL * /* handle */,
606606
#ifdef CURL_DEBUG
607607
else if (type == CURLINFO_HEADER_OUT)
608608
{
609-
while (!text_to_log.empty() && !std::isspace(text_to_log[0]))
609+
static const auto kHeaderSent = nostd::string_view("Send header => ");
610+
611+
while (!text_to_log.empty() && !std::iscntrl(text_to_log[0]))
610612
{
611-
if (const auto pos = text_to_log.find('\n'); pos != nostd::string_view::npos)
613+
const auto pos = text_to_log.find('\n');
614+
615+
if (pos != nostd::string_view::npos)
612616
{
613617
OTEL_INTERNAL_LOG_DEBUG(kHeaderSent << text_to_log.substr(0, pos));
614618
text_to_log = text_to_log.substr(pos + 1);
@@ -617,6 +621,7 @@ int HttpOperation::CurlLoggerCallback(const CURL * /* handle */,
617621
}
618622
else if (type == CURLINFO_HEADER_IN)
619623
{
624+
static const auto kHeaderRecv = nostd::string_view("Recv header => ");
620625
OTEL_INTERNAL_LOG_DEBUG(kHeaderRecv << text_to_log);
621626
}
622627
#endif // CURL_DEBUG

0 commit comments

Comments
 (0)