Changeset 116160 in webkit


Ignore:
Timestamp:
May 4, 2012 1:28:16 PM (12 years ago)
Author:
commit-queue@webkit.org
Message:

[soup] URL of the ResourceResponse passed to willSendRequest is incorrect
https://bugs.webkit.org/show_bug.cgi?id=85072

Patch by Christophe Dumez <Christophe Dumez> on 2012-05-04
Reviewed by Gustavo Noronha Silva.

Source/WebCore:

Store the response message by catching the "got-headers" signal so
that it can be passed later to willSendRequest() in case of
redirection. This is required because the SoupMessage headers and URL
have already been updated once restartedCallback() is called.

  • platform/network/soup/ResourceHandleSoup.cpp:

(WebCore):
(WebCore::gotHeadersCallback):
(WebCore::restartedCallback):
(WebCore::sendRequestCallback):
(WebCore::startHTTPRequest):

LayoutTests:

Unskip http/tests/misc/will-send-request-returns-null-on-redirect.html
and http/tests/loading/307-after-303-after-post.html now that the
response passed to willSendRequest is correct and now that the right
redirect URL is being printed in EFL port.

Unfortunately, http/tests/loading/redirect-methods.html cannot be
unskipped yet due to bug 66873.

  • platform/efl/test_expectations.txt:
Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r116159 r116160  
     12012-05-04  Christophe Dumez  <christophe.dumez@intel.com>
     2
     3        [soup] URL of the ResourceResponse passed to willSendRequest is incorrect
     4        https://bugs.webkit.org/show_bug.cgi?id=85072
     5
     6        Reviewed by Gustavo Noronha Silva.
     7
     8        Unskip http/tests/misc/will-send-request-returns-null-on-redirect.html
     9        and http/tests/loading/307-after-303-after-post.html now that the
     10        response passed to willSendRequest is correct and now that the right
     11        redirect URL is being printed in EFL port.
     12
     13        Unfortunately, http/tests/loading/redirect-methods.html cannot be
     14        unskipped yet due to bug 66873.
     15
     16        * platform/efl/test_expectations.txt:
     17
    1182012-05-04  Csaba Osztrogonác  <ossy@webkit.org>
    219
  • trunk/LayoutTests/platform/efl/test_expectations.txt

    r116119 r116160  
    264264BUGWK85492 : css3/zoom-coords.xhtml = TEXT
    265265
    266 // Redirect response URL is not the one expected
    267 BUGWK85072 : http/tests/misc/will-send-request-returns-null-on-redirect.html = TEXT
    268 BUGWK85072 : http/tests/loading/307-after-303-after-post.html = TEXT
    269 BUGWK85072 : http/tests/loading/redirect-methods.html = TEXT
     266// Occasionally missing chunks of output
     267BUGWK66873:  http/tests/loading/redirect-methods.html = TEXT
    270268
    271269// No support for overriding WebKitLoadSiteIconsKey
  • trunk/Source/WebCore/ChangeLog

    r116152 r116160  
     12012-05-04  Christophe Dumez  <christophe.dumez@intel.com>
     2
     3        [soup] URL of the ResourceResponse passed to willSendRequest is incorrect
     4        https://bugs.webkit.org/show_bug.cgi?id=85072
     5
     6        Reviewed by Gustavo Noronha Silva.
     7
     8        Store the response message by catching the "got-headers" signal so
     9        that it can be passed later to willSendRequest() in case of
     10        redirection. This is required because the SoupMessage headers and URL
     11        have already been updated once restartedCallback() is called.
     12
     13        * platform/network/soup/ResourceHandleSoup.cpp:
     14        (WebCore):
     15        (WebCore::gotHeadersCallback):
     16        (WebCore::restartedCallback):
     17        (WebCore::sendRequestCallback):
     18        (WebCore::startHTTPRequest):
     19
    1202012-05-04  Ian Vollick  <vollick@chromium.org>
    221
  • trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp

    r116117 r116160  
    216216}
    217217
     218static void gotHeadersCallback(SoupMessage* msg, gpointer data)
     219{
     220    ResourceHandle* handle = static_cast<ResourceHandle*>(data);
     221    if (!handle)
     222        return;
     223    ResourceHandleInternal* d = handle->getInternal();
     224    if (d->m_cancelled)
     225        return;
     226
     227#if ENABLE(WEB_TIMING)
     228    if (d->m_response.resourceLoadTiming())
     229        d->m_response.resourceLoadTiming()->receiveHeadersEnd = milisecondsSinceRequest(d->m_response.resourceLoadTiming()->requestTime);
     230#endif
     231
     232    // The original response will be needed later to feed to willSendRequest in
     233    // restartedCallback() in case we are redirected. For this reason, so we store it
     234    // here.
     235    ResourceResponse response;
     236    response.updateFromSoupMessage(msg);
     237
     238    d->m_response = response;
     239}
     240
    218241// Called each time the message is going to be sent again except the first time.
    219242// It's used mostly to let webkit know about redirects.
     
    232255
    233256    ResourceRequest request = handle->firstRequest();
    234     ResourceResponse response;
    235257    request.setURL(newURL);
    236258    request.setHTTPMethod(msg->method);
    237     response.updateFromSoupMessage(msg);
    238259
    239260    // Should not set Referer after a redirect from a secure resource to non-secure one.
     
    244265
    245266    if (d->client())
    246         d->client()->willSendRequest(handle, request, response);
     267        d->client()->willSendRequest(handle, request, d->m_response);
    247268
    248269    if (d->m_cancelled)
     
    345366        return;
    346367    }
    347 
    348 #if ENABLE(WEB_TIMING)
    349     if (d->m_response.resourceLoadTiming())
    350         d->m_response.resourceLoadTiming()->receiveHeadersEnd = milisecondsSinceRequest(d->m_response.resourceLoadTiming()->requestTime);
    351 #endif
    352368
    353369    GOwnPtr<GError> error;
     
    613629        soup_message_disable_feature(soupMessage, SOUP_TYPE_CONTENT_SNIFFER);
    614630
     631    g_signal_connect(soupMessage, "got-headers", G_CALLBACK(gotHeadersCallback), handle);
    615632    g_signal_connect(soupMessage, "restarted", G_CALLBACK(restartedCallback), handle);
    616633    g_signal_connect(soupMessage, "wrote-body-data", G_CALLBACK(wroteBodyDataCallback), handle);
Note: See TracChangeset for help on using the changeset viewer.