qemu-img / curl: When fetching Content-Size use GET instead of HEAD.
A message that is not in the archive (sent off-list or not yet received): [email protected]
[adding qemu-devel; per http://wiki.qemu.org/Contribute/SubmitAPatch,
ALL patches must include qemu-devel, even if they are also copying other sublists]
Quoted 25 lines · Boris Schrijver
A server can respond different to both methods, or can block one of the two.
Signed-off-by Boris Schrijver <[email protected]>Reviewed-by John Snow <[email protected]>---
V2: Impovements over V1:
- Don't check forCURLE_WRITE_ERROR, on successCURLE_OKwill be returned.
- UseCURLOPT_CUSTOMREQUESTinstead ofCURLOPT_HTTPGET.--- block/curl.c | 1 + 1 file changed, 1 insertion(+)block/curl.c +1
-0@@ -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 · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org