Add/unify aborted connection handling

This commit is contained in:
Sascha Schumann 2000-10-29 16:01:02 +00:00
parent 13183ed5c3
commit 27a8480028
4 changed files with 14 additions and 18 deletions

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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();
}
}

View file

@ -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)