Bug #60826 [Nab]: raw POST data missing with chunked encoding, FastCGI

From: Date: Thu, 27 Feb 2020 17:50:32 +0000
Subject: Bug #60826 [Nab]: raw POST data missing with chunked encoding, FastCGI
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-225757@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=60826&edit=1 ID: 60826 Updated by: cmb@php.net Reported by: clarkwise at gmail dot com Summary: raw POST data missing with chunked encoding, FastCGI Status: Not a bug Type: Bug Package: CGI/CLI related Operating System: Windows XP PHP Version: 5.3.9 Assigned To: ab Block user comment: N Private report: N New Comment: In a strict sense this is indeed not a PHP bug, because the CGI specification (which is only informational, though), mandates[1]: | As transfer-codings are not supported on the request-body, the | server MUST remove any such codings from the message-body, and | recalculate the CONTENT_LENGTH. If this is not possible (for | example, because of large buffering requirements), the server | SHOULD reject the client request. However, even though this is not done by IIS, its behavior still appears to be reasonable, since it acknowledges the `Expect: 100-continue header by immediately responding with HTTP/1.1 100 Continue`, and then calls php-cgi.exe with CONTENT_LENGTH=-1 and makes the full payload available on stdin. So it seems the (F)CGI SAPI *could* support chunked uploads in combination with IIS. I have attached iis-cgi-chunked-poc as *PoC* for IIS and CGI only (not FCGI). [1] <https://tools.ietf.org/html/rfc3875#section-4.1.2> Previous Comments: ------------------------------------------------------------------------ [2020-02-27 17:50:23] cmb@php.net The following patch has been added/updated: Patch Name: iis-cgi-chunked-poc Revision: 1582825823 URL: https://bugs.php.net/patch-display.php?bug=60826&patch=iis-cgi-chunked-poc&revision=1582825823 ------------------------------------------------------------------------ [2018-02-05 09:03:17] sukarsa at ingenovie dot com Hi, Is there any solution to request with chunked encoding with php? I observe that server is waiting indefinitely until client time-out and then process the packet with empty body. I'm using php 7.2 and I think it still have this problem. ------------------------------------------------------------------------ [2016-06-27 23:47:45] ravikumar dot nie at gmail dot com Well I am still facing this problem. Any hints to solve this issue. I am using fastcgi and php and trying to read the POST Data sent as transfer-encoding:chunked. Appreciate any help ------------------------------------------------------------------------ [2012-08-17 08:12:43] ab@php.net at the end of the day, this is not a php bug ------------------------------------------------------------------------ [2012-05-30 21:10:19] dominic dot benson at thirdlight dot com For Apache mod_fcgid, I have a patch available in the bug I filed at https://issues.apache.org/bugzilla/show_bug.cgi?id=53332 Essentially, PHP is following the spec, and not reading beyond the FastCGI CONTENT_LENGTH header value - so correct fixes are necessarily above PHP, in the FastCGI or web server implementation. ------------------------------------------------------------------------ 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 https://bugs.php.net/bug.php?id=60826 -- Edit this bug report at https://bugs.php.net/bug.php?id=60826&edit=1

« previous php.bugs (#225757) next »