]> git.ipfire.org Git - pakfire.git/commitdiff
xfer: Remove pakfire_xfer_add_param
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 26 Jun 2025 17:52:25 +0000 (17:52 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 26 Jun 2025 17:53:31 +0000 (17:53 +0000)
We don't send any multipart-encoded form things any more.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/pakfire/xfer.c
src/pakfire/xfer.h

index 065a304a4966e8f8ea097b10ff346c83cd619ad1..9ea92977bbd44d117df57afe35aa26370b6d3f42 100644 (file)
@@ -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);
index ca6ad7107f87e70a666c524b6dc45599e9d5042d..7cfd136e962498be3af3cc68746453fcb37bedac 100644 (file)
@@ -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);