]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
pull-job: use http_status_etag_exists() at a second place
authorLennart Poettering <lennart@poettering.net>
Thu, 6 Nov 2025 08:32:22 +0000 (09:32 +0100)
committerLennart Poettering <lennart@poettering.net>
Sat, 8 Nov 2025 08:28:50 +0000 (09:28 +0100)
src/import/pull-job.c

index 98849a104c46d7a226ab0f0d639526060a6c3a83..1945106099d0bb02889fd67fb3ae4e4e2c801d24 100644 (file)
 #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;