]> granicus.if.org Git - apache/commitdiff
Don't attempt to remove the existing conditional headers until we have
authorGraham Leggett <minfrin@apache.org>
Sun, 17 Oct 2010 00:50:28 +0000 (00:50 +0000)
committerGraham Leggett <minfrin@apache.org>
Sun, 17 Oct 2010 00:50:28 +0000 (00:50 +0000)
committed to adding our own.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1023396 13f79535-47bb-0310-9956-ffa450edef68

modules/cache/cache_storage.c

index 49b08e41551496152b7c473489312f79190e5ea9..95f1fef027432bfda13a37d4fb5dcf93ebc1a079 100644 (file)
@@ -313,30 +313,6 @@ int cache_select(cache_request_rec *cache, request_rec *r)
                     continue;
                 }
 
-                ap_log_error(APLOG_MARK, APLOG_DEBUG, APR_SUCCESS, r->server,
-                  "Cached response for %s isn't fresh.  Adding/replacing "
-                  "conditional request headers.", r->uri);
-
-                /* Make response into a conditional */
-                cache->stale_headers = apr_table_copy(r->pool,
-                                                      r->headers_in);
-
-                /* We can only revalidate with our own conditionals: remove the
-                 * conditions from the original request.
-                 */
-                apr_table_unset(r->headers_in, "If-Match");
-                apr_table_unset(r->headers_in, "If-Modified-Since");
-                apr_table_unset(r->headers_in, "If-None-Match");
-                apr_table_unset(r->headers_in, "If-Range");
-                apr_table_unset(r->headers_in, "If-Unmodified-Since");
-
-                /*
-                 * Do not do Range requests with our own conditionals: If
-                 * we get 304 the Range does not matter and otherwise the
-                 * entity changed and we want to have the complete entity
-                 */
-                apr_table_unset(r->headers_in, "Range");
-
                 etag = apr_table_get(h->resp_hdrs, "ETag");
                 lastmod = apr_table_get(h->resp_hdrs, "Last-Modified");
 
@@ -345,13 +321,37 @@ int cache_select(cache_request_rec *cache, request_rec *r)
                      * our own conditionals.
                      */
 
+                    ap_log_error(APLOG_MARK, APLOG_DEBUG, APR_SUCCESS, r->server,
+                            "Cached response for %s isn't fresh.  Adding/replacing "
+                            "conditional request headers.", r->uri);
+
+                    /* Make response into a conditional */
+                    cache->stale_headers = apr_table_copy(r->pool,
+                            r->headers_in);
+
+                    /* We can only revalidate with our own conditionals: remove the
+                     * conditions from the original request.
+                     */
+                    apr_table_unset(r->headers_in, "If-Match");
+                    apr_table_unset(r->headers_in, "If-Modified-Since");
+                    apr_table_unset(r->headers_in, "If-None-Match");
+                    apr_table_unset(r->headers_in, "If-Range");
+                    apr_table_unset(r->headers_in, "If-Unmodified-Since");
+
+                    /*
+                     * Do not do Range requests with our own conditionals: If
+                     * we get 304 the Range does not matter and otherwise the
+                     * entity changed and we want to have the complete entity
+                     */
+                    apr_table_unset(r->headers_in, "Range");
+
                     if (etag) {
                         apr_table_set(r->headers_in, "If-None-Match", etag);
                     }
 
                     if (lastmod) {
                         apr_table_set(r->headers_in, "If-Modified-Since",
-                                      lastmod);
+                                lastmod);
                     }
                     cache->stale_handle = h;
 
@@ -369,7 +369,7 @@ int cache_select(cache_request_rec *cache, request_rec *r)
                     irv = cache->provider->remove_url(h, r->pool);
                     if (irv != OK) {
                         ap_log_error(APLOG_MARK, APLOG_DEBUG, irv, r->server,
-                                     "cache: attempt to remove url from cache unsuccessful.");
+                                "cache: attempt to remove url from cache unsuccessful.");
                     }
 
                     /* try again with next cache type */