#47825 [Bgs]: POST Data being ignored
| From: | tiposchi at tiscali dot it | Date: | Tue, 31 Mar 2009 09:31:53 +0000 |
| Subject: | #47825 [Bgs]: POST Data being ignored | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-135383@lists.php.net to get a copy of this message | ||
ID: 47825
User updated by: tiposchi at tiscali dot it
Reported By: tiposchi at tiscali dot it
Status: Bogus
Bug Type: CGI related
Operating System: GNU/Linux
PHP Version: 5.2.9
New Comment:
The bug is about the incorrect handling of data from pipe. I guess you
do a simple read, when you should do multiple reads until you've all the
data the webserver says the client sent (using the envvar
CONTENT_LENGTH) or until the read returns 0.
This is not a support request. The bug is about poor cgi
implementation.
Previous Comments:
------------------------------------------------------------------------
[2009-03-31 07:10:45] jani@php.net
Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions. Due to the volume
of reports we can not explain in detail here why your report is not
a bug. The support channels will be able to provide an explanation
for you.
Thank you for your interest in PHP.
------------------------------------------------------------------------
[2009-03-29 09:32:38] tiposchi at tiscali dot it
Description:
------------
CGI protocol says that POST data must be passed to the script using
its standard input.
So what i have to do is something like (see the attached code).
Anyway, the php knows how long the input will be because it has an
environmental variable called content length that says it.
So php should wait to read the entire post data before going on.
Since i don't have any information about how the scheduler works, i
can't assure the father process to fill the pipe before the child is
scheduled.
But php ignores the data if the pipe isn't full already. So what i
did was filling the pipe BEFORE the fork, and doing this it works.
But there is another problem. With large POST data, the buffer is
filled and the OS puts my process on wait until the pipe is empty by
another process. But i didn't start the php yet because it wants all
the post data already present, so the webserver just hangs.
I think you should review the way php-cgi reads post data.
Thanks
Reproduce code:
---------------
p=pipe()
if (fork()==0) {
close(STDIN)
dup(p)
exec ("php")
} else {
write(p,str_post)
wait()
}
I HAVE MADE THE CODE SIMPLE. I KNOW THIS CAN'T WORK.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=47825&edit=1