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
Expand Up @@ -269,6 +269,8 @@ class HttpOperation

CURLcode SetCurlLongOption(CURLoption option, long value);

CURLcode SetCurlOffOption(CURLoption option, curl_off_t value);

const char *GetCurlErrorMessage(CURLcode code);

std::atomic<bool> is_aborted_; // Set to 'true' when async callback is aborted
Expand Down
22 changes: 21 additions & 1 deletion ext/src/http/client/curl/http_operation_curl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,26 @@ CURLcode HttpOperation::SetCurlLongOption(CURLoption option, long value)
return rc;
}

CURLcode HttpOperation::SetCurlOffOption(CURLoption option, curl_off_t value)
{
CURLcode rc;

/*
curl_easy_setopt() is a macro with variadic arguments, type unsafe.
SetCurlOffOption() ensures it is called with a curl_off_t.
*/
rc = curl_easy_setopt(curl_resource_.easy_handle, option, value);

if (rc != CURLE_OK)
{
const char *message = GetCurlErrorMessage(rc);
OTEL_INTERNAL_LOG_ERROR("CURL, set option <" << std::to_string(option) << "> failed: <"
<< message << ">");
}

return rc;
}

CURLcode HttpOperation::Setup()
{
if (!curl_resource_.easy_handle)
Expand Down Expand Up @@ -980,7 +1000,7 @@ CURLcode HttpOperation::Setup()
return rc;
}

rc = SetCurlLongOption(CURLOPT_POSTFIELDSIZE_LARGE, req_size);
rc = SetCurlOffOption(CURLOPT_POSTFIELDSIZE_LARGE, req_size);
if (rc != CURLE_OK)
{
return rc;
Expand Down