From: William A. Rowe Jr Date: Wed, 25 Jul 2001 22:38:21 +0000 (+0000) Subject: Cliff's most sane advise :-) X-Git-Tag: 2.0.22~21 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ed317a04fc0c3b8ff3877812b42e426c67ee7354;p=apache Cliff's most sane advise :-) git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@89719 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/include/httpd.h b/include/httpd.h index f18f6856e7..3220d9938e 100644 --- a/include/httpd.h +++ b/include/httpd.h @@ -308,7 +308,7 @@ extern "C" { * than that in case the brigade code/filters attempt to read it directly. * ### 4mb is an invention, no idea if it is reasonable. */ -#define AP_MAX_SENDFILE 4194304 +#define AP_MAX_SENDFILE 16777216 /* diff --git a/modules/generators/mod_asis.c b/modules/generators/mod_asis.c index 36fd0a4d1e..39d9dc8d9a 100644 --- a/modules/generators/mod_asis.c +++ b/modules/generators/mod_asis.c @@ -120,7 +120,7 @@ static int asis_handler(request_rec *r) if (!r->header_only) { apr_off_t start = 0; apr_off_t fsize = r->finfo.size; -#ifdef APR_HAS_LARGE_FILES +#if APR_HAS_LARGE_FILES /* must split into mutiple send_fd chunks */ while (fsize > AP_MAX_SENDFILE) { ap_send_fd(f, r, start, AP_MAX_SENDFILE, &nbytes); diff --git a/server/core.c b/server/core.c index 8749ee64ab..2f566fbd82 100644 --- a/server/core.c +++ b/server/core.c @@ -2918,7 +2918,6 @@ static int default_handler(request_rec *r) { apr_bucket_brigade *bb; apr_bucket *e; - apr_off_t fsize, start; core_dir_config *d; int errstatus; apr_file_t *fd = NULL; @@ -2997,21 +2996,26 @@ static int default_handler(request_rec *r) } bb = apr_brigade_create(r->pool); - fsize = r->finfo.size; - start = 0; -#ifdef APR_HAS_LARGE_FILES - while (fsize > AP_MAX_SENDFILE) { +#if APR_HAS_LARGE_FILES + if (r->finfo.size > AP_MAX_SENDFILE) { /* APR_HAS_LARGE_FILES issue; must split into mutiple buckets, * no greater than MAX(apr_size_t), and more granular than that * in case the brigade code/filters attempt to read it directly. */ - e = apr_bucket_file_create(fd, start, AP_MAX_SENDFILE, r->pool); - APR_BRIGADE_INSERT_TAIL(bb, e); - fsize -= AP_MAX_SENDFILE; - start += AP_MAX_SENDFILE; + apr_off_t fsize = r->finfo.size; + e = apr_bucket_file_create(fd, 0, AP_MAX_SENDFILE, r->pool); + while (fsize > AP_MAX_SENDFILE) { + APR_BRIGADE_INSERT_TAIL(bb, e); + apr_bucket_copy(e, &e); + e->start += AP_MAX_SENDFILE; + fsize -= AP_MAX_SENDFILE; + } + e->length = (apr_size_t)fsize; /* Resize just the last bucket */ } + else #endif - e = apr_bucket_file_create(fd, start, (apr_size_t)fsize, r->pool); + e = apr_bucket_file_create(fd, 0, (apr_size_t)r->finfo.size, r->pool); + APR_BRIGADE_INSERT_TAIL(bb, e); e = apr_bucket_eos_create(); APR_BRIGADE_INSERT_TAIL(bb, e);