]> granicus.if.org Git - php/commitdiff
Add/unify aborted connection handling
authorSascha Schumann <sas@php.net>
Sun, 29 Oct 2000 16:01:02 +0000 (16:01 +0000)
committerSascha Schumann <sas@php.net>
Sun, 29 Oct 2000 16:01:02 +0000 (16:01 +0000)
sapi/aolserver/aolserver.c
sapi/apache/mod_php4.c
sapi/apache2filter/sapi_apache2.c
sapi/thttpd/thttpd.c

index b7b3f9ab124eeccd6c346d107138fa798f8a8217..fa209c252909dcad46351a8b13026dd5439a7527 100644 (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;
 }
 
index eea725287b86e4257ade01d45fa908722087b58a..5245e1e31e8df79acad3f027191c3b6ed4c6bf0f 100644 (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;
 }
index f46bbe29df59c14cee56eca163a5b7cf2fb8316b..4abcf706f581d72df6cc6cafa54b5b8e9832f6fe 100644 (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();
        }
 }
 
index b286cd80fae09881cf36a9d49e18d4b25ad1196c..9dbf93a490eb833077219ced8b8ba6bbd4f3906a 100644 (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)