Skip to content
Permalink
Browse files
[soup] URL of the ResourceResponse passed to willSendRequest is incor…
…rect

https://bugs.webkit.org/show_bug.cgi?id=85072

Patch by Christophe Dumez <christophe.dumez@intel.com> 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:

Canonical link: https://commits.webkit.org/103228@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@116160 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
cdumez authored and webkit-commit-queue committed May 4, 2012
1 parent 76b3170 commit fff091a05d25b15d474b3223bbe1412fcfb09f60
Showing with 63 additions and 12 deletions.
  1. +17 −0 LayoutTests/ChangeLog
  2. +2 −4 LayoutTests/platform/efl/test_expectations.txt
  3. +19 −0 Source/WebCore/ChangeLog
  4. +25 −8 Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp
@@ -1,3 +1,20 @@
2012-05-04 Christophe Dumez <christophe.dumez@intel.com>

[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 <ossy@webkit.org>

REGRESSION(r116134): It made 3 inspector tests fail
@@ -263,10 +263,8 @@ BUGWK85466 : css3/images/cross-fade-background-size.html = TEXT

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
@@ -1,3 +1,22 @@
2012-05-04 Christophe Dumez <christophe.dumez@intel.com>

[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 <vollick@chromium.org>

[chromium] CCProxy's shouldn't try to draw if there is no layer renderer
@@ -215,6 +215,29 @@ static void ensureSessionIsInitialized(SoupSession* session)
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 @@ static void restartedCallback(SoupMessage* msg, gpointer data)
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 @@ static void restartedCallback(SoupMessage* msg, gpointer data)
}

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 @@ static void sendRequestCallback(GObject* source, GAsyncResult* res, gpointer dat
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 @@ static bool startHTTPRequest(ResourceHandle* handle)
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);

0 comments on commit fff091a

Please sign in to comment.