Lower libcurl requirement further still

This allows us to build on Ubuntu 16.04!
This commit is contained in:
Richard Hughes 2020-12-11 16:20:19 +00:00
parent a14de30153
commit c0d4c09a02
2 changed files with 16 additions and 1 deletions

View File

@ -65,7 +65,9 @@ typedef struct {
typedef struct {
CURL *curl;
#ifdef HAVE_LIBCURL_7_56_0
curl_mime *mime;
#endif
struct curl_slist *headers;
} FwupdCurlHelper;
@ -106,8 +108,10 @@ fwupd_client_curl_helper_free (FwupdCurlHelper *helper)
{
if (helper->curl != NULL)
curl_easy_cleanup (helper->curl);
#ifdef HAVE_LIBCURL_7_56_0
if (helper->mime != NULL)
curl_mime_free (helper->mime);
#endif
if (helper->headers != NULL)
curl_slist_free_all (helper->headers);
g_free (helper);
@ -4263,6 +4267,7 @@ fwupd_client_upload_bytes_async (FwupdClient *self,
/* build message */
if ((flags & FWUPD_CLIENT_UPLOAD_FLAG_ALWAYS_MULTIPART) > 0 ||
signature != NULL) {
#ifdef HAVE_LIBCURL_7_56_0
curl_mimepart *part;
helper->mime = curl_mime_init (helper->curl);
curl_easy_setopt (helper->curl, CURLOPT_MIMEPOST, helper->mime);
@ -4274,6 +4279,13 @@ fwupd_client_upload_bytes_async (FwupdClient *self,
curl_mime_data (part, signature, CURL_ZERO_TERMINATED);
curl_mime_name (part, "signature");
}
#else
g_task_return_new_error (task,
FWUPD_ERROR,
FWUPD_ERROR_INTERNAL,
"not supported as libcurl is too old");
return;
#endif
} else {
helper->headers = curl_slist_append (helper->headers, "Content-Type: text/plain");
curl_easy_setopt (helper->curl, CURLOPT_HTTPHEADER, helper->headers);

View File

@ -213,7 +213,10 @@ endif
libjcat = dependency('jcat', version : '>= 0.1.0', fallback : ['libjcat', 'libjcat_dep'])
libjsonglib = dependency('json-glib-1.0', version : '>= 1.1.1')
valgrind = dependency('valgrind', required: false)
libcurl = dependency('libcurl', version : '>= 7.61.0')
libcurl = dependency('libcurl', version : '>= 7.47.0')
if libcurl.version().version_compare('>= 7.56.0')
conf.set('HAVE_LIBCURL_7_56_0', '1')
endif
if libcurl.version().version_compare('>= 7.62.0')
conf.set('HAVE_LIBCURL_7_62_0', '1')
endif