cURL / Mailing Lists / curl-library / Single Mail

curl-library

HTTP GET method without body

From: Boris Schrijver <boris_at_pcextreme.nl>
Date: Wed, 9 Dec 2015 18:01:43 +0100 (CET)

Dear libcurl dev-team!

I was trying out a few things in qemu-img, a virtualisation utility which
depends on libcurl. And with the signed-urls recently becoming more common, I
stumbled upon the following issue. The signed-urls I will be talking about are
for S3 [1].

A signed-url can have it's HTTP method be included in the signature, so a
signed-url with the GET method included in it's signature, when used by a HTTP
HEAD method will return a 403 forbidden.

Program's like qemu-img will want to first get the Content-Length. Normally this
would mean a HEAD request. But that's not possible, hence the signed-url.

What I basically want is: curl -X GET -I http://random.url/object

I tried to implement it in qemu-img [2] but ended up always getting a
CURLE_WRITE_ERROR, due to the body not being written anywhere.

Is it possible to include a curl_easy_setopt() option to discard the response
body and stop the connection after the HEADER? So that the curl_easy_perform()
will still return 0 on success, and we don't need to check for a
CURLE_WRITE_ERROR?

[1]
http://docs.aws.amazon.com/AmazonS3/latest/dev/RESTAuthentication.html#ConstructingTheAuthenticationHeader
[2] https://lists.nongnu.org/archive/html/qemu-devel/2015-12/msg01131.html

-- 

Met vriendelijke groet / Kind regards,

Boris Schrijver

PCextreme B.V.

http://www.pcextreme.nl/contact
Tel direct: +31 (0) 118 700 215

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2015-12-09