diff options
author | Dmitry Stogov <dmitry@php.net> | 2010-08-25 13:48:16 +0000 |
---|---|---|
committer | Dmitry Stogov <dmitry@php.net> | 2010-08-25 13:48:16 +0000 |
commit | d663b9cc774f0667203c383da5c6408b68209086 (patch) | |
tree | 407b00f4de0ce8be23530624f43e2d8252c19d5a /sapi/cgi/fastcgi.c | |
parent | 7fc86e5cb49be6e5d88f466b2035ea8e9a563554 (diff) | |
download | php-git-d663b9cc774f0667203c383da5c6408b68209086.tar.gz |
Don't try to read the rest of malformed FCGI requests, close immediately. It saves one recv() call for proper FCGI request.
Diffstat (limited to 'sapi/cgi/fastcgi.c')
-rw-r--r-- | sapi/cgi/fastcgi.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/sapi/cgi/fastcgi.c b/sapi/cgi/fastcgi.c index e5fefb08cf..8d2d7a32cb 100644 --- a/sapi/cgi/fastcgi.c +++ b/sapi/cgi/fastcgi.c @@ -1084,19 +1084,21 @@ static inline void fcgi_close(fcgi_request *req, int force, int destroy) DisconnectNamedPipe(pipe); } else { if (!force) { - char buf[8]; + fcgi_header buf; shutdown(req->fd, 1); - while (recv(req->fd, buf, sizeof(buf), 0) > 0) {} + /* read the last FCGI_STDIN header (it may be omitted) */ + recv(req->fd, &buf, sizeof(buf), 0); } closesocket(req->fd); } #else if (!force) { - char buf[8]; + fcgi_header buf; shutdown(req->fd, 1); - while (recv(req->fd, buf, sizeof(buf), 0) > 0) {} + /* read the last FCGI_STDIN header (it may be omitted) */ + recv(req->fd, &buf, sizeof(buf), 0); } close(req->fd); #endif |