From: Michael Tremer Date: Thu, 26 Jun 2025 17:52:25 +0000 (+0000) Subject: xfer: Remove pakfire_xfer_add_param X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=932da1117c96f4f273faa766af8ad27431dd02a0;p=pakfire.git xfer: Remove pakfire_xfer_add_param We don't send any multipart-encoded form things any more. Signed-off-by: Michael Tremer --- diff --git a/src/pakfire/xfer.c b/src/pakfire/xfer.c index 065a304a..9ea92977 100644 --- a/src/pakfire/xfer.c +++ b/src/pakfire/xfer.c @@ -66,9 +66,6 @@ struct pakfire_xfer { // GET Query Arguments char** queries; - // POST MIME Object - curl_mime* mime; - // POST Payload char* payload; @@ -174,8 +171,6 @@ static void pakfire_xfer_free(struct pakfire_xfer* xfer) { curl_easy_cleanup(xfer->handle); if (xfer->headers) curl_slist_free_all(xfer->headers); - if (xfer->mime) - curl_mime_free(xfer->mime); if (xfer->fullurl) curl_url_cleanup(xfer->fullurl); @@ -647,66 +642,6 @@ int pakfire_xfer_add_query(struct pakfire_xfer* xfer, return r; } -int pakfire_xfer_add_param(struct pakfire_xfer* xfer, - const char* key, const char* format, ...) { - curl_mimepart* part = NULL; - char* buffer = NULL; - va_list args; - int r; - - // Allocate the MIME object if not done, yet - if (!xfer->mime) { - xfer->mime = curl_mime_init(xfer->handle); - - if (!xfer->mime) { - ERROR(xfer->ctx, "Could not allocate the MIME object: %s\n", - strerror(errno)); - r = -errno; - goto ERROR; - } - } - - // Format value - va_start(args, format); - r = vasprintf(&buffer, format, args); - va_end(args); - - // Abort if we could not format the value - if (r < 0) - goto ERROR; - - // Allocate another MIME part - part = curl_mime_addpart(xfer->mime); - if (!part) { - ERROR(xfer->ctx, "Could not allocate MIME part: %s\n", - strerror(errno)); - r = errno; - goto ERROR; - } - - // Set the key - r = curl_mime_name(part, key); - if (r) { - ERROR(xfer->ctx, "Could not set parameter key (%s): %s\n", - key, curl_easy_strerror(r)); - goto ERROR; - } - - // Set the data - r = curl_mime_data(part, buffer, CURL_ZERO_TERMINATED); - if (r) { - ERROR(xfer->ctx, "Could not set parameter data (%s): %s\n", - key, curl_easy_strerror(r)); - goto ERROR; - } - -ERROR: - if (buffer) - free(buffer); - - return r; -} - int pakfire_xfer_set_payload(struct pakfire_xfer* self, const char* payload) { if (self->payload) { free(self->payload); @@ -1764,15 +1699,6 @@ int pakfire_xfer_prepare(struct pakfire_xfer* xfer, struct pakfire_progress* pro } } - // Add any payload - if (xfer->mime) { - r = curl_easy_setopt(xfer->handle, CURLOPT_MIMEPOST, xfer->mime); - if (r) { - ERROR(xfer->ctx, "Could not set POST payload: %s\n", curl_easy_strerror(r)); - return r; - } - } - // Add any payload if (xfer->payload) { r = curl_easy_setopt(xfer->handle, CURLOPT_POSTFIELDS, xfer->payload); diff --git a/src/pakfire/xfer.h b/src/pakfire/xfer.h index ca6ad710..7cfd136e 100644 --- a/src/pakfire/xfer.h +++ b/src/pakfire/xfer.h @@ -117,8 +117,6 @@ int pakfire_xfer_add_header(struct pakfire_xfer* self, const char* format, ...) __attribute__((format(printf, 2, 3))); int pakfire_xfer_add_query(struct pakfire_xfer* xfer, const char* key, const char* format, ...) __attribute__((format(printf, 3, 4))); -int pakfire_xfer_add_param(struct pakfire_xfer* xfer, - const char* key, const char* format, ...) __attribute__((format(printf, 3, 4))); // Payload int pakfire_xfer_set_payload(struct pakfire_xfer* self, const char* payload);