httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yla...@apache.org
Subject svn commit: r1594643 - in /httpd/httpd/trunk/modules/cache: cache_util.c cache_util.h mod_cache.c
Date Wed, 14 May 2014 17:11:49 GMT
Author: ylavic
Date: Wed May 14 17:11:49 2014
New Revision: 1594643

URL: http://svn.apache.org/r1594643
Log:
mod_cache: follow up to r1591328.

Define the cache_merge_headers_out() function to merge r->err_headers_out into
r->headers_out and add the ones from r->content_type/encoding if available.
Use it in ap_cache_cacheable_headers_out() where the same is done and in
cache_save_filter() where this has to be done before updating the entry.

Modified:
    httpd/httpd/trunk/modules/cache/cache_util.c
    httpd/httpd/trunk/modules/cache/cache_util.h
    httpd/httpd/trunk/modules/cache/mod_cache.c

Modified: httpd/httpd/trunk/modules/cache/cache_util.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/cache/cache_util.c?rev=1594643&r1=1594642&r2=1594643&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/cache/cache_util.c (original)
+++ httpd/httpd/trunk/modules/cache/cache_util.c Wed May 14 17:11:49 2014
@@ -1237,26 +1237,33 @@ CACHE_DECLARE(apr_table_t *)ap_cache_cac
 {
     apr_table_t *headers_out;
 
-    headers_out = apr_table_overlay(r->pool, r->headers_out,
-                                        r->err_headers_out);
-
-    apr_table_clear(r->err_headers_out);
-
-    headers_out = ap_cache_cacheable_headers(r->pool, headers_out,
-                                                  r->server);
+    headers_out = ap_cache_cacheable_headers(r->pool,
+                                             cache_merge_headers_out(r),
+                                             r->server);
 
     cache_control_remove(r,
             cache_table_getm(r->pool, headers_out, "Cache-Control"),
             headers_out);
 
+    return headers_out;
+}
+
+apr_table_t *cache_merge_headers_out(request_rec *r)
+{
+    apr_table_t *headers_out;
+
+    headers_out = apr_table_overlay(r->pool, r->headers_out,
+                                    r->err_headers_out);
+    apr_table_clear(r->err_headers_out);
+
     if (!apr_table_get(headers_out, "Content-Type")
-        && r->content_type) {
+            && r->content_type) {
         apr_table_setn(headers_out, "Content-Type",
                        ap_make_content_type(r, r->content_type));
     }
 
     if (!apr_table_get(headers_out, "Content-Encoding")
-        && r->content_encoding) {
+            && r->content_encoding) {
         apr_table_setn(headers_out, "Content-Encoding",
                        r->content_encoding);
     }

Modified: httpd/httpd/trunk/modules/cache/cache_util.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/cache/cache_util.h?rev=1594643&r1=1594642&r2=1594643&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/cache/cache_util.h (original)
+++ httpd/httpd/trunk/modules/cache/cache_util.h Wed May 14 17:11:49 2014
@@ -321,6 +321,12 @@ const char *cache_table_getm(apr_pool_t 
  */
 char *cache_strqtok(char *str, const char *sep, char **last);
 
+/**
+ * Merge err_headers_out into headers_out and add request's Content-Type and
+ * Content-Encoding if available.
+ */
+apr_table_t *cache_merge_headers_out(request_rec *r);
+
 #ifdef __cplusplus
 }
 #endif

Modified: httpd/httpd/trunk/modules/cache/mod_cache.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/cache/mod_cache.c?rev=1594643&r1=1594642&r2=1594643&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/cache/mod_cache.c (original)
+++ httpd/httpd/trunk/modules/cache/mod_cache.c Wed May 14 17:11:49 2014
@@ -1449,9 +1449,7 @@ static apr_status_t cache_save_filter(ap
          * here we want to keep the original headers in r->headers_out and
          * forward all of them to the client, including non-cacheable ones).
          */
-        r->headers_out = apr_table_overlay(r->pool, r->headers_out,
-                                           r->err_headers_out);
-        apr_table_clear(r->err_headers_out);
+        r->headers_out = cache_merge_headers_out(r);
 
         /* Merge in our cached headers.  However, keep any updated values. */
         /* take output, overlay on top of cached */



Mime
View raw message