diff options
-rw-r--r-- | modules/http/http_protocol.c | 74 |
1 files changed, 0 insertions, 74 deletions
diff --git a/modules/http/http_protocol.c b/modules/http/http_protocol.c index f57a14d071..b18d258316 100644 --- a/modules/http/http_protocol.c +++ b/modules/http/http_protocol.c @@ -2751,80 +2751,6 @@ AP_DECLARE(apr_status_t) ap_send_fd(apr_file_t *fd, request_rec *r, apr_off_t of return rv; } -#if 0 -/* Leave the old implementation around temporarily for reference purposes */ -AP_DECLARE(apr_status_t) ap_send_fd(apr_file_t *fd, request_rec *r, apr_off_t offset, - apr_size_t length, apr_size_t *nbytes) -{ - apr_status_t rv = APR_SUCCESS; - apr_size_t total_bytes_sent = 0; - register int o; - apr_ssize_t n; - char buf[IOBUFSIZE]; - - if ((length == 0) || r->connection->aborted) { - *nbytes = 0; - return APR_SUCCESS; - } - -#if APR_HAS_SENDFILE - /* Chunked encoding must be handled in the BUFF */ - if (!r->chunked) { - rv = static_send_file(fd, r, offset, length, &total_bytes_sent); - if (rv == APR_SUCCESS) { - r->bytes_sent += total_bytes_sent; - *nbytes = total_bytes_sent; - return rv; - } - /* Don't consider APR_ENOTIMPL a failure */ - if (rv != APR_ENOTIMPL) { - check_first_conn_error(r, "send_fd", rv); - r->bytes_sent += total_bytes_sent; - *nbytes = total_bytes_sent; - return rv; - } - } -#endif - - /* Either sendfile is not defined or it failed with APR_ENOTIMPL */ - if (offset) { - /* Seek the file to the offset */ - rv = apr_seek(fd, APR_SET, &offset); - if (rv != APR_SUCCESS) { - *nbytes = total_bytes_sent; - /* apr_close(fd); close the file or let the caller handle it? */ - return rv; - } - } - - while (!r->connection->aborted) { - if ((length > 0) && (total_bytes_sent + IOBUFSIZE) > length) { - n = length - total_bytes_sent; - } - else { - n = IOBUFSIZE; - } - - do { - rv = apr_read(fd, buf, &n); - } while (APR_STATUS_IS_EINTR(rv) && !r->connection->aborted); - - /* Is this still the right check? maybe check for n==0 or rv == APR_EOF? */ - if (n < 1) { - break; - } - - o = ap_rwrite(buf, n, r); - if (o < 0) { - break; - } - total_bytes_sent += o; - } - - *nbytes = total_bytes_sent; - return rv; -} -#endif #ifdef AP_USE_MMAP_FILES |