cURL / Mailing Lists / curl-library / Single Mail


Re: HTTP GET method without body

From: Boris Schrijver <>
Date: Wed, 9 Dec 2015 23:31:43 +0100 (CET)

Dear Daniel,

Using --libcurl test.c helped out a lot! Thanks!

It showed me that I could use an option I wasn't aware of [1]. In combination
with [2] it got me what I wanted!

I would like to thank you for responding so promptly!

[1] curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
[2] curl_easy_setopt(hnd, CURLOPT_NOBODY, 1L);


Met vriendelijke groet / Kind regards,

Boris Schrijver

PCextreme B.V.
Tel direct: +31 (0) 118 700 215

> On December 9, 2015 at 11:10 PM Daniel Stenberg <> wrote:
> On Wed, 9 Dec 2015, Boris Schrijver wrote:
> > What I basically want is: curl -X GET -I http://random.url/object
> Append "--libcurl test.c" on that command line and you'll see how to write
> code for it. Although I suspect you may confuse libcurl a bit by doing that so
> the next request on the same connection will probably first have to detect
> that there's pending data which will make think it died, then close the
> connection and create a new one.
> > 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.
> That's because you cut off the response and that makes it a transfer error.
> There's no way around that.
> But you can easily set a flag or something before you return that error that
> cuts off the body, and then when you see CURLE_WRITE_ERROR you check if that
> flag was set and then you know it was on purpose. Done!
> > Is it possible to include a curl_easy_setopt() option to discard the
> > response
> > body and stop the connection after the HEADER?
> Nope. And I don't see the point in adding such an option either, as you can
> easily implement this yourself as described above.
> --
> /
> -------------------------------------------------------------------
> List admin:
> Etiquette:

List admin:
Received on 2015-12-09