Skip to content

Commit

Permalink
Fixes #2175
Browse files Browse the repository at this point in the history
  • Loading branch information
marcalff committed Jun 5, 2023
1 parent 834c0c4 commit 74305b8
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
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

0 comments on commit 74305b8

Please sign in to comment.