From 941a96936e53945173c3eb79c744bfaad133cd54 Mon Sep 17 00:00:00 2001 From: Ryan Bloom Date: Wed, 12 Jan 2000 18:20:43 +0000 Subject: Fix some remaining problems with SSI's and Windows. Basically, the sendfile stuff doesn't work properly with chuncked data. Submitted by: Allan Edwards Reviewed by: Ryan Bloom git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@84448 13f79535-47bb-0310-9956-ffa450edef68 --- modules/http/http_protocol.c | 23 ++++++++++++++--------- modules/http/http_request.c | 1 + 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/modules/http/http_protocol.c b/modules/http/http_protocol.c index 99d12d99e3..361d2510a0 100644 --- a/modules/http/http_protocol.c +++ b/modules/http/http_protocol.c @@ -2016,16 +2016,21 @@ API_EXPORT(long) ap_send_fd(ap_file_t *fd, request_rec *r) { long len; #ifdef HAVE_SENDFILE - ap_bflush(r->connection->client); - if (ap_get_filesize(&len, fd) != APR_SUCCESS) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "ap_send_fd: ap_get_filesize failed."); - return 0; + if (!r->chunked) { + ap_bflush(r->connection->client); + if (ap_get_filesize(&len, fd) != APR_SUCCESS) { + ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, + "ap_send_fd: ap_get_filesize failed."); + return 0; + } + if (iol_sendfile(r->connection->client->iol, fd, len, + NULL, 0, 0) != APR_SUCCESS) { + ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, + "ap_send_fd: iol_sendfile failed."); + } } - if (iol_sendfile(r->connection->client->iol, fd, len, - NULL, 0, 0) != APR_SUCCESS) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "ap_send_fd: iol_sendfile failed."); + else { + len = ap_send_fd_length(fd, r, -1); } #else len = ap_send_fd_length(fd, r, -1); diff --git a/modules/http/http_request.c b/modules/http/http_request.c index 579990333b..5dc2e63d2c 100644 --- a/modules/http/http_request.c +++ b/modules/http/http_request.c @@ -845,6 +845,7 @@ API_EXPORT(request_rec *) ap_sub_req_lookup_file(const char *new_file, rnew->server = r->server; rnew->request_config = ap_create_request_config(rnew->pool); rnew->htaccess = r->htaccess; + rnew->chunked = r->chunked; ap_set_sub_req_protocol(rnew, r); fdir = ap_make_dirstr_parent(rnew->pool, r->filename); -- cgit v1.2.3