From: Michael Tremer Date: Wed, 1 Nov 2023 19:05:10 +0000 (+0000) Subject: xfer: Fail on any HTTP return codes >= 400 X-Git-Tag: 0.9.30~1324 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4d49c00be90fb9aec720e2d4f507d5007299a27e;p=pakfire.git xfer: Fail on any HTTP return codes >= 400 Signed-off-by: Michael Tremer --- diff --git a/src/libpakfire/xfer.c b/src/libpakfire/xfer.c index b277ac8bc..dee5f7e85 100644 --- a/src/libpakfire/xfer.c +++ b/src/libpakfire/xfer.c @@ -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);