summaryrefslogtreecommitdiff
path: root/desktop/source/minidump
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2023-01-08 14:08:53 +0100
committerJulien Nabet <serval2412@yahoo.fr>2023-01-08 14:46:10 +0000
commit5c4fa7ddb0b12d30304bbc6119a0aa1d3d65b55d (patch)
tree2e91bf1cff1ad615345ef273bdf7ce9da80fca5f /desktop/source/minidump
parenta9a90f92eec3375f85b3c4dcadc44e3dc2fe7dac (diff)
Fix deprecated Curl elements for minidump part
Change-Id: I43df411eed24e86f5d72982b5d24188e0cb7e507 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145177 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Diffstat (limited to 'desktop/source/minidump')
-rw-r--r--desktop/source/minidump/minidump.cxx34
1 files changed, 13 insertions, 21 deletions
diff --git a/desktop/source/minidump/minidump.cxx b/desktop/source/minidump/minidump.cxx
index b6f52251206b..0bf20f2aa419 100644
--- a/desktop/source/minidump/minidump.cxx
+++ b/desktop/source/minidump/minidump.cxx
@@ -132,27 +132,21 @@ static bool uploadContent(std::map<std::string, std::string>& parameters, std::s
if (!ca_certificate_file.empty())
curl_easy_setopt(curl, CURLOPT_CAINFO, ca_certificate_file.c_str());
- curl_httppost* formpost = nullptr;
- curl_httppost* lastptr = nullptr;
+ curl_mime* mime = curl_mime_init(curl);
std::string additional_data = generate_json(parameters);
- curl_formadd(&formpost, &lastptr,
- CURLFORM_COPYNAME, "AdditionalData",
- CURLFORM_COPYCONTENTS, additional_data.c_str(),
- CURLFORM_END);
+ curl_mimepart* part = curl_mime_addpart(mime);
+ curl_mime_name(part, "AdditionalData");
+ curl_mime_data(part, additional_data.c_str(), CURL_ZERO_TERMINATED);
- curl_formadd(&formpost, &lastptr,
- CURLFORM_COPYNAME, "Version",
- CURLFORM_COPYCONTENTS, version.c_str(),
- CURLFORM_END);
+ part = curl_mime_addpart(mime);
+ curl_mime_name(part, "Version");
+ curl_mime_data(part, version.c_str(), CURL_ZERO_TERMINATED);
- std::string response_body;
- long response_code;
- curl_formadd(&formpost, &lastptr,
- CURLFORM_COPYNAME, "upload_file_minidump",
- CURLFORM_FILE, file.c_str(),
- CURLFORM_END);
+ part = curl_mime_addpart(mime);
+ curl_mime_name(part, "upload_file_minidump");
+ curl_mime_filedata(part, file.c_str());
- curl_easy_setopt(curl, CURLOPT_HTTPPOST, formpost);
+ curl_easy_setopt(curl, CURLOPT_MIMEPOST, mime);
// Disable 100-continue header.
@@ -162,6 +156,7 @@ static bool uploadContent(std::map<std::string, std::string>& parameters, std::s
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headerlist);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
+ std::string response_body;
curl_easy_setopt(curl, CURLOPT_WRITEDATA,
static_cast<void *>(&response_body));
@@ -169,6 +164,7 @@ static bool uploadContent(std::map<std::string, std::string>& parameters, std::s
curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1);
CURLcode cc = curl_easy_perform(curl);
+ long response_code;
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &response_code);
SAL_WARN_IF(cc != CURLE_OK, "desktop",
"Failed to send http request to " <<
@@ -176,10 +172,6 @@ static bool uploadContent(std::map<std::string, std::string>& parameters, std::s
", error: " <<
curl_easy_strerror(cc));
- if (formpost != nullptr)
- {
- curl_formfree(formpost);
- }
if (headerlist != nullptr)
{
curl_slist_free_all(headerlist);