curl / Mailing Lists / curl-library / Single Mail

curl-library

Re: HTTP PUT Without Callbacks

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Thu, 23 Feb 2017 11:46:55 +0100 (CET)

On Wed, 22 Feb 2017, corey kasten wrote:

> Is there a way to control the number of bytes that the curl engine will
> request when it calls my read_callback, which, if there were, I could return
> all the data in one callback invocation allowing me to not have to keep
> state of the offset?

No.

> Am I right that I would have to do things this way?

You can also opt to use CURLOPT_POSTFIELDS and just set CURLOPT_CUSTOMREQUEST
to "PUT"... (which works fine as long as you need libcurl to follow redirects
for you as well).

> If so, does it work this way because of some inherent difference between
> HTTP POST and HTTP PUT that allows the simpler interface for POST
> (CURLOPT_POSTFIELDS + CURLOPT_POSTFIELDSIZE) than the PUT requiring a
> read_callback?

It works like that simply because HTTP PUT is generally made for "file upload"
so the API is more focused on such a use case.

> If not, would you consider feature request to allow PUT to be supported by
> the same type of interface with which POST is supported (in addition to the
> current interface for PUT)?

I wouldn't mind seeing that supported withot having to use
CURLOPT_CUSTOMREQUEST, no.

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html
Received on 2017-02-23