]> granicus.if.org Git - apache/commitdiff
Cliff's most sane advise :-)
authorWilliam A. Rowe Jr <wrowe@apache.org>
Wed, 25 Jul 2001 22:38:21 +0000 (22:38 +0000)
committerWilliam A. Rowe Jr <wrowe@apache.org>
Wed, 25 Jul 2001 22:38:21 +0000 (22:38 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@89719 13f79535-47bb-0310-9956-ffa450edef68

include/httpd.h
modules/generators/mod_asis.c
server/core.c

index f18f6856e70b754c7f2fcb78993cd33d1a0a6f02..3220d9938eee1d63fbcc6fa578b4fdb3fae357a3 100644 (file)
@@ -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
 
 
 /*
index 36fd0a4d1e147da7d119e495393e4c2bcbdec2d5..39d9dc8d9aa5733a3fe58a9a4de8ccc6b5e2275f 100644 (file)
@@ -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);
index 8749ee64ab802d8f2c872e2b059c4727574f25bd..2f566fbd8212e2d91480a9b2a9c7dc8fffc8f25d 100644 (file)
@@ -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);