You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by wr...@apache.org on 2001/07/26 00:38:21 UTC

cvs commit: httpd-2.0/include httpd.h

wrowe       01/07/25 15:38:21

  Modified:    server   core.c
               modules/generators mod_asis.c
               include  httpd.h
  Log:
    Cliff's most sane advise :-)
  
  Revision  Changes    Path
  1.29      +14 -10    httpd-2.0/server/core.c
  
  Index: core.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/core.c,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- core.c	2001/07/25 21:41:44	1.28
  +++ core.c	2001/07/25 22:38:21	1.29
  @@ -2918,7 +2918,6 @@
   {
       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 @@
       }
   
       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);
  
  
  
  1.38      +1 -1      httpd-2.0/modules/generators/mod_asis.c
  
  Index: mod_asis.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/generators/mod_asis.c,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -r1.37 -r1.38
  --- mod_asis.c	2001/07/25 21:55:27	1.37
  +++ mod_asis.c	2001/07/25 22:38:21	1.38
  @@ -120,7 +120,7 @@
       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);
  
  
  
  1.155     +1 -1      httpd-2.0/include/httpd.h
  
  Index: httpd.h
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/include/httpd.h,v
  retrieving revision 1.154
  retrieving revision 1.155
  diff -u -r1.154 -r1.155
  --- httpd.h	2001/07/25 21:41:44	1.154
  +++ httpd.h	2001/07/25 22:38:21	1.155
  @@ -308,7 +308,7 @@
    * 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
   
   
   /*
  
  
  

Re: cvs commit: httpd-2.0/include httpd.h

Posted by Cliff Woolley <cl...@yahoo.com>.
On 25 Jul 2001 wrowe@apache.org wrote:

>   +#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.
>             */
>   +        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, 0, (apr_size_t)r->finfo.size, r->pool);
>   +
>        APR_BRIGADE_INSERT_TAIL(bb, e);

Cool, that works.  Thanks.


>   Index: mod_asis.c
>   ===================================================================
>   RCS file: /home/cvs/httpd-2.0/modules/generators/mod_asis.c,v
>   retrieving revision 1.37
>   retrieving revision 1.38
>   diff -u -r1.37 -r1.38
>   --- mod_asis.c	2001/07/25 21:55:27	1.37
>   +++ mod_asis.c	2001/07/25 22:38:21	1.38
>   @@ -120,7 +120,7 @@
>        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);

We might want to eliminate the use of ap_send_fd() here... it's creating
files buckets each time under the covers.  I'll look into patching that.

--Cliff


--------------------------------------------------------------
   Cliff Woolley
   cliffwoolley@yahoo.com
   Charlottesville, VA