diff --git a/modules/cache/mod_file_cache.c b/modules/cache/mod_file_cache.c index 8794f97815..9793dd9e35 100644 --- a/modules/cache/mod_file_cache.c +++ b/modules/cache/mod_file_cache.c @@ -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) {