cURL / Mailing Lists / curl-library / Single Mail


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

From: Daniel Stenberg <>
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...

List admin:
Received on 2016-01-15