summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sapi/cgi/cgi_main.c7
-rw-r--r--sapi/cgi/fastcgi.c1
-rw-r--r--sapi/fpm/fpm/fastcgi.c1
-rw-r--r--sapi/fpm/fpm/fpm_main.c6
-rw-r--r--sapi/tests/test006.phpt1
5 files changed, 12 insertions, 4 deletions
diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c
index 8f976a8b93..4259ef1554 100644
--- a/sapi/cgi/cgi_main.c
+++ b/sapi/cgi/cgi_main.c
@@ -699,13 +699,16 @@ static void sapi_cgi_log_message(char *message)
request = (fcgi_request*) SG(server_context);
if (request) {
- int len = (int)strlen(message);
+ int ret, len = (int)strlen(message);
char *buf = malloc(len+2);
memcpy(buf, message, len);
memcpy(buf + len, "\n", sizeof("\n"));
- fcgi_write(request, FCGI_STDERR, buf, (int)(len+1));
+ ret = fcgi_write(request, FCGI_STDERR, buf, (int)(len + 1));
free(buf);
+ if (ret < 0) {
+ php_handle_aborted_connection();
+ }
} else {
fprintf(stderr, "%s\n", message);
}
diff --git a/sapi/cgi/fastcgi.c b/sapi/cgi/fastcgi.c
index 3acc666cf1..90123db0fa 100644
--- a/sapi/cgi/fastcgi.c
+++ b/sapi/cgi/fastcgi.c
@@ -1326,6 +1326,7 @@ int fcgi_flush(fcgi_request *req, int close)
if (safe_write(req, req->out_buf, len) != len) {
req->keep = 0;
+ req->out_pos = req->out_buf;
return 0;
}
diff --git a/sapi/fpm/fpm/fastcgi.c b/sapi/fpm/fpm/fastcgi.c
index a68316c6fb..0e3ec18023 100644
--- a/sapi/fpm/fpm/fastcgi.c
+++ b/sapi/fpm/fpm/fastcgi.c
@@ -965,6 +965,7 @@ int fcgi_flush(fcgi_request *req, int close)
if (safe_write(req, req->out_buf, len) != len) {
req->keep = 0;
+ req->out_pos = req->out_buf;
return 0;
}
diff --git a/sapi/fpm/fpm/fpm_main.c b/sapi/fpm/fpm/fpm_main.c
index d02b1fb2d4..cf1076ed59 100644
--- a/sapi/fpm/fpm/fpm_main.c
+++ b/sapi/fpm/fpm/fpm_main.c
@@ -614,11 +614,15 @@ void sapi_cgi_log_fastcgi(int level, char *message, size_t len)
* - the message is not empty
*/
if (CGIG(fcgi_logging) && request && message && len > 0) {
+ int ret;
char *buf = malloc(len + 2);
memcpy(buf, message, len);
memcpy(buf + len, "\n", sizeof("\n"));
- fcgi_write(request, FCGI_STDERR, buf, len+1);
+ ret = fcgi_write(request, FCGI_STDERR, buf, len + 1);
free(buf);
+ if (ret < 0) {
+ php_handle_aborted_connection();
+ }
}
}
/* }}} */
diff --git a/sapi/tests/test006.phpt b/sapi/tests/test006.phpt
index 45e37811ef..5cb211856b 100644
--- a/sapi/tests/test006.phpt
+++ b/sapi/tests/test006.phpt
@@ -43,7 +43,6 @@ Content-Type: application/octet-stream
phpinfo();
?>
-----------------------------240723202011929--
-
--FILE--
<?php
error_reporting(0);