Title: [116160] trunk
Revision
116160
Author
[email protected]
Date
2012-05-04 13:28:16 -0700 (Fri, 04 May 2012)

Log Message

[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: trunk/LayoutTests/ChangeLog (116159 => 116160)


--- trunk/LayoutTests/ChangeLog	2012-05-04 20:20:04 UTC (rev 116159)
+++ trunk/LayoutTests/ChangeLog	2012-05-04 20:28:16 UTC (rev 116160)
@@ -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-05-04  Csaba Osztrogonác  <[email protected]>
 
         REGRESSION(r116134): It made 3 inspector tests fail

Modified: trunk/LayoutTests/platform/efl/test_expectations.txt (116159 => 116160)


--- trunk/LayoutTests/platform/efl/test_expectations.txt	2012-05-04 20:20:04 UTC (rev 116159)
+++ trunk/LayoutTests/platform/efl/test_expectations.txt	2012-05-04 20:28:16 UTC (rev 116160)
@@ -263,10 +263,8 @@
 
 BUGWK85492 : css3/zoom-coords.xhtml = TEXT
 
-// Redirect response URL is not the one expected
-BUGWK85072 : http/tests/misc/will-send-request-returns-null-on-redirect.html = TEXT
-BUGWK85072 : http/tests/loading/307-after-303-after-post.html = TEXT
-BUGWK85072 : http/tests/loading/redirect-methods.html = TEXT
+// Occasionally missing chunks of output
+BUGWK66873:  http/tests/loading/redirect-methods.html = TEXT
 
 // No support for overriding WebKitLoadSiteIconsKey
 BUGWK85171 : http/tests/misc/favicon-loads-with-icon-loading-override.html = TEXT

Modified: trunk/Source/WebCore/ChangeLog (116159 => 116160)


--- trunk/Source/WebCore/ChangeLog	2012-05-04 20:20:04 UTC (rev 116159)
+++ trunk/Source/WebCore/ChangeLog	2012-05-04 20:28:16 UTC (rev 116160)
@@ -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-04  Ian Vollick  <[email protected]>
 
         [chromium] CCProxy's shouldn't try to draw if there is no layer renderer

Modified: trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp (116159 => 116160)


--- trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp	2012-05-04 20:20:04 UTC (rev 116159)
+++ trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp	2012-05-04 20:28:16 UTC (rev 116160)
@@ -215,6 +215,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)
@@ -231,10 +254,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")) {
@@ -243,7 +264,7 @@
     }
 
     if (d->client())
-        d->client()->willSendRequest(handle, request, response);
+        d->client()->willSendRequest(handle, request, d->m_response);
 
     if (d->m_cancelled)
         return;
@@ -345,11 +366,6 @@
         return;
     }
 
-#if ENABLE(WEB_TIMING)
-    if (d->m_response.resourceLoadTiming())
-        d->m_response.resourceLoadTiming()->receiveHeadersEnd = milisecondsSinceRequest(d->m_response.resourceLoadTiming()->requestTime);
-#endif
-
     GOwnPtr<GError> error;
     GInputStream* in = soup_request_send_finish(d->m_soupRequest.get(), res, &error.outPtr());
     if (error) {
@@ -612,6 +628,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