<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[184086] releases/WebKitGTK/webkit-2.8</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/184086">184086</a></dd>
<dt>Author</dt> <dd>carlosgc@webkit.org</dd>
<dt>Date</dt> <dd>2015-05-11 06:04:15 -0700 (Mon, 11 May 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/182943">r182943</a> - [SOUP] Redirect to non HTTP destination is broken
https://bugs.webkit.org/show_bug.cgi?id=143866

Reviewed by Sergio Villar Senin.

Source/WebCore:

This is because we are passing true unconditionally as
isHTTPFamilyRequest parameter of
createSoupRequestAndMessageForHandle in continueAfterWillSendRequest.
We don't actually need to pass isHTTPFamilyRequest parameter to
createSoupRequestAndMessageForHandle, since it can simply check
that from the given request.

Covered by unit tets and also cache/disk-cache/disk-cache-redirect-to-data.html.

* platform/network/soup/ResourceHandleSoup.cpp:
(WebCore::continueAfterWillSendRequest):
(WebCore::createSoupRequestAndMessageForHandle):
(WebCore::ResourceHandle::start):

Tools:

Add a unit test to check that redirect to a data URI works.

* TestWebKitAPI/Tests/WebKit2Gtk/TestLoaderClient.cpp:
(testRedirectToDataURI):
(serverCallback):
(beforeAll):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#releasesWebKitGTKwebkit28SourceWebCoreChangeLog">releases/WebKitGTK/webkit-2.8/Source/WebCore/ChangeLog</a></li>
<li><a href="#releasesWebKitGTKwebkit28SourceWebCoreplatformnetworksoupResourceHandleSoupcpp">releases/WebKitGTK/webkit-2.8/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit28ToolsChangeLog">releases/WebKitGTK/webkit-2.8/Tools/ChangeLog</a></li>
<li><a href="#releasesWebKitGTKwebkit28ToolsTestWebKitAPITestsWebKit2GtkTestLoaderClientcpp">releases/WebKitGTK/webkit-2.8/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestLoaderClient.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="releasesWebKitGTKwebkit28SourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.8/Source/WebCore/ChangeLog (184085 => 184086)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.8/Source/WebCore/ChangeLog        2015-05-11 13:01:19 UTC (rev 184085)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/ChangeLog        2015-05-11 13:04:15 UTC (rev 184086)
</span><span class="lines">@@ -1,3 +1,24 @@
</span><ins>+2015-04-17  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
+
+        [SOUP] Redirect to non HTTP destination is broken
+        https://bugs.webkit.org/show_bug.cgi?id=143866
+
+        Reviewed by Sergio Villar Senin.
+
+        This is because we are passing true unconditionally as
+        isHTTPFamilyRequest parameter of
+        createSoupRequestAndMessageForHandle in continueAfterWillSendRequest.
+        We don't actually need to pass isHTTPFamilyRequest parameter to
+        createSoupRequestAndMessageForHandle, since it can simply check
+        that from the given request.
+
+        Covered by unit tets and also cache/disk-cache/disk-cache-redirect-to-data.html.
+
+        * platform/network/soup/ResourceHandleSoup.cpp:
+        (WebCore::continueAfterWillSendRequest):
+        (WebCore::createSoupRequestAndMessageForHandle):
+        (WebCore::ResourceHandle::start):
+
</ins><span class="cx"> 2015-04-16  Brady Eidson  &lt;beidson@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Media element can manipulate DOM during Document destruction.
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit28SourceWebCoreplatformnetworksoupResourceHandleSoupcpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.8/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp (184085 => 184086)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.8/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp        2015-05-11 13:01:19 UTC (rev 184085)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp        2015-05-11 13:04:15 UTC (rev 184086)
</span><span class="lines">@@ -227,7 +227,7 @@
</span><span class="cx">     HashSet&lt;String&gt; m_certificates;
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-static bool createSoupRequestAndMessageForHandle(ResourceHandle*, const ResourceRequest&amp;, bool isHTTPFamilyRequest);
</del><ins>+static bool createSoupRequestAndMessageForHandle(ResourceHandle*, const ResourceRequest&amp;);
</ins><span class="cx"> static void cleanupSoupRequestOperation(ResourceHandle*, bool isDestroying = false);
</span><span class="cx"> static void sendRequestCallback(GObject*, GAsyncResult*, gpointer);
</span><span class="cx"> static void readCallback(GObject*, GAsyncResult*, gpointer);
</span><span class="lines">@@ -468,7 +468,7 @@
</span><span class="cx">     if (protocolHostAndPortAreEqual(newRequest.url(), d-&gt;m_response.url()))
</span><span class="cx">         applyAuthenticationToRequest(handle, newRequest, true);
</span><span class="cx"> 
</span><del>-    if (!createSoupRequestAndMessageForHandle(handle, newRequest, true)) {
</del><ins>+    if (!createSoupRequestAndMessageForHandle(handle, newRequest)) {
</ins><span class="cx">         d-&gt;client()-&gt;cannotShowURL(handle);
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="lines">@@ -967,7 +967,7 @@
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static bool createSoupRequestAndMessageForHandle(ResourceHandle* handle, const ResourceRequest&amp; request, bool isHTTPFamilyRequest)
</del><ins>+static bool createSoupRequestAndMessageForHandle(ResourceHandle* handle, const ResourceRequest&amp; request)
</ins><span class="cx"> {
</span><span class="cx">     ResourceHandleInternal* d = handle-&gt;getInternal();
</span><span class="cx"> 
</span><span class="lines">@@ -983,7 +983,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     // SoupMessages are only applicable to HTTP-family requests.
</span><del>-    if (isHTTPFamilyRequest &amp;&amp; !createSoupMessageForHandleAndRequest(handle, request)) {
</del><ins>+    if (request.url().protocolIsInHTTPFamily() &amp;&amp; !createSoupMessageForHandleAndRequest(handle, request)) {
</ins><span class="cx">         d-&gt;m_soupRequest.clear();
</span><span class="cx">         return false;
</span><span class="cx">     }
</span><span class="lines">@@ -1007,15 +1007,14 @@
</span><span class="cx"> 
</span><span class="cx">     // Only allow the POST and GET methods for non-HTTP requests.
</span><span class="cx">     const ResourceRequest&amp; request = firstRequest();
</span><del>-    bool isHTTPFamilyRequest = request.url().protocolIsInHTTPFamily();
-    if (!isHTTPFamilyRequest &amp;&amp; request.httpMethod() != &quot;GET&quot; &amp;&amp; request.httpMethod() != &quot;POST&quot;) {
</del><ins>+    if (!request.url().protocolIsInHTTPFamily() &amp;&amp; request.httpMethod() != &quot;GET&quot; &amp;&amp; request.httpMethod() != &quot;POST&quot;) {
</ins><span class="cx">         this-&gt;scheduleFailure(InvalidURLFailure); // Error must not be reported immediately
</span><span class="cx">         return true;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     applyAuthenticationToRequest(this, firstRequest(), false);
</span><span class="cx"> 
</span><del>-    if (!createSoupRequestAndMessageForHandle(this, request, isHTTPFamilyRequest)) {
</del><ins>+    if (!createSoupRequestAndMessageForHandle(this, request)) {
</ins><span class="cx">         this-&gt;scheduleFailure(InvalidURLFailure); // Error must not be reported immediately
</span><span class="cx">         return true;
</span><span class="cx">     }
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit28ToolsChangeLog"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.8/Tools/ChangeLog (184085 => 184086)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.8/Tools/ChangeLog        2015-05-11 13:01:19 UTC (rev 184085)
+++ releases/WebKitGTK/webkit-2.8/Tools/ChangeLog        2015-05-11 13:04:15 UTC (rev 184086)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2015-04-17  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
+
+        [SOUP] Redirect to non HTTP destination is broken
+        https://bugs.webkit.org/show_bug.cgi?id=143866
+
+        Reviewed by Sergio Villar Senin.
+
+        Add a unit test to check that redirect to a data URI works.
+
+        * TestWebKitAPI/Tests/WebKit2Gtk/TestLoaderClient.cpp:
+        (testRedirectToDataURI):
+        (serverCallback):
+        (beforeAll):
+
</ins><span class="cx"> 2015-04-08  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [GTK] Crash in DOMObjectCache when a wrapped object owned by the cache is unreffed by the user
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit28ToolsTestWebKitAPITestsWebKit2GtkTestLoaderClientcpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.8/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestLoaderClient.cpp (184085 => 184086)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.8/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestLoaderClient.cpp        2015-05-11 13:01:19 UTC (rev 184085)
+++ releases/WebKitGTK/webkit-2.8/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestLoaderClient.cpp        2015-05-11 13:04:15 UTC (rev 184086)
</span><span class="lines">@@ -425,6 +425,18 @@
</span><span class="cx">     g_assert_cmpstr(soup_message_headers_get_one(headers, &quot;Foo&quot;), ==, &quot;bar&quot;);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static void testRedirectToDataURI(WebViewTest* test, gconstpointer)
+{
+    test-&gt;loadURI(kServer-&gt;getURIForPath(&quot;/redirect-to-data&quot;).data());
+    test-&gt;waitUntilLoadFinished();
+
+    static const char* expectedData = &quot;data-uri&quot;;
+    size_t mainResourceDataSize = 0;
+    const char* mainResourceData = test-&gt;mainResourceData(mainResourceDataSize);
+    g_assert_cmpint(mainResourceDataSize, ==, strlen(expectedData));
+    g_assert(!strncmp(mainResourceData, expectedData, mainResourceDataSize));
+}
+
</ins><span class="cx"> static void serverCallback(SoupServer* server, SoupMessage* message, const char* path, GHashTable*, SoupClientContext*, gpointer)
</span><span class="cx"> {
</span><span class="cx">     static const char* responseString = &quot;&lt;html&gt;&lt;body&gt;Testing!Testing!Testing!Testing!Testing!Testing!Testing!&quot;
</span><span class="lines">@@ -465,6 +477,9 @@
</span><span class="cx">     } else if (g_str_equal(path, &quot;/headers&quot;)) {
</span><span class="cx">         soup_message_headers_append(message-&gt;response_headers, &quot;Foo&quot;, &quot;bar&quot;);
</span><span class="cx">         soup_message_body_append(message-&gt;response_body, SOUP_MEMORY_STATIC, responseString, strlen(responseString));
</span><ins>+    } else if (g_str_equal(path, &quot;/redirect-to-data&quot;)) {
+        soup_message_set_status(message, SOUP_STATUS_MOVED_PERMANENTLY);
+        soup_message_headers_append(message-&gt;response_headers, &quot;Location&quot;, &quot;data:text/plain;charset=utf-8,data-uri&quot;);
</ins><span class="cx">     } else
</span><span class="cx">         soup_message_set_status(message, SOUP_STATUS_NOT_FOUND);
</span><span class="cx"> 
</span><span class="lines">@@ -502,6 +517,7 @@
</span><span class="cx">     WebPageURITest::add(&quot;WebKitWebPage&quot;, &quot;get-uri&quot;, testWebPageURI);
</span><span class="cx">     WebViewTest::add(&quot;WebKitURIRequest&quot;, &quot;http-headers&quot;, testURIRequestHTTPHeaders);
</span><span class="cx">     WebViewTest::add(&quot;WebKitURIResponse&quot;, &quot;http-headers&quot;, testURIResponseHTTPHeaders);
</span><ins>+    WebViewTest::add(&quot;WebKitWebPage&quot;, &quot;redirect-to-data-uri&quot;, testRedirectToDataURI);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void afterAll()
</span></span></pre>
</div>
</div>

</body>
</html>