cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: HTTP PUT request, without a file.

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Thu, 9 Aug 2007 09:21:51 +0200 (CEST)

On Wed, 8 Aug 2007, Dan Fandrich wrote:

> Set the pointer to your buffer (or a struct containing that pointer and a
> length) using curl_easy_setopt(CURLOPT_PRIVATE,...), then set a simple read
> callback function which uses that pointer to pass in the data when
> requested.

That pointer is even nicer set with CURLOPT_READDATA...

An alternative approach to this, is to use CURLOPT_POSTFIELDS to set a string,
and then use CURLOPT_CUSTOMREQUEST to set a "PUT" instead of POST. Possibly
you'd also want to change/disable the content-type and expect headers if you
go with this approach.

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2007-08-09