From: Lennart Poettering Date: Thu, 6 Nov 2025 08:32:22 +0000 (+0100) Subject: pull-job: use http_status_etag_exists() at a second place X-Git-Tag: v259-rc1~127^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=33f49312f8c02d1692df7eb2f73cc4b598c96fda;p=thirdparty%2Fsystemd.git pull-job: use http_status_etag_exists() at a second place --- diff --git a/src/import/pull-job.c b/src/import/pull-job.c index 98849a104c4..1945106099d 100644 --- a/src/import/pull-job.c +++ b/src/import/pull-job.c @@ -20,6 +20,16 @@ #include "time-util.h" #include "xattr-util.h" +static int http_status_ok(CURLcode status) { + /* Consider all HTTP status code in the 2xx range as OK */ + return status >= 200 && status <= 299; +} + +static int http_status_etag_exists(CURLcode status) { + /* This one is special, it's triggered by our etag mgmt logic */ + return status == 304; +} + void pull_job_close_disk_fd(PullJob *j) { if (!j) return; @@ -178,7 +188,7 @@ void pull_job_curl_on_finished(CurlGlue *g, CURL *curl, CURLcode result) { goto finish; } - if (status == 304) { + if (http_status_etag_exists(status)) { log_info("Image already downloaded. Skipping download."); j->etag_exists = true; r = 0; @@ -545,16 +555,6 @@ fail: return 0; } -static int http_status_ok(CURLcode status) { - /* Consider all HTTP status code in the 2xx range as OK */ - return status >= 200 && status <= 299; -} - -static int http_status_etag_exists(CURLcode status) { - /* This one is special, it's triggered by our etag mgmt logic */ - return status == 304; -} - static size_t pull_job_header_callback(void *contents, size_t size, size_t nmemb, void *userdata) { _cleanup_free_ char *length = NULL, *last_modified = NULL, *etag = NULL; size_t sz = size * nmemb;