]> git.ipfire.org Git - pakfire.git/commitdiff
xfer: Fail on any HTTP return codes >= 400
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 1 Nov 2023 19:05:10 +0000 (19:05 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 1 Nov 2023 19:05:10 +0000 (19:05 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/xfer.c

index b277ac8bca099a61747fdb0c71c39f9f4b2ae1b6..dee5f7e8566a2c88c78bed7c39598cc37d7e049c 100644 (file)
@@ -253,6 +253,11 @@ static int pakfire_xfer_setup(struct pakfire_xfer* xfer) {
        // Limit protocols to HTTPS, HTTP, FTP and FILE
        curl_easy_setopt(xfer->handle, CURLOPT_PROTOCOLS_STR, "HTTPS,HTTP,FTP,FILE");
 
+       // Raise any HTTP errors
+       r = curl_easy_setopt(xfer->handle, CURLOPT_FAILONERROR, 1L);
+       if (r)
+               goto ERROR;
+
        // Allow all support encodings
        curl_easy_setopt(xfer->handle, CURLOPT_ACCEPT_ENCODING, "");
 
@@ -283,7 +288,7 @@ static int pakfire_xfer_setup(struct pakfire_xfer* xfer) {
        // Success
        r = 0;
 
-       // Cleanup
+ERROR:
        if (config)
                pakfire_config_unref(config);