From:             djimenez at conduit-it dot com
Operating system: Ubuntu - gutsy gibbon
PHP version:      5.2.6
PHP Bug Type:     Apache2 related
Bug description:  Apache byterange output filter nullified if mod_php5 output > 
8000 bytes

Description:
------------
Apache2 supports byte range response with an output filter. Static files 
over 8000 bytes work fine, but mod_php5 served content only works 
correctly if it is <= 8000 bytes

To test I used telnet to submit an HTTP Range request for the included 
PHP file from an apache2 server configured with mod_php5. Example 
requests are in the actual results.






Reproduce code:
---------------
<?php

// upto and including 8000 bytes will allow the byterange filter to work
//
// NOTE: 8000 byte limit was found by manual trial and error, may vary per
system, but
// my guess would be it has to do with a byte buffer either in mod_php5 or
apache2
echo str_repeat(".", 8000);

// anything over 8000 bytes will "fail" (full response)
//echo "\n...one toke over the line";

?>

Expected result:
----------------
Apache's byterange output filter should handle range requests for PHP 
responses > 8000 bytes.





Actual result:
--------------
While the test scripts second echo is commented, I get the expected 
results:
 
$ telnet dev.conduit-it.com 80
Trying 10.42.84.2...
Connected to dev.conduit-it.com.
Escape character is '^]'.
GET /test.php HTTP/1.1
Host:dev.conduit-it.com
Range:bytes=0-24
Connection:close

HTTP/1.1 206 Partial Content
Date: Fri, 29 Aug 2008 03:43:20 GMT
Content-Range: bytes 0-24/8000
Content-Length: 25
Connection: close
Content-Type: text/html

.........................Connection closed by foreign host.

We can also see it working for multiple ranges:
  
$ telnet dev.conduit-it.com 80
Trying 10.42.84.2...
Connected to dev.conduit-it.com.
Escape character is '^]'.
GET /test.php HTTP/1.1
Host:dev.conduit-it.com
Range:bytes=0-24,50-74
Connection:close

HTTP/1.1 206 Partial Content
Date: Fri, 29 Aug 2008 03:45:44 GMT
Content-Length: 240
Connection: close
Content-Type: multipart/byteranges; boundary=455911696d6f354a2


--455911696d6f354a2
Content-type: text/html
Content-range: bytes 0-24/8000

.........................
--455911696d6f354a2
Content-type: text/html
Content-range: bytes 50-74/8000

.........................
--455911696d6f354a2--
Connection closed by foreign host.


So apache is doing all the work for us, until we uncomment the second 
echo statement in the repro. script. This puts us over the 8000 byte 
limit.  At that point, both example requests will return full 200 OK 
responses (so content is 8000 periods + our message)





-- 
Edit bug report at http://bugs.php.net/?id=45945&edit=1
-- 
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=45945&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): 
http://bugs.php.net/fix.php?id=45945&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=45945&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=45945&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=45945&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=45945&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=45945&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=45945&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=45945&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=45945&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=45945&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=45945&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=45945&r=globals
PHP 4 support discontinued:   http://bugs.php.net/fix.php?id=45945&r=php4
Daylight Savings:             http://bugs.php.net/fix.php?id=45945&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=45945&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=45945&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=45945&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=45945&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=45945&r=mysqlcfg

Reply via email to