MT#55283 fix compilation for older libcurl

Debian stretch has an old libcurl which doesn't support MIMEPOST.
Disable the entire feature if libcurl is too old.

Change-Id: Id1d2a4d821671142523af355188f21ff06ad20f1
pull/1623/head
Richard Fuchs 2 years ago
parent a75d55444b
commit aa0ccae1d7

@ -15,6 +15,7 @@
#include <mysql.h>
#include <pwd.h>
#include <grp.h>
#include <curl/curl.h>
#include "log.h"
#include "epoll.h"
#include "inotify.h"
@ -219,7 +220,9 @@ static void options(int *argc, char ***argv) {
{ "notify-no-verify", 0, 0, G_OPTION_ARG_NONE, &notify_nverify,"Don't verify HTTPS peer certificate", NULL },
{ "notify-concurrency", 0, 0, G_OPTION_ARG_INT, &notify_threads,"How many simultaneous requests", "INT" },
{ "notify-retries", 0, 0, G_OPTION_ARG_INT, &notify_retries,"How many times to retry failed requesets","INT" },
#if CURL_AT_LEAST_VERSION(7,56,0)
{ "notify-record", 0, 0, G_OPTION_ARG_NONE, &notify_record, "Also attach recorded file to request", NULL },
#endif
{ NULL, }
};

@ -41,7 +41,9 @@ static void do_notify(void *p, void *u) {
// set up the CURL request
#if CURL_AT_LEAST_VERSION(7,56,0)
curl_mime *mime = NULL;
#endif
CURL *c = curl_easy_init();
if (!c)
goto fail;
@ -97,6 +99,7 @@ static void do_notify(void *p, void *u) {
goto fail;
}
#if CURL_AT_LEAST_VERSION(7,56,0)
if (notify_record) {
err = "initializing curl mime&part";
curl_mimepart *part;
@ -112,6 +115,7 @@ static void do_notify(void *p, void *u) {
if (ret != CURLE_OK)
goto fail;
}
#endif
err = "performing request";
ret = curl_easy_perform(c);
@ -180,8 +184,10 @@ cleanup:
if (c)
curl_easy_cleanup(c);
#if CURL_AT_LEAST_VERSION(7,56,0)
if (mime)
curl_mime_free(mime);
#endif
curl_slist_free_all(req->headers);
g_free(req->name);

Loading…
Cancel
Save