Return-Path: Delivered-To: apmail-apache-cvs-archive@apache.org Received: (qmail 76320 invoked by uid 500); 25 Jul 2001 21:44:45 -0000 Mailing-List: contact apache-cvs-help@apache.org; run by ezmlm Precedence: bulk Reply-To: new-httpd@apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list apache-cvs@apache.org Received: (qmail 76309 invoked by uid 500); 25 Jul 2001 21:44:45 -0000 Delivered-To: apmail-httpd-2.0-cvs@apache.org Date: 25 Jul 2001 21:41:44 -0000 Message-ID: <20010725214144.22499.qmail@icarus.apache.org> From: wrowe@apache.org To: httpd-2.0-cvs@apache.org Subject: cvs commit: httpd-2.0/server core.c X-Spam-Rating: h31.sny.collab.net 1.6.2 0/1000/N wrowe 01/07/25 14:41:44 Modified: include httpd.h server core.c Log: This same patch is needed in mod_asis and others, I'm testing the waters for this solution. I'm easily convinced to choose AP_MAX_SENDFILE based on any reasonable argument, provided it's smaller than 2^30 :-) Revision Changes Path 1.154 +8 -0 httpd-2.0/include/httpd.h Index: httpd.h =================================================================== RCS file: /home/cvs/httpd-2.0/include/httpd.h,v retrieving revision 1.153 retrieving revision 1.154 diff -u -r1.153 -r1.154 --- httpd.h 2001/06/07 00:09:14 1.153 +++ httpd.h 2001/07/25 21:41:44 1.154 @@ -303,6 +303,14 @@ /* The size of the server's internal read-write buffers */ #define AP_IOBUFSIZE 8192 +/* APR_HAS_LARGE_FILES introduces the problem of spliting sendfile 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. + * ### 4mb is an invention, no idea if it is reasonable. + */ +#define AP_MAX_SENDFILE 4194304 + + /* * Special Apache error codes. These are basically used * in http_main.c so we can keep track of various errors. 1.28 +17 -7 httpd-2.0/server/core.c Index: core.c =================================================================== RCS file: /home/cvs/httpd-2.0/server/core.c,v retrieving revision 1.27 retrieving revision 1.28 diff -u -r1.27 -r1.28 --- core.c 2001/07/24 20:38:01 1.27 +++ core.c 2001/07/25 21:41:44 1.28 @@ -2918,6 +2918,7 @@ { apr_bucket_brigade *bb; apr_bucket *e; + apr_off_t fsize, start; core_dir_config *d; int errstatus; apr_file_t *fd = NULL; @@ -2996,13 +2997,22 @@ } bb = apr_brigade_create(r->pool); - /* XXX: APR_HAS_LARGE_FILES issue; need to split into mutiple buckets, - * no greater than MAX(apr_size_t), (perhaps more granular than that - * in case the brigade code/filters attempt to read it!) - */ - e = apr_bucket_file_create(fd, 0, r->finfo.size, r->pool); - - APR_BRIGADE_INSERT_HEAD(bb, e); + fsize = r->finfo.size; + start = 0; +#ifdef APR_HAS_LARGE_FILES + while (fsize > 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; + } +#endif + e = apr_bucket_file_create(fd, start, (apr_size_t)fsize, r->pool); + APR_BRIGADE_INSERT_TAIL(bb, e); e = apr_bucket_eos_create(); APR_BRIGADE_INSERT_TAIL(bb, e);