curl-library
RE: Regarding the problem I am getting in the HTTP PUT Request usinglibcurl
From: Daniel Stenberg <daniel_at_haxx.se>
Date: Fri, 28 Mar 2008 12:09:28 +0100 (CET)
Date: Fri, 28 Mar 2008 12:09:28 +0100 (CET)
On Fri, 28 Mar 2008, Venkataragavan Vijayakumar, TLS-Chennai wrote:
> Yes now I changed my callback to return 0 and also
But returning zero always is plain wrong as well.
> But if i not set the file size means, the put request is going to the
> server with the content having value null.
It does?
> static size_t read_callback(void *ptr, size_t size, size_t nmemb, void
> **userp)
> {
> ptr = malloc (sizeof (char)* strlen((const char*)userp)+1);
> strcpy (ptr, (const char*)userp);
> return 0;
This is a memory leak and doesn't work. The read callback gets told how much
data it wants at most, and you should copy data to the "ptr" buffer. See the
examples source codes for inspirations.
-- Commercial curl and libcurl Technical Support: http://haxx.se/curl.htmlReceived on 2008-03-28