Changeset 75967 in webkit


Ignore:
Timestamp:
Jan 17, 2011 12:47:08 PM (13 years ago)
Author:
sergio@webkit.org
Message:

2011-01-17 Sergio Villar Senin <svillar@igalia.com>

Reviewed by Martin Robinson.

[Gtk] No need to content sniff 304 Not Modified responses
https://bugs.webkit.org/show_bug.cgi?id=52570

Makes no sense to wait for the outcome of content sniffing when WebCore
is validating resources. If we get a 304 Not Modified it means that we can
safely use the cached version of the resource we're asking for.

No new tests because it does not change functionality, it just
calls didReceiveResponse sooner for 304 Not Modified responses.

  • platform/network/soup/ResourceHandleSoup.cpp: (WebCore::gotHeadersCallback):
Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r75966 r75967  
     12011-01-17  Sergio Villar Senin  <svillar@igalia.com>
     2
     3        Reviewed by Martin Robinson.
     4
     5        [Gtk] No need to content sniff 304 Not Modified responses
     6        https://bugs.webkit.org/show_bug.cgi?id=52570
     7
     8        Makes no sense to wait for the outcome of content sniffing when WebCore
     9        is validating resources. If we get a 304 Not Modified it means that we can
     10        safely use the cached version of the resource we're asking for.
     11
     12        No new tests because it does not change functionality, it just
     13        calls didReceiveResponse sooner for 304 Not Modified responses.
     14
     15        * platform/network/soup/ResourceHandleSoup.cpp:
     16        (WebCore::gotHeadersCallback):
     17
    1182011-01-17  Jessie Berlin  <jberlin@apple.com>
    219
  • trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp

    r75009 r75967  
    216216}
    217217
     218static void contentSniffedCallback(SoupMessage*, const char*, GHashTable*, gpointer);
     219
    218220static void gotHeadersCallback(SoupMessage* msg, gpointer data)
    219221{
     
    236238    // The content-sniffed callback will handle the response if WebCore
    237239    // require us to sniff.
    238     if (!handle || statusWillBeHandledBySoup(msg->status_code) || handle->shouldContentSniff())
    239         return;
     240    if (!handle || statusWillBeHandledBySoup(msg->status_code))
     241        return;
     242
     243    if (handle->shouldContentSniff()) {
     244        // Avoid MIME type sniffing if the response comes back as 304 Not Modified.
     245        if (msg->status_code == SOUP_STATUS_NOT_MODIFIED) {
     246            soup_message_disable_feature(msg, SOUP_TYPE_CONTENT_SNIFFER);
     247            g_signal_handlers_disconnect_by_func(msg, reinterpret_cast<gpointer>(contentSniffedCallback), handle.get());
     248        } else
     249            return;
     250    }
    240251
    241252    ResourceHandleInternal* d = handle->getInternal();
Note: See TracChangeset for help on using the changeset viewer.