Title: [114165] trunk
Revision
114165
Author
a...@apple.com
Date
2012-04-13 13:57:10 -0700 (Fri, 13 Apr 2012)

Log Message

        REGRESSION (XHR Caching): Uncacheable responses sent by Rails through Apache are cached
        https://bugs.webkit.org/show_bug.cgi?id=83925
        <rdar://problem/11231790>

        Reviewed by Antti Koivisto.

        Added subtests to http/tests/cache/subresource-expiration-2.html.

        * platform/network/ResourceResponseBase.cpp:
        (WebCore::ResourceResponseBase::parseCacheControlDirectives): Honor first max-age
        instead of the last. New behavior matches both Firefox and IE.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (114164 => 114165)


--- trunk/LayoutTests/ChangeLog	2012-04-13 20:43:24 UTC (rev 114164)
+++ trunk/LayoutTests/ChangeLog	2012-04-13 20:57:10 UTC (rev 114165)
@@ -1,3 +1,15 @@
+2012-04-13  Alexey Proskuryakov  <a...@apple.com>
+
+        REGRESSION (XHR Caching): Uncacheable responses sent by Rails through Apache are cached
+        https://bugs.webkit.org/show_bug.cgi?id=83925
+        <rdar://problem/11231790>
+
+        Reviewed by Antti Koivisto.
+
+        * http/tests/cache/subresource-expiration-2-expected.txt:
+        * http/tests/cache/subresource-expiration-2.html:
+        Added tests for multiple max-age directives.
+
 2012-04-13  Rob Flack  <fla...@chromium.org>
 
         Chromium: Should enable -webkit-image-set

Modified: trunk/LayoutTests/http/tests/cache/subresource-expiration-2-expected.txt (114164 => 114165)


--- trunk/LayoutTests/http/tests/cache/subresource-expiration-2-expected.txt	2012-04-13 20:43:24 UTC (rev 114164)
+++ trunk/LayoutTests/http/tests/cache/subresource-expiration-2-expected.txt	2012-04-13 20:57:10 UTC (rev 114165)
@@ -4,6 +4,8 @@
 Age: 100; Cache-control: max-age=10; (result=Uncached expected=Uncached) PASS
 Age: 1; Cache-control: max-age=10; (result=Cached expected=Cached) PASS
 Cache-control: max-age=10; Pragma: no-cache; (result=Uncached expected=Uncached) PASS
+Cache-control: max-age=0, private, must-revalidate, max-age=60; (result=Uncached expected=Uncached) PASS
+Cache-control: max-age=60, private, must-revalidate, max-age=0; (result=Cached expected=Cached) PASS
 Expires: [now-10s]; Cache-control: max-age=10; (result=Cached expected=Cached) PASS
 Expires: [now+10s]; Cache-control: max-age=0; (result=Uncached expected=Uncached) PASS
 Last-modified: [now-3600s]; [delay=1.5s] (result=Cached expected=Cached) PASS

Modified: trunk/LayoutTests/http/tests/cache/subresource-expiration-2.html (114164 => 114165)


--- trunk/LayoutTests/http/tests/cache/subresource-expiration-2.html	2012-04-13 20:43:24 UTC (rev 114164)
+++ trunk/LayoutTests/http/tests/cache/subresource-expiration-2.html	2012-04-13 20:57:10 UTC (rev 114165)
@@ -44,6 +44,18 @@
     },
     {
         testHeaders: {
+            'Cache-control': 'max-age=0, private, must-revalidate, max-age=60',
+        },
+        expectedResult: 'Uncached',
+    },
+    {
+        testHeaders: {
+            'Cache-control': 'max-age=60, private, must-revalidate, max-age=0',
+        },
+        expectedResult: 'Cached',
+    },
+    {
+        testHeaders: {
             'Expires': '[now-10s]',
             'Cache-control': 'max-age=10'
         },

Modified: trunk/Source/WebCore/ChangeLog (114164 => 114165)


--- trunk/Source/WebCore/ChangeLog	2012-04-13 20:43:24 UTC (rev 114164)
+++ trunk/Source/WebCore/ChangeLog	2012-04-13 20:57:10 UTC (rev 114165)
@@ -1,3 +1,17 @@
+2012-04-13  Alexey Proskuryakov  <a...@apple.com>
+
+        REGRESSION (XHR Caching): Uncacheable responses sent by Rails through Apache are cached
+        https://bugs.webkit.org/show_bug.cgi?id=83925
+        <rdar://problem/11231790>
+
+        Reviewed by Antti Koivisto.
+
+        Added subtests to http/tests/cache/subresource-expiration-2.html.
+
+        * platform/network/ResourceResponseBase.cpp:
+        (WebCore::ResourceResponseBase::parseCacheControlDirectives): Honor first max-age
+        instead of the last. New behavior matches both Firefox and IE.
+
 2012-04-13  James Robinson  <jam...@chromium.org>
 
         [chromium] Move WebVideoFrame into Platform and remove WebCore::VideoFrameChromium wrapper API

Modified: trunk/Source/WebCore/platform/network/ResourceResponseBase.cpp (114164 => 114165)


--- trunk/Source/WebCore/platform/network/ResourceResponseBase.cpp	2012-04-13 20:43:24 UTC (rev 114164)
+++ trunk/Source/WebCore/platform/network/ResourceResponseBase.cpp	2012-04-13 20:57:10 UTC (rev 114165)
@@ -339,6 +339,10 @@
             else if (equalIgnoringCase(directives[i].first, mustRevalidateDirective))
                 m_cacheControlContainsMustRevalidate = true;
             else if (equalIgnoringCase(directives[i].first, maxAgeDirective)) {
+                if (!isnan(m_cacheControlMaxAge)) {
+                    // First max-age directive wins if there are multiple ones.
+                    continue;
+                }
                 bool ok;
                 double maxAge = directives[i].second.toDouble(&ok);
                 if (ok)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to