mirror of
https://github.com/apache/httpd.git
synced 2025-08-08 15:02:10 +03:00
Remove the original ap_send_fd code. The filters have been working for a
while, and this is cluttering up the code. If it is really needed, it can be found in CVS git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86856 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -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
|
||||
|
||||
|
Reference in New Issue
Block a user