cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Is it possible to avoid memcpy when doing http PUT from memory buffer

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Fri, 15 Jan 2016 14:48:40 +0100 (CET)

On Fri, 15 Jan 2016, JOHAN LANTZ wrote:

> When doing a PUT, then in the read_callback I copy the data into the buffer
> provided by curl like this:

...

> Out of curiosity, if I know my buffer is valid until the transfer finishes,
> is there a way to avoid this memcpy and just tell curl the address of the
> data to be PUT?

You can actually use CURLOPT_POSTFIELDS to point to your buffer and then use
CURLOPT_CUSTOMREQUEST to make it a PUT instead of POST and that should be at
least almost what you're asking for...

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2016-01-15