Changeset 190418 in webkit


Ignore:
Timestamp:
Oct 1, 2015 11:09:07 AM (9 years ago)
Author:
Antti Koivisto
Message:

Network cache: Subresource referer header wrong after cached redirect
https://bugs.webkit.org/show_bug.cgi?id=149709
rdar://problem/22917174

Reviewed by Chris Dumez.

Source/WebKit2:

If a main resource is loaded from a cache entry that involved redirects the document
will end up setting the Referer-headers of the subresources to the request URL not the redirected URL

  • NetworkProcess/NetworkResourceLoader.cpp:

(WebKit::NetworkResourceLoader::didRetrieveCacheEntry):

If a cache entry involved a redirect synthesize a minimal willSendRequest message so that WebCore side
runs through the same code paths as when receiving a redirect from network.

LayoutTests:

  • http/tests/cache/redirect-referer-expected.html: Added.
  • http/tests/cache/redirect-referer.html: Added.
  • http/tests/cache/resources/load-and-check-referer.php: Added.
  • http/tests/cache/resources/permanent-redirect.php: Added.
  • http/tests/cache/resources/redirect-referer-iframe.html: Added.
  • http/tests/cache/resources/redirect-referer-iframe-expected.html: Added.
Location:
trunk
Files:
6 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r190417 r190418  
     12015-10-01  Antti Koivisto  <antti@apple.com>
     2
     3        Network cache: Subresource referer header wrong after cached redirect
     4        https://bugs.webkit.org/show_bug.cgi?id=149709
     5        rdar://problem/22917174
     6
     7        Reviewed by Chris Dumez.
     8
     9        * http/tests/cache/redirect-referer-expected.html: Added.
     10        * http/tests/cache/redirect-referer.html: Added.
     11        * http/tests/cache/resources/load-and-check-referer.php: Added.
     12        * http/tests/cache/resources/permanent-redirect.php: Added.
     13        * http/tests/cache/resources/redirect-referer-iframe.html: Added.
     14        * http/tests/cache/resources/redirect-referer-iframe-expected.html: Added.
     15
    1162015-10-01  Myles C. Maxfield  <mmaxfield@apple.com>
    217
  • trunk/Source/WebKit2/ChangeLog

    r190413 r190418  
     12015-10-01  Antti Koivisto  <antti@apple.com>
     2
     3        Network cache: Subresource referer header wrong after cached redirect
     4        https://bugs.webkit.org/show_bug.cgi?id=149709
     5        rdar://problem/22917174
     6
     7        Reviewed by Chris Dumez.
     8
     9        If a main resource is loaded from a cache entry that involved redirects the document
     10        will end up setting the Referer-headers of the subresources to the request URL not the redirected URL
     11
     12        * NetworkProcess/NetworkResourceLoader.cpp:
     13        (WebKit::NetworkResourceLoader::didRetrieveCacheEntry):
     14
     15            If a cache entry involved a redirect synthesize a minimal willSendRequest message so that WebCore side
     16            runs through the same code paths as when receiving a redirect from network.
     17
    1182015-10-01  Carlos Garcia Campos  <cgarcia@igalia.com>
    219
  • trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp

    r190320 r190418  
    571571        sendReplyToSynchronousRequest(*m_synchronousLoadData, entry->buffer());
    572572    } else {
     573        if (entry->response().url() != originalRequest().url()) {
     574            // This is a cached redirect. Synthesize a minimal redirect so we get things like referer header right.
     575            // FIXME: We should cache the actual redirects.
     576            ResourceRequest syntheticRedirectRequest(entry->response().url());
     577            ResourceResponse syntheticRedirectResponse(originalRequest().url(), { }, 0, { });
     578            sendAbortingOnFailure(Messages::WebResourceLoader::WillSendRequest(syntheticRedirectRequest, syntheticRedirectResponse));
     579        }
     580
    573581        bool needsContinueDidReceiveResponseMessage = originalRequest().requester() == ResourceRequest::Requester::Main;
    574582        sendAbortingOnFailure(Messages::WebResourceLoader::DidReceiveResponse(entry->response(), needsContinueDidReceiveResponseMessage));
Note: See TracChangeset for help on using the changeset viewer.