stoddard 99/10/04 22:14:44
Modified: src/include http_protocol.h src/main http_core.c http_protocol.c Log: Update ap_send_fd() and ap_send_fd_length() to use an ap_file_t. Hummm... Still need to get sendfile() in. First, lets get the serving basically working again :-) Revision Changes Path 1.6 +2 -2 apache-2.0/src/include/http_protocol.h Index: http_protocol.h =================================================================== RCS file: /home/cvs/apache-2.0/src/include/http_protocol.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- http_protocol.h 1999/09/11 22:14:35 1.5 +++ http_protocol.h 1999/10/05 05:14:41 1.6 @@ -134,8 +134,8 @@ * (Ditto the send_header stuff). */ -API_EXPORT(long) ap_send_fd(int fd, request_rec *r); -API_EXPORT(long) ap_send_fd_length(int fd, request_rec *r, long length); +API_EXPORT(long) ap_send_fd(ap_file_t *fd, request_rec *r); +API_EXPORT(long) ap_send_fd_length(ap_file_t *fd, request_rec *r, long length); API_EXPORT(long) ap_send_fb(BUFF *f, request_rec *r); API_EXPORT(long) ap_send_fb_length(BUFF *f, request_rec *r, long length); 1.15 +2 -2 apache-2.0/src/main/http_core.c Index: http_core.c =================================================================== RCS file: /home/cvs/apache-2.0/src/main/http_core.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- http_core.c 1999/10/04 16:37:51 1.14 +++ http_core.c 1999/10/05 05:14:42 1.15 @@ -2579,7 +2579,7 @@ if (!r->header_only) { if (!rangestatus) { - ap_send_fd(fd_os, r); + ap_send_fd(fd, r); } else { long length; @@ -2592,7 +2592,7 @@ ap_close(fd); return HTTP_INTERNAL_SERVER_ERROR; } - ap_send_fd_length(fd_os, r, length); + ap_send_fd_length(fd, r, length); } } } 1.18 +12 -8 apache-2.0/src/main/http_protocol.c Index: http_protocol.c =================================================================== RCS file: /home/cvs/apache-2.0/src/main/http_protocol.c,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- http_protocol.c 1999/10/04 16:37:53 1.17 +++ http_protocol.c 1999/10/05 05:14:43 1.18 @@ -1999,16 +1999,18 @@ /* * Send the body of a response to the client. */ -API_EXPORT(long) ap_send_fd(int fd, request_rec *r) +API_EXPORT(long) ap_send_fd(ap_file_t *fd, request_rec *r) { return ap_send_fd_length(fd, r, -1); } -API_EXPORT(long) ap_send_fd_length(int fd, request_rec *r, long length) +API_EXPORT(long) ap_send_fd_length(ap_file_t *fd, request_rec *r, long length) { char buf[IOBUFSIZE]; long total_bytes_sent = 0; - register int n, w, o; + register w, o; + int n; + ap_status_t status; if (length == 0) return 0; @@ -2018,15 +2020,17 @@ o = length - total_bytes_sent; else o = IOBUFSIZE; + + n = o; + do { + status = ap_read(fd, buf, &n); + } while (status == APR_EINTR && !ap_is_aborted(r->connection) && + (n < 1)); - while ((n = read(fd, buf, o)) < 0 && - (errno == EINTR || errno == EAGAIN) && - !ap_is_aborted(r->connection)) - continue; - if (n < 1) { break; } + o = 0; while (n && !ap_is_aborted(r->connection)) {