apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shantonu Sen <s...@apple.com>
Subject Re: atol
Date Wed, 24 Jul 2002 16:58:29 GMT

On Wed, 24 Jul 2002, Wilfredo Sanchez wrote:

>    There are several places in HTTPD where we use atol to parse ranges
> from HTTP headers.  Problem (at least on Darwin) is that a long is
> smaller than size_t, and we're unable to handle large files in the 2-4GB
> range.

Also smaller than an off_t (for platforms where it's a 64-bit quantity and
a long isn't), which is the issue the patches directly address. For
platforms where an off_t is a 32-bit quantity, or a long is a 64-bit
quantity, or both, the compiler will do the right thing in assigning a
64-bit rval to a 32-bit lval, which is better than the currect situation
of a 32-bit rval to a 64-bit lval (for those platforms with support it).

Supporting HEAD requests even of files >4GB seems to have another problem
where the file size is being reported as 2^31 (I know, that's out of
bounds for a signed 32-bit number, so something else is afoot), which is
why the patches don't unlock serving of larger files with HTTP/1.1 partial

> It uses strtoll is available, otherwise falls back to
> strtol.

I did not feel comfortable pulling over the strtoll(3) implementation from
Darwin or FreeBSD (they are the same) without doing more investigation
about how portable *their* implementation is. I've verified that
strtoll(3) exists at least on Darwin 5.5, Darwin 6.0 (aka Mac OS X 10.2
"Jaguar"), FreeBSD 4.6, and Solaris 8, which seems like a broad enough
cross section of operating systems to make the "use it if you got it"
approach reasonable.

Shantonu Sen
Apple Computer, Inc.

View raw message