cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: HTTP GET

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Fri, 25 Aug 2006 09:16:02 +0200 (CEST)

On Thu, 24 Aug 2006, Sonia Subramanian wrote:

> 1. If I don't provide a call back function and just use WRITEDATA and pass
> in a FILE* (-fopen with wb) I get a write failure. Would you please let me
> know if I am using this correctly?

On windows using libcurl as DLL you can do that, but otherwise that it should
work just fine.

> 2. If I use the NOBODY option the header content gets dumped on the screen.

NOBODY doesn't change where the contents are directed.

> If I use the HEADERFUNCTION option where the function does something like
>
> int headget(void *buffer, size_t size, size_t nmemb, void *stream)
> {

...

> if(strncmp("Content-Length:",bufferc,15) == 0)
> size = atoi(bufferc+16);

> return size*nmemb;

By changing 'size' you return a different value and by not returning the same
value that was passed in to the callback you told libcurl there was an error
in your callback. This is documented.

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