Skip to content

Commit d0b8589

Browse files
committed
Version guard for callback
1 parent 78f9a0b commit d0b8589

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -649,6 +649,15 @@ CURLcode HttpOperation::Setup()
649649
curl_error_message_[0] = '\0';
650650
curl_easy_setopt(curl_resource_.easy_handle, CURLOPT_ERRORBUFFER, curl_error_message_);
651651

652+
// Support for custom debug function callback was added in version 7.9.6 so we guard against
653+
// exposing the default CURL output by keeping verbosity always disabled in lower versions.
654+
#if LIBCURL_VERSION_NUM < CURL_VERSION_BITS(7, 9, 6)
655+
rc = SetCurlLongOption(CURLOPT_VERBOSE, 0L);
656+
if (rc != CURLE_OK)
657+
{
658+
return rc;
659+
}
660+
#else
652661
rc = SetCurlLongOption(CURLOPT_VERBOSE, static_cast<long>(needs_to_log_ || kEnableCurlLogging));
653662
if (rc != CURLE_OK)
654663
{
@@ -661,6 +670,7 @@ CURLcode HttpOperation::Setup()
661670
{
662671
return rc;
663672
}
673+
#endif
664674

665675
// Specify target URL
666676
rc = SetCurlStrOption(CURLOPT_URL, url_.c_str());

0 commit comments

Comments
 (0)