httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rede...@apache.org
Subject cvs commit: httpd-2.0/modules/experimental mod_cache.c mod_mem_cache.c
Date Wed, 02 Oct 2002 18:26:52 GMT
rederpj     2002/10/02 11:26:52

  Modified:    .        CHANGES
               modules/experimental mod_cache.c mod_mem_cache.c
  Log:
  Fix a core dump in mod_cache when it attemtped to store uncopyable
  buckets. This happened, for instance, when a file to be cached
  contained SSI tags to execute a CGI script (passed as a pipe
  bucket). [Paul J. Reder]
  
  Revision  Changes    Path
  1.945     +5 -0      httpd-2.0/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/CHANGES,v
  retrieving revision 1.944
  retrieving revision 1.945
  diff -u -r1.944 -r1.945
  --- CHANGES	2 Oct 2002 13:41:44 -0000	1.944
  +++ CHANGES	2 Oct 2002 18:26:52 -0000	1.945
  @@ -1,5 +1,10 @@
   Changes with Apache 2.0.43
   
  +  *) Fix a core dump in mod_cache when it attemtped to store uncopyable
  +     buckets. This happened, for instance, when a file to be cached
  +     contained SSI tags to execute a CGI script (passed as a pipe
  +     bucket). [Paul J. Reder]
  +
     *) Ensure that output already available is flushed to the network
        when the content-length filter realizes that no new output will
        be available for a while.  This helps some streaming CGIs as
  
  
  
  1.60      +31 -2     httpd-2.0/modules/experimental/mod_cache.c
  
  Index: mod_cache.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/experimental/mod_cache.c,v
  retrieving revision 1.59
  retrieving revision 1.60
  diff -u -r1.59 -r1.60
  --- mod_cache.c	25 Sep 2002 07:08:44 -0000	1.59
  +++ mod_cache.c	2 Oct 2002 18:26:52 -0000	1.60
  @@ -679,7 +679,36 @@
                   }
                   APR_BRIGADE_FOREACH(e, in) {
                       apr_bucket *copy;
  -                    apr_bucket_copy(e, &copy);
  +                    rv = apr_bucket_copy(e, &copy);
  +                    if (rv == APR_ENOTIMPL) {
  +                        const char *str;
  +                        apr_size_t len;
  +
  +                        /* This takes care of uncopyable buckets. */
  +                        rv = apr_bucket_read(e, &str, &len, APR_BLOCK_READ);
  +                        if ((rv == APR_SUCCESS) &&
  +                            (cache->saved_size + len <=
  +                                        conf->max_streaming_buffer_size)) {
  +                            rv = apr_bucket_copy(e, &copy);
  +                        }
  +
  +                        if ((rv != APR_SUCCESS) ||
  +                            (cache->saved_size + len >
  +                                        conf->max_streaming_buffer_size)){
  +                            ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
  +                                         "cache: not caching streamed response for "
  +                                         "%s because length %s", url,
  +                                          "> CacheMaxStreamingBuffer");
  +
  +                            if (cache->saved_brigade != NULL) {
  +                                apr_brigade_destroy(cache->saved_brigade);
  +                                cache->saved_brigade = NULL;
  +                                cache->saved_size = 0;
  +                            }
  +                            ap_remove_output_filter(f);
  +                            return ap_pass_brigade(f->next, in);
  +                        }
  +                    }
                       APR_BRIGADE_INSERT_TAIL(cache->saved_brigade, copy);
                   }
                   cache->saved_size += size;
  @@ -1055,7 +1084,7 @@
                                                     &cache_module);
       val = (apr_off_t)strtol(arg, &err, 10);
       if (*err != 0) {
  -        return "CacheMaxStreamingBuffer value must be a percentage";
  +        return "CacheMaxStreamingBuffer value must be a number";
       }
       conf->max_streaming_buffer_size = val;
       return NULL;
  
  
  
  1.85      +2 -2      httpd-2.0/modules/experimental/mod_mem_cache.c
  
  Index: mod_mem_cache.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/experimental/mod_mem_cache.c,v
  retrieving revision 1.84
  retrieving revision 1.85
  diff -u -r1.84 -r1.85
  --- mod_mem_cache.c	22 Sep 2002 20:03:42 -0000	1.84
  +++ mod_mem_cache.c	2 Oct 2002 18:26:52 -0000	1.85
  @@ -991,10 +991,10 @@
                  obj->count+=len;
              }
           }
  -        /* This should not happen, but if it does, we are in BIG trouble
  +        /* This should not fail, but if it does, we are in BIG trouble
            * cause we just stomped all over the heap.
            */
  -        AP_DEBUG_ASSERT(obj->count >= mobj->m_len);
  +        AP_DEBUG_ASSERT(obj->count <= mobj->m_len);
       }
       return APR_SUCCESS;
   }
  
  
  

Mime
View raw message