@@ -576,18 +576,18 @@ int HttpOperation::CurlLoggerCallback(const CURL * /* handle */,
576
576
size_t size,
577
577
void * /* clientp */ ) noexcept
578
578
{
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};
583
580
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 ]))
586
582
{
587
583
return 0 ;
588
584
}
589
- else if (type == CURLINFO_TEXT)
585
+
586
+ if (type == CURLINFO_TEXT)
590
587
{
588
+ static const auto kTlsInfo = nostd::string_view (" SSL connection using" );
589
+ static const auto kFailureMsg = nostd::string_view (" Recv failure:" );
590
+
591
591
if (text_to_log.substr (0 , kTlsInfo .size ()) == kTlsInfo )
592
592
{
593
593
OTEL_INTERNAL_LOG_INFO (text_to_log);
@@ -606,9 +606,13 @@ int HttpOperation::CurlLoggerCallback(const CURL * /* handle */,
606
606
#ifdef CURL_DEBUG
607
607
else if (type == CURLINFO_HEADER_OUT)
608
608
{
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 ]))
610
612
{
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)
612
616
{
613
617
OTEL_INTERNAL_LOG_DEBUG (kHeaderSent << text_to_log.substr (0 , pos));
614
618
text_to_log = text_to_log.substr (pos + 1 );
@@ -617,6 +621,7 @@ int HttpOperation::CurlLoggerCallback(const CURL * /* handle */,
617
621
}
618
622
else if (type == CURLINFO_HEADER_IN)
619
623
{
624
+ static const auto kHeaderRecv = nostd::string_view (" Recv header => " );
620
625
OTEL_INTERNAL_LOG_DEBUG (kHeaderRecv << text_to_log);
621
626
}
622
627
#endif // CURL_DEBUG
0 commit comments