mirror of
https://github.com/apache/httpd.git
synced 2025-09-01 02:02:06 +03:00
Remove the sendfile_handler (was #if 0'ed out) that does the buffer hi-jack
trick in order to send the headers out on the sendfile call. Besides, BUFF is going away with brigades and filters... git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86079 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
70
modules/cache/mod_file_cache.c
vendored
70
modules/cache/mod_file_cache.c
vendored
@@ -425,76 +425,6 @@ static int sendfile_handler(request_rec *r, a_file *file, int rangestatus)
|
||||
#endif
|
||||
return OK;
|
||||
}
|
||||
#if 0
|
||||
static int sendfile_handler(request_rec *r, a_file *file, int rangestatus)
|
||||
{
|
||||
#if APR_HAS_SENDFILE
|
||||
long length;
|
||||
apr_off_t offset = 0;
|
||||
struct iovec iov;
|
||||
apr_hdtr_t hdtr;
|
||||
apr_hdtr_t *phdtr = &hdtr;
|
||||
apr_status_t rv;
|
||||
apr_int32_t flags = 0;
|
||||
|
||||
/*
|
||||
* We want to send any data held in the client buffer on the
|
||||
* call to iol_sendfile. So hijack it then set outcnt to 0
|
||||
* to prevent the data from being sent to the client again
|
||||
* when the buffer is flushed to the client at the end of the
|
||||
* request.
|
||||
*/
|
||||
iov.iov_base = r->connection->client->outbase;
|
||||
iov.iov_len = r->connection->client->outcnt;
|
||||
r->connection->client->outcnt = 0;
|
||||
|
||||
/* initialize the apr_hdtr_t struct */
|
||||
phdtr->headers = &iov;
|
||||
phdtr->numheaders = 1;
|
||||
phdtr->trailers = NULL;
|
||||
phdtr->numtrailers = 0;
|
||||
|
||||
if (!rangestatus) {
|
||||
length = file->finfo.size;
|
||||
|
||||
if (!r->connection->keepalive) {
|
||||
/* Disconnect the socket after the send completes. This
|
||||
* should leave the accept socket in a state ready to be
|
||||
* reused for the next connection.
|
||||
*/
|
||||
flags |= APR_SENDFILE_DISCONNECT_SOCKET;
|
||||
}
|
||||
|
||||
rv = iol_sendfile(r->connection->client->iol,
|
||||
file->file,
|
||||
phdtr,
|
||||
&offset,
|
||||
&length,
|
||||
flags);
|
||||
if (rv != APR_SUCCESS) {
|
||||
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
|
||||
"mod_file_cache: iol_sendfile failed.");
|
||||
}
|
||||
}
|
||||
else {
|
||||
while (ap_each_byterange(r, &offset, &length)) {
|
||||
rv =iol_sendfile(r->connection->client->iol,
|
||||
file->file,
|
||||
phdtr,
|
||||
&offset,
|
||||
&length,
|
||||
0);
|
||||
if (rv != APR_SUCCESS) {
|
||||
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
|
||||
"mod_file_cache: iol_sendfile failed.");
|
||||
}
|
||||
phdtr = NULL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int file_cache_handler(request_rec *r)
|
||||
{
|
||||
|
Reference in New Issue
Block a user