Changeset 155203 in webkit


Ignore:
Timestamp:
Sep 6, 2013, 12:18:03 PM (12 years ago)
Author:
ap@apple.com
Message:

2013-09-06 Mike West <mkwst@chromium.org>

Revalidation header blacklisting should be case-insensitive.
https://bugs.webkit.org/show_bug.cgi?id=120832

Reviewed by Alexey Proskuryakov.

Headers like 'content-type' should be ignored for 304 responses,
even if they are delivered as 'Content-Type', or 'CoNtEnT-TyPe', etc.

I broke this behavior in http://trac.webkit.org/changeset/142068
("Entity-header extension headers honored on 304 responses"). Pages like
https://learndev.unm.edu/ currently break on reload, as they incorrectly
send 'Content-Type: text/plain' for 304 responses for resources like
CSS and JavaScript. The browser should drop these headers, but because
we're comparing in a case-sensitive fashion, we don't.

https://code.google.com/p/chromium/issues/detail?id=246875 documents the
Blink-side fix; this patch is a port of that patch.

Test: http/tests/cache/content-type-ignored-during-revalidation.html

  • loader/cache/CachedResource.cpp: (WebCore::shouldUpdateHeaderAfterRevalidation): Compare the provided AtomicString 'header' to the revalidation blacklists in a case-insensitive fashion.
Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r155199 r155203  
     12013-09-06  Mike West  <mkwst@chromium.org>
     2
     3        Revalidation header blacklisting should be case-insensitive.
     4        https://bugs.webkit.org/show_bug.cgi?id=120832
     5
     6        Reviewed by Alexey Proskuryakov.
     7
     8        Headers like 'content-type' should be ignored for 304 responses,
     9        even if they are delivered as 'Content-Type', or 'CoNtEnT-TyPe', etc.
     10
     11        I broke this behavior in http://trac.webkit.org/changeset/142068
     12        ("Entity-header extension headers honored on 304 responses"). Pages like
     13        https://learndev.unm.edu/ currently break on reload, as they incorrectly
     14        send 'Content-Type: text/plain' for 304 responses for resources like
     15        CSS and JavaScript. The browser should drop these headers, but because
     16        we're comparing in a case-sensitive fashion, we don't.
     17
     18        https://code.google.com/p/chromium/issues/detail?id=246875 documents the
     19        Blink-side fix; this patch is a port of that patch.
     20
     21        Test: http/tests/cache/content-type-ignored-during-revalidation.html
     22
     23        * loader/cache/CachedResource.cpp:
     24        (WebCore::shouldUpdateHeaderAfterRevalidation):
     25        Compare the provided AtomicString 'header' to the revalidation
     26        blacklists in a case-insensitive fashion.
     27
    1282013-09-06  Eric Carlson  <eric.carlson@apple.com>
    229
  • trunk/Source/WebCore/loader/cache/CachedResource.cpp

    r154142 r155203  
    9191{
    9292    for (size_t i = 0; i < WTF_ARRAY_LENGTH(headersToIgnoreAfterRevalidation); i++) {
    93         if (header == headersToIgnoreAfterRevalidation[i])
     93        if (equalIgnoringCase(header, headersToIgnoreAfterRevalidation[i]))
    9494            return false;
    9595    }
    9696    for (size_t i = 0; i < WTF_ARRAY_LENGTH(headerPrefixesToIgnoreAfterRevalidation); i++) {
    97         if (header.startsWith(headerPrefixesToIgnoreAfterRevalidation[i]))
     97        if (header.startsWith(headerPrefixesToIgnoreAfterRevalidation[i], false))
    9898            return false;
    9999    }
Note: See TracChangeset for help on using the changeset viewer.