Skip to contentSkip to conversation

block/curl: Prefer URL in options over filename

PATCH In review Max Reitz 2 participants 2 messages Nov 26, 2016 – Nov 28, 2016 Block layer

lore
Share & tools
lore

Max Reitz

author
#0 lore raw

PATCH 1/1 block/curl: Prefer URL in options over filename

Currently, the curl block driver will replace any URL specified through the options QDict by a filename, if one has been given. However, the options QDict should generally take precedence, which is implemented by this patch.

---
Not really critical, so getting this into 2.9 is sufficient.

---
 block/curl.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
block/curl.c +3 -1
index 0404c1b..2e9a45c 100644
@@ -531,7 +531,9 @@ static void curl_clean_state(CURLState *s)
 static void curl_parse_filename(const char *filename, QDict *options,
                                 Error **errp)
 {
-    qdict_put(options, CURL_BLOCK_OPT_URL, qstring_from_str(filename));
+    if (!qdict_haskey(options, CURL_BLOCK_OPT_URL)) {
+        qdict_put(options, CURL_BLOCK_OPT_URL, qstring_from_str(filename));
+    }
 }
 
 static void curl_detach_aio_context(BlockDriverState *bs)
Signature · 1 line
2.10.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 31 lines · Max Reitz

Currently, the curl block driver will replace any URL specified through the options QDict by a filename, if one has been given. However, the options QDict should generally take precedence, which is implemented by this patch.

---
Not really critical, so getting this into 2.9 is sufficient.

---
 block/curl.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
block/curl.c +3 -1
index 0404c1b..2e9a45c 100644
@@ -531,7 +531,9 @@ static void curl_clean_state(CURLState *s)
 static void curl_parse_filename(const char *filename, QDict *options,
                                 Error **errp)
 {
-    qdict_put(options, CURL_BLOCK_OPT_URL, qstring_from_str(filename));
+    if (!qdict_haskey(options, CURL_BLOCK_OPT_URL)) {
+        qdict_put(options, CURL_BLOCK_OPT_URL, qstring_from_str(filename));
+    }
 }
 
 static void curl_detach_aio_context(BlockDriverState *bs)
Signature · 1 line
2.10.2