From:             roguestar191 at comcast dot net
Operating system: linux
PHP version:      5.1.4
PHP Bug Type:     CGI related
Bug description:  recv in fastcgi never returns when server doesn't pad to size 
of 8

Description:
------------
line 624 of sapi/cgi/fastcgi.c contains:

while (recv(req->fd, buf, strlen(buf), 0) > 0) {}

with buf being an array with 8 elements.

With the server doesn't pad all packets to the size of 8 

(Which is suggested but not required by the fast-cgi spec), this causes
frequent lockups and failed requests. (Without that padding, I have no
idea about with it).

My fix was simple - change strlen(buf) (which returns 8), to 1, so it will
read any excess bytes at the end and cleanly close and continue on, even if
it's not a multiple of 8 bytes.  

Thank you for php!

Expected result:
----------------
fast-cgi padding to be read and thrown out, requests to close.

Actual result:
--------------
request tends to lock up on recv when packets arn't a multiple of 8 in
size.

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

Reply via email to