Bug #51723 [Asn]: Content-length header is limited to 32bit integer

2010-05-03 Thread anatoli at adt dot ee
Edit report at http://bugs.php.net/bug.php?id=51723edit=1

 ID:   51723
 User updated by:  anatoli at adt dot ee
 Reported by:  anatoli at adt dot ee
 Summary:  Content-length header is limited to 32bit integer
 Status:   Assigned
 Type: Bug
 Package:  Apache2 related
 Operating System: vista 32
 PHP Version:  5.2.13
 Assigned To:  pajoye

 New Comment:

Ok, now i got the point. Yes i really missed that long in windows is
always 32bit by default and as i remember in 64bit windows it is also
limited to 32bit. There must be used long long type, but i am not sure
that this is possible.

But anyway thanks.


Previous Comments:

[2010-05-03 02:33:51] paj...@php.net

Do i must provide here code that allow downloads for files till 8Gb
with multiple threads and resume support, witch is working under unix
cgi, and not under win32 sapi?



No, thanks.



Does it work with apache on unix as well? If yes, is it a 64bit or 32bit
machine?



The problem could be still the 32bit limitation as the apache2 SAPI
replaces the headers with the correct length using strtol, which
converts a string to a long. A long is always 32bit on Windows.



I will check that code, needs some tweak on Windows (no luck I think on
unix 32bit).


[2010-05-03 01:50:11] anatoli at adt dot ee

The problem is not in the filesize. Headers was checked with the latest
wireshark. Under the cgi i receive correct header. Under sapi not. Do i
must provide here code that allow downloads for files till 8Gb with
multiple threads and resume support, witch is working under unix cgi,
and not under win32 sapi? I redused test case to exactly minimum amount
of code needed to reproduce error.


[2010-05-03 01:41:29] paj...@php.net

The header is correctly sent without modification (you can verify that
using cgi in the console). However PHP does not support large file
support and only 2^31 bytes are read and sent.



There is already a feature request for LFS  mark this one as duplicated
(bogus).


[2010-05-03 00:58:57] anatoli at adt dot ee

Description:

Content-length header is limited to 32bit integer on wista 32 systems
under apache 2 sapi.

header(Content-Length: 2967901695);

Expected on client - Content-Length: 2967901695

Actual - Content-Length: 2147483647

Test script:
---
?php

header($_SERVER['SERVER_PROTOCOL'].' 200 OK');

header('Accept-Ranges: bytes');

header('Content-Type: application/octet-stream');

header('Content-Disposition: attachment; filename=test.txt');

header(Content-Transfer-Encoding: binary);

header(Content-Length: 2967901695);

header('Connection: close');

//we open file with size exactly 2967901695 bytes

$fp = fopen(somefile.name, 'rb');

fpassthru($fp);

?

Expected result:

Content-Length: 2967901695

Actual result:
--
Content-Length: 2147483647






-- 
Edit this bug report at http://bugs.php.net/bug.php?id=51723edit=1


Bug #51723 [Asn]: Content-length header is limited to 32bit integer

2010-05-03 Thread anatoli at adt dot ee
Edit report at http://bugs.php.net/bug.php?id=51723edit=1

 ID:   51723
 User updated by:  anatoli at adt dot ee
 Reported by:  anatoli at adt dot ee
 Summary:  Content-length header is limited to 32bit integer
 Status:   Assigned
 Type: Bug
 Package:  Apache2 related
 Operating System: vista 32
 PHP Version:  5.2.13
 Assigned To:  pajoye

 New Comment:

Was not able to find 32bit unix/linux system.

Tested on 64bit both cgi and apache sapi - working, content-type header
data is correct.


Previous Comments:

[2010-05-03 10:31:39] anatoli at adt dot ee

Ok, now i got the point. Yes i really missed that long in windows is
always 32bit by default and as i remember in 64bit windows it is also
limited to 32bit. There must be used long long type, but i am not sure
that this is possible.

But anyway thanks.


[2010-05-03 02:33:51] paj...@php.net

Do i must provide here code that allow downloads for files till 8Gb
with multiple threads and resume support, witch is working under unix
cgi, and not under win32 sapi?



No, thanks.



Does it work with apache on unix as well? If yes, is it a 64bit or 32bit
machine?



The problem could be still the 32bit limitation as the apache2 SAPI
replaces the headers with the correct length using strtol, which
converts a string to a long. A long is always 32bit on Windows.



I will check that code, needs some tweak on Windows (no luck I think on
unix 32bit).


[2010-05-03 01:50:11] anatoli at adt dot ee

The problem is not in the filesize. Headers was checked with the latest
wireshark. Under the cgi i receive correct header. Under sapi not. Do i
must provide here code that allow downloads for files till 8Gb with
multiple threads and resume support, witch is working under unix cgi,
and not under win32 sapi? I redused test case to exactly minimum amount
of code needed to reproduce error.


[2010-05-03 01:41:29] paj...@php.net

The header is correctly sent without modification (you can verify that
using cgi in the console). However PHP does not support large file
support and only 2^31 bytes are read and sent.



There is already a feature request for LFS  mark this one as duplicated
(bogus).


[2010-05-03 00:58:57] anatoli at adt dot ee

Description:

Content-length header is limited to 32bit integer on wista 32 systems
under apache 2 sapi.

header(Content-Length: 2967901695);

Expected on client - Content-Length: 2967901695

Actual - Content-Length: 2147483647

Test script:
---
?php

header($_SERVER['SERVER_PROTOCOL'].' 200 OK');

header('Accept-Ranges: bytes');

header('Content-Type: application/octet-stream');

header('Content-Disposition: attachment; filename=test.txt');

header(Content-Transfer-Encoding: binary);

header(Content-Length: 2967901695);

header('Connection: close');

//we open file with size exactly 2967901695 bytes

$fp = fopen(somefile.name, 'rb');

fpassthru($fp);

?

Expected result:

Content-Length: 2967901695

Actual result:
--
Content-Length: 2147483647






-- 
Edit this bug report at http://bugs.php.net/bug.php?id=51723edit=1


Bug #51723 [Asn]: Content-length header is limited to 32bit integer

2010-05-03 Thread pajoye
Edit report at http://bugs.php.net/bug.php?id=51723edit=1

 ID:   51723
 Updated by:   paj...@php.net
 Reported by:  anatoli at adt dot ee
 Summary:  Content-length header is limited to 32bit integer
 Status:   Assigned
 Type: Bug
 Package:  Apache2 related
 Operating System: vista 32
 PHP Version:  5.2.13
 Assigned To:  pajoye

 New Comment:

Windows 64bit is not always limited to 32bit if the correct type are
used (__int64  co).



About unix, that's the same reason. Long is 64bit on 64bit linux while
being 32bit on 32bit linux. As I will fix this problem on windows, it
won't ever work on 32bit linux, but that's not really an issue as it
never worked on these old systems.


Previous Comments:

[2010-05-03 10:40:54] anatoli at adt dot ee

Was not able to find 32bit unix/linux system.

Tested on 64bit both cgi and apache sapi - working, content-type header
data is correct.


[2010-05-03 10:31:39] anatoli at adt dot ee

Ok, now i got the point. Yes i really missed that long in windows is
always 32bit by default and as i remember in 64bit windows it is also
limited to 32bit. There must be used long long type, but i am not sure
that this is possible.

But anyway thanks.


[2010-05-03 02:33:51] paj...@php.net

Do i must provide here code that allow downloads for files till 8Gb
with multiple threads and resume support, witch is working under unix
cgi, and not under win32 sapi?



No, thanks.



Does it work with apache on unix as well? If yes, is it a 64bit or 32bit
machine?



The problem could be still the 32bit limitation as the apache2 SAPI
replaces the headers with the correct length using strtol, which
converts a string to a long. A long is always 32bit on Windows.



I will check that code, needs some tweak on Windows (no luck I think on
unix 32bit).


[2010-05-03 01:50:11] anatoli at adt dot ee

The problem is not in the filesize. Headers was checked with the latest
wireshark. Under the cgi i receive correct header. Under sapi not. Do i
must provide here code that allow downloads for files till 8Gb with
multiple threads and resume support, witch is working under unix cgi,
and not under win32 sapi? I redused test case to exactly minimum amount
of code needed to reproduce error.


[2010-05-03 01:41:29] paj...@php.net

The header is correctly sent without modification (you can verify that
using cgi in the console). However PHP does not support large file
support and only 2^31 bytes are read and sent.



There is already a feature request for LFS  mark this one as duplicated
(bogus).




The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

http://bugs.php.net/bug.php?id=51723


-- 
Edit this bug report at http://bugs.php.net/bug.php?id=51723edit=1