From 4d49c00be90fb9aec720e2d4f507d5007299a27e Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Wed, 1 Nov 2023 19:05:10 +0000 Subject: [PATCH] xfer: Fail on any HTTP return codes >= 400 Signed-off-by: Michael Tremer --- src/libpakfire/xfer.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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); -- 2.47.2