Edit report at https://bugs.php.net/bug.php?id=60826&edit=1
ID: 60826
Comment by: florian dot fernandez at navaho dot fr
Reported by: clarkwise at gmail dot com
Summary: raw POST data missing with chunked encoding, FastCGI
Status: Assigned
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:
Sorry, I didn't see it before. I'll give it a try with 5.4.0
Previous Comments:
------------------------------------------------------------------------
[2012-04-23 08:00:32] andres at fenestrae dot com
florian dot fernandez at navaho dot fr
I have been able to try my solution in combination with 5.2.17.
See the patches in this topic for the exact code-changes I made.
------------------------------------------------------------------------
[2012-04-23 07:52:12] florian dot fernandez at navaho dot fr
@ andres at fenestrae dot com
Have you been able to try what you suggested in your last post ?
------------------------------------------------------------------------
[2012-04-11 13:24:05] andres at fenestrae dot com
The problem lies in php-cgi.exe.
I have been able to reproduce the problem on IIS 7.5.
In Fast-cgi the data is delivered using method similar to chunking.
In case of "Transfer-Encoding: chunked" IIS supplies Content-length:-1 in the
request data, which is casted to uint in sapi_cgi_read_post. Causing the
routine to read data until it has read the full 4G (2^32-1).
Also, both the methods sapi_cgi_read_post(cgi_main.c) and fcgi_read(fastcgi.c)
try to read the complete buffer time after time, causing the end-marker
(0-sized chunk) only to be seen when it would be at buffer-boundary. However
the sapi_cgi_read_post funtion is called several times after the actual content
has been read causing the fcgi_read method to block.
I expect similar cause to apply for apache.
Solution appears
1) do not loop in fcgi_read; this way when reading the final marker, it is
returned to the calling code.
2) Set SG(request_info).content_length to SG(read_post_bytes) + read_bytes when
tmp_read_bytes ==0 && SG(request_info).content_length == -1
------------------------------------------------------------------------
[2012-04-03 13:02:34] florian dot fernandez at navaho dot fr
@ab at php dot net
Unfortunately, I won't be able to test with nginx because the system
administrators won't let me install it (Only Apache is allowed). Sorry for the
inconvenience. I'll try to open a new bug on Apache bug list or mod_fcigd bug
list if I find it : maybe they'll look into it.
------------------------------------------------------------------------
[2012-03-27 20:26:14] clarkwise at gmail dot com
I finally got my hands on Windows Server 2008 running IIS 7.0.
Same problem; when POST request is chunked, the response times out.
Perhaps I'm missing a setting that would enable the receipt of
chunked incoming requests, but I have only read about settings
that chunk the outgoing response.
------------------------------------------------------------------------
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