com php-src: Fixed bug #67583: NEWS main/fastcgi.c main/fastcgi.h sapi/fpm/fpm/fpm_main.c
| From: | Nikita Popov | Date: | Sat, 07 Jan 2017 21:53:28 +0000 |
| Subject: | com php-src: Fixed bug #67583: NEWS main/fastcgi.c main/fastcgi.h sapi/fpm/fpm/fpm_main.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-96610@lists.php.net to get a copy of this message | ||
Commit: a46bbdda2e082070bd67ecdc500d9671bf1ab823
Author: Nikita Popov <nikic@php.net> Sat, 7 Jan 2017 22:51:18 +0100
Parents: f346bd6ee6a9eecb3666071d3afd30216439367d
Branches: PHP-7.0 PHP-7.1 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=a46bbdda2e082070bd67ecdc500d9671bf1ab823
Log:
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.
Bugs:
https://bugs.php.net/67583
Changed paths:
M NEWS
M main/fastcgi.c
M main/fastcgi.h
M sapi/fpm/fpm/fpm_main.c
Diff:
diff --git a/NEWS b/NEWS
index ba821fd..8a297b9 100644
--- a/NEWS
+++ b/NEWS
@@ -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 c52d222..dd7c7dd 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 fbc70c3..bba6401 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 5e09877..3ab92b3 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;
}