From: ap@apple.com Date: Fri, 13 Apr 2012 20:57:10 +0000 (+0000) Subject: REGRESSION (XHR Caching): Uncacheable responses sent by Rails through Apache... X-Git-Tag: 070512121124~7015 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f9a5b94d79c28aca96df66170f0b9dbac2dd719c;p=profile%2Fivi%2Fwebkit-efl.git REGRESSION (XHR Caching): Uncacheable responses sent by Rails through Apache are cached https://bugs.webkit.org/show_bug.cgi?id=83925 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. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@114165 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog index b14a4e6..2695af2 100644 --- a/LayoutTests/ChangeLog +++ b/LayoutTests/ChangeLog @@ -1,3 +1,15 @@ +2012-04-13 Alexey Proskuryakov + + REGRESSION (XHR Caching): Uncacheable responses sent by Rails through Apache are cached + https://bugs.webkit.org/show_bug.cgi?id=83925 + + + 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 Chromium: Should enable -webkit-image-set diff --git a/LayoutTests/http/tests/cache/subresource-expiration-2-expected.txt b/LayoutTests/http/tests/cache/subresource-expiration-2-expected.txt index 070bd4e..789295e 100644 --- a/LayoutTests/http/tests/cache/subresource-expiration-2-expected.txt +++ b/LayoutTests/http/tests/cache/subresource-expiration-2-expected.txt @@ -4,6 +4,8 @@ Cache-control: max-age=10, must-revalidate; (result=Cached expected=Cached) PASS 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 diff --git a/LayoutTests/http/tests/cache/subresource-expiration-2.html b/LayoutTests/http/tests/cache/subresource-expiration-2.html index cea82c1..7975600 100644 --- a/LayoutTests/http/tests/cache/subresource-expiration-2.html +++ b/LayoutTests/http/tests/cache/subresource-expiration-2.html @@ -44,6 +44,18 @@ tests = [ }, { 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' }, diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index 15e9e65..087797e 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,17 @@ +2012-04-13 Alexey Proskuryakov + + REGRESSION (XHR Caching): Uncacheable responses sent by Rails through Apache are cached + https://bugs.webkit.org/show_bug.cgi?id=83925 + + + 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 [chromium] Move WebVideoFrame into Platform and remove WebCore::VideoFrameChromium wrapper API diff --git a/Source/WebCore/platform/network/ResourceResponseBase.cpp b/Source/WebCore/platform/network/ResourceResponseBase.cpp index 67d8203..1247843 100644 --- a/Source/WebCore/platform/network/ResourceResponseBase.cpp +++ b/Source/WebCore/platform/network/ResourceResponseBase.cpp @@ -339,6 +339,10 @@ void ResourceResponseBase::parseCacheControlDirectives() const 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)