From: Bill Stoddard Date: Tue, 5 Oct 1999 05:14:43 +0000 (+0000) Subject: Update ap_send_fd() and ap_send_fd_length() to use an ap_file_t. Hummm... X-Git-Tag: 1.3.10~309 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6737d44fe5ce387a26383387a79217e3826ff0d9;p=thirdparty%2Fapache%2Fhttpd.git 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 :-) git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@83930 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/include/http_protocol.h b/include/http_protocol.h index e962b962c9c..eab522e972d 100644 --- a/include/http_protocol.h +++ b/include/http_protocol.h @@ -134,8 +134,8 @@ API_EXPORT(int) ap_meets_conditions(request_rec *r); * (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); diff --git a/modules/http/http_core.c b/modules/http/http_core.c index 2c306e33d5b..c1b23789b24 100644 --- a/modules/http/http_core.c +++ b/modules/http/http_core.c @@ -2579,7 +2579,7 @@ static int default_handler(request_rec *r) if (!r->header_only) { if (!rangestatus) { - ap_send_fd(fd_os, r); + ap_send_fd(fd, r); } else { long length; @@ -2592,7 +2592,7 @@ static int default_handler(request_rec *r) ap_close(fd); return HTTP_INTERNAL_SERVER_ERROR; } - ap_send_fd_length(fd_os, r, length); + ap_send_fd_length(fd, r, length); } } } diff --git a/modules/http/http_protocol.c b/modules/http/http_protocol.c index 5836f6110ed..cd5e0c81a3b 100644 --- a/modules/http/http_protocol.c +++ b/modules/http/http_protocol.c @@ -1999,16 +1999,18 @@ API_EXPORT(int) ap_discard_request_body(request_rec *r) /* * 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 @@ API_EXPORT(long) ap_send_fd_length(int fd, request_rec *r, long length) 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)) {