httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From minf...@apache.org
Subject svn commit: r1021917 - in /httpd/httpd/trunk/modules/cache: mod_cache.c mod_disk_cache.c
Date Tue, 12 Oct 2010 20:43:51 GMT
Author: minfrin
Date: Tue Oct 12 20:43:51 2010
New Revision: 1021917

URL: http://svn.apache.org/viewvc?rev=1021917&view=rev
Log:
Restore the apr_brigade_insert_file() call to within recall_body(), as the
function does more than add a single file bucket. Pass an empty brigade
to recall_body(), and prepend the result to the existing output brigade,
the next bucket being eos.

Modified:
    httpd/httpd/trunk/modules/cache/mod_cache.c
    httpd/httpd/trunk/modules/cache/mod_disk_cache.c

Modified: httpd/httpd/trunk/modules/cache/mod_cache.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/cache/mod_cache.c?rev=1021917&r1=1021916&r2=1021917&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/cache/mod_cache.c (original)
+++ httpd/httpd/trunk/modules/cache/mod_cache.c Tue Oct 12 20:43:51 2010
@@ -568,7 +568,7 @@ static int cache_handler(request_rec *r)
  *
  * Deliver cached content (headers and body) up the stack.
  */
-static int cache_out_filter(ap_filter_t *f, apr_bucket_brigade *bb)
+static int cache_out_filter(ap_filter_t *f, apr_bucket_brigade *in)
 {
     request_rec *r = f->r;
     apr_bucket *e;
@@ -580,31 +580,34 @@ static int cache_out_filter(ap_filter_t 
         ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
                      "CACHE/CACHE_OUT filter enabled while caching is disabled, ignoring");
         ap_remove_output_filter(f);
-        return ap_pass_brigade(f->next, bb);
+        return ap_pass_brigade(f->next, in);
     }
 
     ap_log_error(APLOG_MARK, APLOG_DEBUG, APR_SUCCESS, r->server,
                  "cache: running CACHE_OUT filter");
 
     /* clean out any previous response up to EOS, if any */
-    for (e = APR_BRIGADE_FIRST(bb);
-         e != APR_BRIGADE_SENTINEL(bb);
+    for (e = APR_BRIGADE_FIRST(in);
+         e != APR_BRIGADE_SENTINEL(in);
          e = APR_BUCKET_NEXT(e))
     {
         if (APR_BUCKET_IS_EOS(e)) {
+            apr_bucket_brigade *bb = apr_brigade_create(r->pool,
+                    r->connection->bucket_alloc);
 
             /* restore status of cached response */
             r->status = cache->handle->cache_obj->info.status;
 
             /* recall_headers() was called in cache_select() */
             cache->provider->recall_body(cache->handle, r->pool, bb);
+            APR_BRIGADE_PREPEND(in, bb);
 
             /* This filter is done once it has served up its content */
             ap_remove_output_filter(f);
 
             ap_log_error(APLOG_MARK, APLOG_DEBUG, APR_SUCCESS, r->server,
                          "cache: serving %s", r->uri);
-            return ap_pass_brigade(f->next, bb);
+            return ap_pass_brigade(f->next, in);
 
         }
         apr_bucket_delete(e);

Modified: httpd/httpd/trunk/modules/cache/mod_disk_cache.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/cache/mod_disk_cache.c?rev=1021917&r1=1021916&r2=1021917&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/cache/mod_disk_cache.c (original)
+++ httpd/httpd/trunk/modules/cache/mod_disk_cache.c Tue Oct 12 20:43:51 2010
@@ -863,9 +863,7 @@ static apr_status_t recall_body(cache_ha
     disk_cache_object_t *dobj = (disk_cache_object_t*) h->cache_obj->vobj;
 
     if (dobj->data.fd) {
-        apr_bucket *e = apr_bucket_file_create(dobj->data.fd, 0,
-                dobj->file_size, p, bb->bucket_alloc);
-        APR_BRIGADE_INSERT_HEAD(bb, e);
+        apr_brigade_insert_file(bb, dobj->data.fd, 0, dobj->file_size, p);
     }
 
     return APR_SUCCESS;



Mime
View raw message