Title: [122007] releases/WebKitGTK/webkit-1.8
Revision
122007
Author
[email protected]
Date
2012-07-06 13:03:28 -0700 (Fri, 06 Jul 2012)

Log Message

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

Patch by Christophe Dumez <[email protected]> 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:

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-1.8/LayoutTests/ChangeLog (122006 => 122007)


--- releases/WebKitGTK/webkit-1.8/LayoutTests/ChangeLog	2012-07-06 20:03:21 UTC (rev 122006)
+++ releases/WebKitGTK/webkit-1.8/LayoutTests/ChangeLog	2012-07-06 20:03:28 UTC (rev 122007)
@@ -1,3 +1,20 @@
+2012-05-04  Christophe Dumez  <[email protected]>
+
+        [soup] URL of the ResourceResponse passed to willSendRequest is incorrect
+        https://bugs.webkit.org/show_bug.cgi?id=85072
+
+        Reviewed by Gustavo Noronha Silva.
+
+        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:
+
 2012-03-09  Abhishek Arya  <[email protected]>
 
         Crash when splitting an anonymous block in multi-column layout.

Modified: releases/WebKitGTK/webkit-1.8/Source/WebCore/ChangeLog (122006 => 122007)


--- releases/WebKitGTK/webkit-1.8/Source/WebCore/ChangeLog	2012-07-06 20:03:21 UTC (rev 122006)
+++ releases/WebKitGTK/webkit-1.8/Source/WebCore/ChangeLog	2012-07-06 20:03:28 UTC (rev 122007)
@@ -1,3 +1,22 @@
+2012-05-04  Christophe Dumez  <[email protected]>
+
+        [soup] URL of the ResourceResponse passed to willSendRequest is incorrect
+        https://bugs.webkit.org/show_bug.cgi?id=85072
+
+        Reviewed by Gustavo Noronha Silva.
+
+        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):
+
 2012-05-14  Sriram Neelakandan  <[email protected]>
 
         [Gtk][DOM Bindings] Feature-protected interface usage in set/get property must be under condition guards

Modified: releases/WebKitGTK/webkit-1.8/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp (122006 => 122007)


--- releases/WebKitGTK/webkit-1.8/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp	2012-07-06 20:03:21 UTC (rev 122006)
+++ releases/WebKitGTK/webkit-1.8/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp	2012-07-06 20:03:28 UTC (rev 122007)
@@ -212,6 +212,29 @@
     g_object_set_data(G_OBJECT(session), "webkit-init", reinterpret_cast<void*>(0xdeadbeef));
 }
 
+static void gotHeadersCallback(SoupMessage* msg, gpointer data)
+{
+    ResourceHandle* handle = static_cast<ResourceHandle*>(data);
+    if (!handle)
+        return;
+    ResourceHandleInternal* d = handle->getInternal();
+    if (d->m_cancelled)
+        return;
+
+#if ENABLE(WEB_TIMING)
+    if (d->m_response.resourceLoadTiming())
+        d->m_response.resourceLoadTiming()->receiveHeadersEnd = milisecondsSinceRequest(d->m_response.resourceLoadTiming()->requestTime);
+#endif
+
+    // The original response will be needed later to feed to willSendRequest in
+    // restartedCallback() in case we are redirected. For this reason, so we store it
+    // here.
+    ResourceResponse response;
+    response.updateFromSoupMessage(msg);
+
+    d->m_response = response;
+}
+
 // Called each time the message is going to be sent again except the first time.
 // It's used mostly to let webkit know about redirects.
 static void restartedCallback(SoupMessage* msg, gpointer data)
@@ -228,10 +251,8 @@
     KURL newURL = KURL(handle->firstRequest().url(), location);
 
     ResourceRequest request = handle->firstRequest();
-    ResourceResponse response;
     request.setURL(newURL);
     request.setHTTPMethod(msg->method);
-    response.updateFromSoupMessage(msg);
 
     // Should not set Referer after a redirect from a secure resource to non-secure one.
     if (!request.url().protocolIs("https") && protocolIs(request.httpReferrer(), "https")) {
@@ -240,7 +261,7 @@
     }
 
     if (d->client())
-        d->client()->willSendRequest(handle, request, response);
+        d->client()->willSendRequest(handle, request, d->m_response);
 
     if (d->m_cancelled)
         return;
@@ -502,6 +523,7 @@
     if (!handle->shouldContentSniff())
         soup_message_disable_feature(soupMessage, SOUP_TYPE_CONTENT_SNIFFER);
 
+    g_signal_connect(soupMessage, "got-headers", G_CALLBACK(gotHeadersCallback), handle);
     g_signal_connect(soupMessage, "restarted", G_CALLBACK(restartedCallback), handle);
     g_signal_connect(soupMessage, "wrote-body-data", G_CALLBACK(wroteBodyDataCallback), handle);
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to