Skip to contentSkip to conversation

block/curl: drop old/unuspported curl version checks

PATCH In review Michael Tokarev 2 participants 2 messages Aug 25, 2025 – Aug 26, 2025 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 block/curl: drop old/unuspported curl version checks

We currently require libcurl >=7.29.0 (since f9cd86fe72be3cd8). Drop older LIBCURL_VERSION_NUM checks from the driver.

---
v2: drop the right #if/#else block, thank you Marcus!

 block/curl.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)
block/curl.c +1 -12
index 00b949ea45..e0f98e035a 100644
@@ -516,7 +516,7 @@ static int curl_init_state(BDRVCURLState *s, CURLState *state)
                              CURLOPT_REDIR_PROTOCOLS_STR, PROTOCOLS)) {
             goto err;
         }
-#elif LIBCURL_VERSION_NUM >= 0x071304
+#else
         if (curl_easy_setopt(state->curl, CURLOPT_PROTOCOLS, PROTOCOLS) ||
             curl_easy_setopt(state->curl, CURLOPT_REDIR_PROTOCOLS, PROTOCOLS)) {
             goto err;
@@ -821,22 +821,11 @@ static int curl_open(BlockDriverState *bs, QDict *options, int flags,
         goto out;
     }
 #endif
-    /* Prior CURL 7.19.4 return value of 0 could mean that the file size is not
-     * know or the size is zero. From 7.19.4 CURL returns -1 if size is not
-     * known and zero if it is really zero-length file. */
-#if LIBCURL_VERSION_NUM >= 0x071304
     if (cl < 0) {
         pstrcpy(state->errmsg, CURL_ERROR_SIZE,
                 "Server didn't report file size.");
         goto out;
     }
-#else
-    if (cl <= 0) {
-        pstrcpy(state->errmsg, CURL_ERROR_SIZE,
-                "Unknown file size or zero-length file.");
-        goto out;
-    }
-#endif
 
     s->len = cl;
 
Signature · 1 line
2.47.2
Reviewed-by on v2 1/1
#1 lore raw
Quoted 9 lines · Michael Tokarev

We currently require libcurl >=7.29.0 (since f9cd86fe72be3cd8). Drop older LIBCURL_VERSION_NUM checks from the driver.

---
v2: drop the right #if/#else block, thank you Marcus!

 block/curl.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|