httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n..@apache.org
Subject cvs commit: httpd-2.0/modules/filters mod_deflate.c
Date Sat, 17 Jul 2004 15:22:35 GMT
niq         2004/07/17 08:22:35

  Modified:    modules/filters mod_deflate.c
  Log:
  Fix previous patch to deal correctly with multiple empty brigades before
  we know if there's any content, and not re-process the headers.
  
  Revision  Changes    Path
  1.55      +16 -4     httpd-2.0/modules/filters/mod_deflate.c
  
  Index: mod_deflate.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/filters/mod_deflate.c,v
  retrieving revision 1.54
  retrieving revision 1.55
  diff -u -r1.54 -r1.55
  --- mod_deflate.c	17 Jul 2004 14:14:11 -0000	1.54
  +++ mod_deflate.c	17 Jul 2004 15:22:35 -0000	1.55
  @@ -254,6 +254,11 @@
       request_rec *r = f->r;
       deflate_ctx *ctx = f->ctx;
       int zRC;
  +    char* buf;
  +    int eos_only = 1;
  +    apr_bucket *bkt;
  +    char *token;
  +    const char *encoding;
       deflate_filter_config *c = ap_get_module_config(r->server->module_config,
                                                       &deflate_module);
   
  @@ -264,10 +269,6 @@
        * we're in better shape.
        */
       if (!ctx) {
  -        int eos_only = 1;
  -        apr_bucket *bkt;
  -        char *buf, *token;
  -        const char *encoding;
   
           /* only work on main request/no subrequests */
           if (r->main) {
  @@ -384,6 +385,15 @@
   
           /* don't deflate responses with zero length e.g. proxied 304's but
            * we do set the header on eos_only at this point for headers_filter
  +         *
  +         * if we get eos_only and come round again, we want to avoid redoing
  +         * what we've already done, so set f->ctx to a flag here
  +         */
  +        f->ctx = ctx = (void*)-1;
  +    }
  +    if (ctx == (void*)-1) {
  +        /* deal with the pathological case of lots of empty brigades and
  +         * no knowledge of whether content will follow
            */
           for (bkt = APR_BRIGADE_FIRST(bb);
                bkt != APR_BRIGADE_SENTINEL(bb);
  @@ -404,6 +414,8 @@
               apr_table_unset(r->headers_out, "Content-Length");
               return ap_pass_brigade(f->next, bb);
           }
  +    }
  +    if (!ctx || (ctx==(void*)-1)) {
   
           /* We're cool with filtering this. */
           ctx = f->ctx = apr_pcalloc(r->pool, sizeof(*ctx));
  
  
  

Mime
View raw message