Skip to contentSkip to conversation

qemu-img / curl: When fetching Content-Size use GET instead of HEAD.

PATCH New Boris Schrijver 1 participant 1 message Dec 11, 2015 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 qemu-img / curl: When fetching Content-Size use GET instead of HEAD.

A server can respond different to both methods, or can block one of the two.

---
V2: Impovements over V1:
- Don't check for CURLE_WRITE_ERROR, on success CURLE_OK will be returned.
- Use CURLOPT_CUSTOMREQUEST instead of CURLOPT_HTTPGET.

---
 block/curl.c | 1 +
 1 file changed, 1 insertion(+)
block/curl.c +1 -0
index 8994182..1677d0c 100644
@@ -598,6 +598,7 @@ static int curl_open(BlockDriverState *bs, QDict *options, int flags,
     curl_easy_setopt(state->curl, CURLOPT_HEADERFUNCTION,
                      curl_header_cb);
     curl_easy_setopt(state->curl, CURLOPT_HEADERDATA, s);
+    curl_easy_setopt(state->curl, CURLOPT_CUSTOMREQUEST, "GET");
     if (curl_easy_perform(state->curl))
         goto out;
     curl_easy_getinfo(state->curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &d);
Signature · 1 line
2.1.4