Received: from eggs.gnu.org ([2001:4830:134:3::10]:55833) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a7OYK-0006Pt-8f for qemu-devel@nongnu.org; Fri, 11 Dec 2015 09:20:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a7OYG-0002Ud-DX for qemu-devel@nongnu.org; Fri, 11 Dec 2015 09:20:08 -0500 From: Boris Schrijver Date: Fri, 11 Dec 2015 15:19:46 +0100 Message-Id: <1449843586-5197-1-git-send-email-boris@pcextreme.nl> Subject: [Qemu-devel] [PATCH V2] qemu-img / curl: When fetching Content-Size use GET instead of HEAD. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-block@nongnu.org Cc: jcody@redhat.com, jsnow@redhat.com, qemu-devel@nongnu.org, Boris Schrijver A server can respond different to both methods, or can block one of the two. Signed-off-by: Boris Schrijver Reviewed-by: John Snow --- 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(+) diff --git a/block/curl.c b/block/curl.c index 8994182..1677d0c 100644 --- a/block/curl.c +++ b/block/curl.c @@ -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); -- 2.1.4