]> granicus.if.org Git - php/commitdiff
Unify handling of aborted connections
authorSascha Schumann <sas@php.net>
Sun, 29 Oct 2000 16:14:27 +0000 (16:14 +0000)
committerSascha Schumann <sas@php.net>
Sun, 29 Oct 2000 16:14:27 +0000 (16:14 +0000)
sapi/isapi/php4isapi.c
sapi/nsapi/nsapi.c
sapi/phttpd/phttpd.c
sapi/pi3web/pi3web_sapi.c
sapi/roxen/roxen.c

index b776b9b5a66925ad8433724d47ad4a800f0f8749..1985bd63c99fdbe55ff4ead5efc4b269efd5a999 100644 (file)
@@ -151,7 +151,7 @@ static int sapi_isapi_ub_write(const char *str, uint str_length)
        
        ecb = (LPEXTENSION_CONTROL_BLOCK) SG(server_context);
        if (ecb->WriteClient(ecb->ConnID, (char *) str, &num_bytes, HSE_IO_SYNC ) == FALSE) {
-               zend_bailout();
+               php_handle_aborted_connection();
        }
        return num_bytes;
 }
index 70b002b6c30fbd331c23f347342f8623a6427b60..e7bd45ea830e19b6593f22fe7a19dce2351652b1 100644 (file)
@@ -141,9 +141,8 @@ sapi_nsapi_ub_write(const char *str, unsigned int str_length)
        rc = (nsapi_request_context *)SG(server_context);
        retval = net_write(rc->sn->csd, (char *)str, str_length);
        if (retval == IO_ERROR /*-1*/ || retval == IO_EOF /*0*/)
-               return -1;
-       else
-               return retval;
+               php_handle_aborted_connection();
+       return retval;
 }
 
 static int
index e8be996d6bf69dece05694b033247814c0919597..29733bcfd47eb44af15e15b57197682dc781d7e8 100644 (file)
@@ -69,7 +69,9 @@ php_phttpd_sapi_ub_write(const char *str, uint str_length)
 
        sent_bytes = fd_write(PHG(cip)->fd,str,str_length);
 
-       if (sent_bytes == -1) perror("fd_write\n");
+       if (sent_bytes == -1) {
+               php_handle_aborted_connection();
+       }
 
     return sent_bytes;
 }
index 0f148f632a24c9995499d8b8590648a5507382c7..cb009ed29bfd0d30cfd6193dbf74f16271b9f3e4 100644 (file)
@@ -145,6 +145,9 @@ static int zend_pi3web_ub_write(const char *str, uint str_length)
 
        if ( !IWasLoaded ) return 0;
        cb->WriteClient(cb->ConnID, (char *) str, &num_bytes, 0 );
+
+       if (num_bytes != str_length)
+               php_handle_aborted_connection();
        return num_bytes;
 }
 
index 594ca16819afdf44538bee8ac00b50186c15de84..4b6feac3b0ee269c2c5ebad4ef9e1ae0d3cefaf8 100644 (file)
@@ -233,8 +233,7 @@ php_roxen_low_ub_write(const char *str, uint str_length) {
   pop_stack();
   if(sent_bytes != str_length) {
     /* This means the connection is closed. Dead. Gone. *sniff*  */
-    PG(connection_status) = PHP_CONNECTION_ABORTED;
-    zend_bailout();
+    php_handle_aborted_connection();
   }
   return sent_bytes;
 }