summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sapi/aolserver/aolserver.c3
-rw-r--r--sapi/apache/mod_php4.c6
-rw-r--r--sapi/apache2filter/sapi_apache2.c14
-rw-r--r--sapi/thttpd/thttpd.c9
4 files changed, 14 insertions, 18 deletions
diff --git a/sapi/aolserver/aolserver.c b/sapi/aolserver/aolserver.c
index b7b3f9ab12..fa209c2529 100644
--- a/sapi/aolserver/aolserver.c
+++ b/sapi/aolserver/aolserver.c
@@ -98,6 +98,9 @@ php_ns_sapi_ub_write(const char *str, uint str_length)
sent_bytes = Ns_ConnWrite(NSG(conn), (void *) str, str_length);
+ if (sent_bytes != str_length)
+ php_handle_aborted_connection();
+
return sent_bytes;
}
diff --git a/sapi/apache/mod_php4.c b/sapi/apache/mod_php4.c
index eea725287b..5245e1e31e 100644
--- a/sapi/apache/mod_php4.c
+++ b/sapi/apache/mod_php4.c
@@ -126,7 +126,6 @@ static int sapi_apache_ub_write(const char *str, uint str_length)
{
int ret;
SLS_FETCH();
- PLS_FETCH();
if (SG(server_context)) {
ret = rwrite(str, str_length, (request_rec *) SG(server_context));
@@ -134,10 +133,7 @@ static int sapi_apache_ub_write(const char *str, uint str_length)
ret = fwrite(str, 1, str_length, stderr);
}
if(ret != str_length) {
- PG(connection_status) = PHP_CONNECTION_ABORTED;
- if (!PG(ignore_user_abort)) {
- zend_bailout();
- }
+ php_handle_aborted_connection();
}
return ret;
}
diff --git a/sapi/apache2filter/sapi_apache2.c b/sapi/apache2filter/sapi_apache2.c
index f46bbe29df..4abcf706f5 100644
--- a/sapi/apache2filter/sapi_apache2.c
+++ b/sapi/apache2filter/sapi_apache2.c
@@ -43,12 +43,7 @@ php_apache_sapi_ub_write(const char *str, uint str_length)
str_length -= now;
}
if (ap_pass_brigade(ctx->f->next, bb) != APR_SUCCESS) {
- PLS_FETCH();
- PG(connection_status) = PHP_CONNECTION_ABORTED;
-
- if (!PG(ignore_user_abort)) {
- zend_bailout();
- }
+ php_handle_aborted_connection();
}
return str_length;
@@ -160,12 +155,7 @@ php_apache_sapi_flush(void *server_context)
b = ap_bucket_create_flush();
AP_BRIGADE_INSERT_TAIL(bb, b);
if (ap_pass_brigade(ctx->f->next, bb) != APR_SUCCESS) {
- PLS_FETCH();
- PG(connection_status) = PHP_CONNECTION_ABORTED;
-
- if (!PG(ignore_user_abort)) {
- zend_bailout();
- }
+ php_handle_aborted_connection();
}
}
diff --git a/sapi/thttpd/thttpd.c b/sapi/thttpd/thttpd.c
index b286cd80fa..9dbf93a490 100644
--- a/sapi/thttpd/thttpd.c
+++ b/sapi/thttpd/thttpd.c
@@ -40,9 +40,16 @@ static php_thttpd_globals thttpd_globals;
static int sapi_thttpd_ub_write(const char *str, uint str_length)
{
+ int n;
TLS_FETCH();
- return send(TG(hc)->conn_fd, str, str_length, 0);
+ n = send(TG(hc)->conn_fd, str, str_length, 0);
+
+ if (n == EPIPE) {
+ php_handle_aborted_connection();
+ }
+
+ return n;
}
static int sapi_thttpd_send_headers(sapi_headers_struct *sapi_headers SLS_DC)