Edit report at http://bugs.php.net/bug.php?id=51191&edit=1
ID: 51191 User updated by: evert at rooftopsolutions dot nl Reported by: evert at rooftopsolutions dot nl Summary: Request body is 0-size when chunked requests are used Status: Open Type: Feature/Change Request Package: Apache2 related Operating System: * PHP Version: 5.3.1 Block user comment: N New Comment: I can confirm this is only happening for CGI and FastCGI. Nginx and Lighttpd don't seem to support this feature at all, and simply return 411 Length Required, but with Apache the request goes through but PHP ends up with an empty request body. Previous Comments: ------------------------------------------------------------------------ [2010-08-04 08:05:38] jpa at php dot mail dot kapsi dot fi Here is a test case for the bug, using netcat to send the request: http://koti.kapsi.fi/~jpa/stuff/other/php-chunked-test.tgz A simple bash cgi script correctly receives the request, so the problem is with PHP's CGI and FCGI interfaces. Instead of requiring a CONTENT_LENGTH header, PHP should simply read to EOF on stdin when TRANSFER_ENCODING is chunked. ------------------------------------------------------------------------ [2010-03-03 05:55:23] evert at rooftopsolutions dot nl Description: ------------ Disclaimer: I'm not 100% sure if this is a PHP-FCGI bug. When (PUT-) HTTP requests are made and encoded as Transfer-Encoding: Chunked, PHP never receives the request body, e.g.: echo strlen(fopen('php://input','r')); will yield 0. Chunked Transfer Encoding is used by the OS/X Finder WebDAV client. It works correctly when mod_php is used, but fails with FastCGI. Nginx and Lighttpd don't support this at all, and return 411 Length Required, which still sucks, but is better than silently failing. Test script: --------------- echo strlen(fopen('php://input','r')); Expected result: ---------------- size of the request body Actual result: -------------- 0 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=51191&edit=1