cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: libcurl putting empty file on Mac OS X

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

On Tue, 16 Dec 2003, Josh Anon wrote:

> 0000: PUT /test.mov 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
> 0074: Host: IP_ADDRESS_HIDDEN
> 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 /test.mov HTTP/1.1
> Host: IP_ADDRESS_HIDDEN
> 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 -- http://curl.haxx.se/ -- http://daniel.haxx.se/
   [[ Do not send mails to this email address. They won't reach me. ]]
-------------------------------------------------------
This SF.net 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! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
Received on 2003-12-17