diff options
author | Nikita Popov <nikic@php.net> | 2017-01-07 22:51:18 +0100 |
---|---|---|
committer | Nikita Popov <nikic@php.net> | 2017-01-07 22:53:28 +0100 |
commit | a46bbdda2e082070bd67ecdc500d9671bf1ab823 (patch) | |
tree | c8701843bd722c0d9b5bd08caf165f4b26fac161 | |
parent | f346bd6ee6a9eecb3666071d3afd30216439367d (diff) | |
download | php-git-a46bbdda2e082070bd67ecdc500d9671bf1ab823.tar.gz |
Fixed bug #67583
As fcgi_request is an opaque struct as of PHP 7, expose a new API
function fcgi_end() which does fcgi_flush() with end=1 and checks/
sets the ->ended flag.
-rw-r--r-- | NEWS | 4 | ||||
-rw-r--r-- | main/fastcgi.c | 14 | ||||
-rw-r--r-- | main/fastcgi.h | 1 | ||||
-rw-r--r-- | sapi/fpm/fpm/fpm_main.c | 3 |
4 files changed, 16 insertions, 6 deletions
@@ -2,6 +2,10 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? 2017 PHP 7.0.16 +- FPM: + . Fixed bug #67583 (double fastcgi_end_request on max_children limit). + (Dmitry Saprykin) + - OpenSSL: . Fixed bug #71519 (add serial hex to return value array). (xrobau) diff --git a/main/fastcgi.c b/main/fastcgi.c index c52d222df5..dd7c7ddeb9 100644 --- a/main/fastcgi.c +++ b/main/fastcgi.c @@ -1645,15 +1645,21 @@ int fcgi_write(fcgi_request *req, fcgi_request_type type, const char *str, int l return len; } +int fcgi_end(fcgi_request *req) { + int ret = 1; + if (!req->ended) { + ret = fcgi_flush(req, 1); + req->ended = 1; + } + return ret; +} + int fcgi_finish_request(fcgi_request *req, int force_close) { int ret = 1; if (req->fd >= 0) { - if (!req->ended) { - ret = fcgi_flush(req, 1); - req->ended = 1; - } + ret = fcgi_end(req); fcgi_close(req, force_close, 1); } return ret; diff --git a/main/fastcgi.h b/main/fastcgi.h index fbc70c31cf..bba64016d8 100644 --- a/main/fastcgi.h +++ b/main/fastcgi.h @@ -119,6 +119,7 @@ int fcgi_read(fcgi_request *req, char *str, int len); int fcgi_write(fcgi_request *req, fcgi_request_type type, const char *str, int len); int fcgi_flush(fcgi_request *req, int end); +int fcgi_end(fcgi_request *req); #ifdef PHP_WIN32 void fcgi_impersonate(void); diff --git a/sapi/fpm/fpm/fpm_main.c b/sapi/fpm/fpm/fpm_main.c index 5e09877eef..3ab92b3070 100644 --- a/sapi/fpm/fpm/fpm_main.c +++ b/sapi/fpm/fpm/fpm_main.c @@ -1533,11 +1533,10 @@ PHP_FUNCTION(fastcgi_finish_request) /* {{{ */ fcgi_request *request = (fcgi_request*) SG(server_context); if (!fcgi_is_closed(request)) { - php_output_end_all(); php_header(); - fcgi_flush(request, 1); + fcgi_end(request); fcgi_close(request, 0, 0); RETURN_TRUE; } |