cURL / Mailing Lists / curl-library / Single Mail

curl-library

7.16.0 regression with large files

From: Toby Peterson <toby_at_apple.com>
Date: Wed, 10 Jan 2007 19:34:37 -0800

Hello,

There appears to be a regression in 7.16.0 when downloading large
files. Essentially, on a file larger than 4GB, it cuts off with
exactly 4GB remaining. Here's the (edited) output:

$ curl -vO https://.........
[snipped SSL spew]
> GET XXXXXX.dmg HTTP/1.1
> Authorization: Basic XXXXXX
> User-Agent: curl/7.16.0 (i386-unknown-freebsd6.2) libcurl/7.16.0
OpenSSL/0.9.7e zlib/1.2.3
> Host: XXXXXXXX
> Accept: */*
>
< HTTP/1.1 200 OK
< Date: Thu, 11 Jan 2007 03:11:37 GMT
< Server: Apache/2.0.55 (Unix) mod_ssl/2.0.55 OpenSSL/0.9.7i mod_perl/
2.0.1 Perl/v5.8.6
< Last-Modified: Tue, 09 Jan 2007 21:44:17 GMT
< ETag: "2e0269e-4555d328-72a7ce40"
< Accept-Ranges: bytes
< Content-Length: 5458219816
< Content-Type: application/octet-stream
   % Total % Received % Xferd Average Speed Time Time
Time Current
                                  Dload Upload Total Spent
Left Speed
   0 5205M 0 0 0 0 0 0 --:--:-- --:--:--
--:--:-- 0{ [data not shown]
21 5205M 21 1101M 0 0 11.0M 0 0:07:51 0:01:39
0:06:12 11.0M* transfer closed with 4294967296 bytes remaining to read
21 5205M 21 1109M 0 0 11.0M 0 0:07:51 0:01:40
0:06:11 11.0M
curl: (18) transfer closed with 4294967296 bytes remaining to read
* Closing connection #0
* SSLv3, TLS alert, Client hello (1):
} [data not shown]

This works fine with 7.15.5. Can reproduce the issue on Mac OS X and
FreeBSD. Seems like an off-by-one error, though I can't seem to track
it down. The last hunk in the following patch is a bit suspicious:

http://cool.haxx.se/cvs.cgi/curl/lib/sendf.c.diff?
r2=1.111&r1=1.110&diff_format=u

What particularly confuses me is Curl_readwrite() in transfer.c stops
reading if (0 >= nread), meaning that Curl_read() "succeeds" when
nread == 0, but Curl_readwrite() "fails". Anyway, I hope this is
sufficient information to resolve the issue.

- Toby
Received on 2007-01-11