Changeset 73489 in webkit


Ignore:
Timestamp:
Dec 7, 2010 8:33:10 PM (13 years ago)
Author:
commit-queue@webkit.org
Message:

2010-12-07 Sergio Villar Senin <svillar@igalia.com>

Reviewed by Xan Lopez.

[GTK] WebKitSoupCache fails to load resources when cache contents are externally removed
https://bugs.webkit.org/show_bug.cgi?id=50577

Try to download cached resources again if they are no longer
accesible by the cache.

  • platform/network/soup/cache/soup-request-http.c: (send_async_cb): (webkit_soup_request_http_send_async):
Location:
trunk/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r73488 r73489  
     12010-12-07  Sergio Villar Senin  <svillar@igalia.com>
     2
     3        Reviewed by Xan Lopez.
     4
     5        [GTK] WebKitSoupCache fails to load resources when cache contents are externally removed
     6        https://bugs.webkit.org/show_bug.cgi?id=50577
     7
     8        Try to download cached resources again if they are no longer
     9        accesible by the cache.
     10
     11        * platform/network/soup/cache/soup-request-http.c:
     12        (send_async_cb):
     13        (webkit_soup_request_http_send_async):
     14
    1152010-12-06  MORITA Hajime  <morrita@google.com>
    216
  • trunk/WebCore/platform/network/soup/cache/soup-request-http.c

    r72762 r73489  
    189189        GAsyncReadyCallback callback;
    190190        gpointer user_data;
     191        WebKitSoupHTTPInputStream *httpstream;
    191192} SendAsyncHelper;
    192193
     
    200201{
    201202        GSimpleAsyncResult *simple;
    202         WebKitSoupHTTPInputStream *httpstream;
    203         SoupSession *session;
    204         WebKitSoupCache *cache;
    205203        SendAsyncHelper *helper = (SendAsyncHelper *)data;
    206 
    207         session = webkit_soup_request_get_session (WEBKIT_SOUP_REQUEST (helper->http));
    208         cache = (WebKitSoupCache *)soup_session_get_feature (session, WEBKIT_TYPE_SOUP_CACHE);
    209 
    210         httpstream = (WebKitSoupHTTPInputStream *)webkit_soup_cache_send_response (cache, SOUP_MESSAGE (helper->http->priv->msg));
    211 
    212         if (httpstream) {
    213                 const gchar *content_type;
    214 
    215                 simple = g_simple_async_result_new (G_OBJECT (helper->http),
    216                                                     helper->callback, helper->user_data,
    217                                                     webkit_soup_request_http_send_async);
    218                 g_simple_async_result_set_op_res_gpointer (simple, httpstream, g_object_unref);
    219 
    220                 /* Update message status */
    221                 soup_message_set_status (helper->http->priv->msg, SOUP_STATUS_OK);
    222 
    223                 /* Issue signals  */
    224                 soup_message_got_headers (helper->http->priv->msg);
    225 
    226                 /* FIXME: Uncomment this when this becomes part of libsoup
    227                  * if (!soup_message_disables_feature(helper->http->priv->msg, SOUP_TYPE_CONTENT_SNIFFER)) {
    228                  *      const gchar *content_type = soup_message_headers_get_content_type (helper->http->priv->msg->response_headers, NULL);
    229                  *      soup_message_content_sniffed (helper->http->priv->msg, content_type, NULL);
    230                  * }
    231                  */
    232                 content_type = soup_message_headers_get_content_type (helper->http->priv->msg->response_headers, NULL);
    233                 soup_message_content_sniffed (helper->http->priv->msg, content_type, NULL);
    234 
    235                 g_simple_async_result_complete (simple);
    236 
    237                 soup_message_finished (helper->http->priv->msg);
    238 
    239                 g_object_unref (simple);
    240         }
     204        const gchar *content_type;
     205
     206        simple = g_simple_async_result_new (G_OBJECT (helper->http),
     207                                            helper->callback, helper->user_data,
     208                                            webkit_soup_request_http_send_async);
     209        g_simple_async_result_set_op_res_gpointer (simple, helper->httpstream, g_object_unref);
     210
     211        /* Update message status */
     212        soup_message_set_status (helper->http->priv->msg, SOUP_STATUS_OK);
     213
     214        /* Issue signals  */
     215        soup_message_got_headers (helper->http->priv->msg);
     216
     217        /* FIXME: Uncomment this when this becomes part of libsoup
     218         * if (!soup_message_disables_feature(helper->http->priv->msg, SOUP_TYPE_CONTENT_SNIFFER)) {
     219         *      const gchar *content_type = soup_message_headers_get_content_type (helper->http->priv->msg->response_headers, NULL);
     220         *      soup_message_content_sniffed (helper->http->priv->msg, content_type, NULL);
     221         * }
     222         */
     223        content_type = soup_message_headers_get_content_type (helper->http->priv->msg->response_headers, NULL);
     224        soup_message_content_sniffed (helper->http->priv->msg, content_type, NULL);
     225
     226        g_simple_async_result_complete (simple);
     227
     228        soup_message_finished (helper->http->priv->msg);
     229
     230        g_object_unref (simple);
    241231
    242232        g_object_unref (helper->http);
     
    266256                response = webkit_soup_cache_has_response (cache, http->priv->msg);
    267257                if (response == WEBKIT_SOUP_CACHE_RESPONSE_FRESH) {
    268                         /* Do return the stream asynchronously as in
    269                            the other cases. It's not enough to use
    270                            g_simple_async_result_complete_in_idle as
    271                            the signals must be also emitted
    272                            asynchronously */
    273                         SendAsyncHelper *helper = g_slice_new (SendAsyncHelper);
    274                         helper->http = g_object_ref (http);
    275                         helper->callback = callback;
    276                         helper->user_data = user_data;
    277                         g_timeout_add (0, send_async_cb, helper);
    278                         return;
     258                        WebKitSoupHTTPInputStream *httpstream;
     259
     260                        httpstream = (WebKitSoupHTTPInputStream *)
     261                                webkit_soup_cache_send_response (cache, SOUP_MESSAGE (http->priv->msg));
     262
     263                        /* Cached resource file could have been deleted outside
     264                         */
     265                        if (httpstream) {
     266                                /* Do return the stream asynchronously as in
     267                                 * the other cases. It's not enough to use
     268                                 * g_simple_async_result_complete_in_idle as
     269                                 * the signals must be also emitted
     270                                 * asynchronously
     271                                 */
     272                                SendAsyncHelper *helper = g_slice_new (SendAsyncHelper);
     273                                helper->http = g_object_ref (http);
     274                                helper->callback = callback;
     275                                helper->user_data = user_data;
     276                                helper->httpstream = httpstream;
     277                                g_timeout_add (0, send_async_cb, helper);
     278                                return;
     279                        }
    279280                } else if (response == WEBKIT_SOUP_CACHE_RESPONSE_NEEDS_VALIDATION) {
    280281                        SoupMessage *conditional_msg;
Note: See TracChangeset for help on using the changeset viewer.