cURL / Mailing Lists / curl-library / Single Mail


Re: libcurl putting empty file on Mac OS X

From: Daniel Stenberg <>
Date: Wed, 17 Dec 2003 10:49:04 +0100 (CET)

On Tue, 16 Dec 2003, Josh Anon wrote:

> 0000: PUT / HTTP/1.1
> 0018: User-Agent: curl/7.10.2 (powerpc-apple-darwin7.0) libcurl/7.10.2
> 0058: OpenSSL/0.9.7b zlib/1.1.4
> 008a: Pragma: no-cache
> 009c: Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*
> 00de: Content-Length: 13131
> and the output from the included program is:

> DBG: PUT / HTTP/1.1
> Pragma: no-cache
> Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*

Now, this is an interesting difference. There's no Content-Length: header here
in the log from your program! It should be.

> curl_easy_setopt(curl, CURLOPT_INFILESIZE, ftell(inFile));

I doubt this works on any platform. ftell() returns the "seek position" in the
file so far, and this will be 0 in this case. Setting a zero byte file size is
not a good idea here!

    Daniel Stenberg -- --
   [[ Do not send mails to this email address. They won't reach me. ]]
This email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now!
Received on 2003-12-17