static int sapi_webjames_ub_write(const char *str, uint str_length TSRMLS_DC) /*unbuffered write - send data straight out to socket*/ { int totalbytes = 0; do { int bytes; bytes = webjames_writebuffer(WG(conn),str,str_length); if (bytes<0) { PG(connection_status) = PHP_CONNECTION_ABORTED; if (!PG(ignore_user_abort)) { zend_bailout(); } return bytes; } str += bytes; str_length -= bytes; totalbytes += bytes; } while (str_length); return totalbytes; }
static void sapi_webjames_send_header(sapi_header_struct *sapi_header, void *server_context) /*send an HTTP header*/ { char *header = sapi_header->header; int len = sapi_header->header_len; if (WG(conn)->flags.outputheaders) { while (sapi_header && len > 0) { int bytes; bytes = webjames_writebuffer(WG(conn), header, len); if (bytes<0) { PG(connection_status) = PHP_CONNECTION_ABORTED; if (!PG(ignore_user_abort)) { zend_bailout(); } return; } header += bytes; len -= bytes; } webjames_writestring(WG(conn), "\r\n"); } }