Req #52679 [Asn->Opn]: Content-length header is limited to 32bit integer
Edit report at https://bugs.php.net/bug.php?id=52679&edit=1
ID: 52679
Updated by: kalle@php.net
Reported by: dominic dot benson at thirdlight dot com
Summary: Content-length header is limited to 32bit integer
-Status: Assigned
+Status: Open
Type: Feature/Change Request
Package: Apache2 related
Operating System: Linux 32
PHP Version: 5.3.3
-Assigned To: pajoye
+Assigned To:
Block user comment: N
Private report: N
Previous Comments:
------------------------------------------------------------------------
[2010-08-24 13:32:56] pajoye@php.net
Exactly, will add it while testing the other fix (which works on windows 32/64 and linux 64 only so
far) more carefully.
------------------------------------------------------------------------
[2010-08-24 13:17:02] johannes@php.net
strtoll is not portable. We need something like in http://lxr.php.net/opengrok/xref/PHP_5_3/ext/date/lib/parse_date.re#36
to define it. Probably php-src/main/ should declare a php_strtoll or so. (Didn't take a closer
look at the issue)
------------------------------------------------------------------------
[2010-08-23 21:49:56] dominic dot benson at thirdlight dot com
Correction to the above - clearly I mean strtol and strtoll rather than strtocol and strtocoll.
------------------------------------------------------------------------
[2010-08-23 21:24:32] dominic dot benson at thirdlight dot com
Description:
------------
As per #51723, the content-length header is limited to 2GB - however it need not be.
If Apache 2.2 is built with -DLARGEFILE_SOURCE -DFILE_OFFSET_BITS=64 then apr_off_t is an off64_t,
however the conversion in the calls to ap_set_content_length uses strtocol (hence limited to the
32-bit long on Linux 32), but if strtocoll is used instead to return a 64-bit long long, the header
is set correctly for values > 2GB.
The attached patch is of the adjustment, I guess the configure script generation needs to be updated
to establish whether apr_off_t is long or long long.
Test script:
---------------
<?php
header("Content-Length: 10000000000");
?>
Expected result:
----------------
A header:
Content-Length: 10000000000
Actual result:
--------------
A header:
Content-Length: 2147483647
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=52679&edit=1
Thread (6 messages)