2009-02-18 Gustavo Noronha Silva <gns@gnome.org>
authorkov@webkit.org <kov@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 18 Feb 2009 16:36:28 +0000 (16:36 +0000)
committerkov@webkit.org <kov@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 18 Feb 2009 16:36:28 +0000 (16:36 +0000)
        Reviewed by Holger Hans Peter Freyther.

        Use KURL in startGio instead of passing a string with the URL, so
        that we can handle removing refs and queries more elegantly. This
        is fixing more regressions that came from the curl->soup switch.

        Original work by Zan Dobersek.

        * platform/network/ResourceHandle.h:
        * platform/network/soup/ResourceHandleSoup.cpp:
        (WebCore::ResourceHandle::start):
        (WebCore::ResourceHandle::startGio):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@41058 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/platform/network/ResourceHandle.h
WebCore/platform/network/soup/ResourceHandleSoup.cpp

index 3a67f47..4379690 100644 (file)
@@ -1,3 +1,18 @@
+2009-02-18  Gustavo Noronha Silva  <gns@gnome.org>
+
+        Reviewed by Holger Hans Peter Freyther.
+
+        Use KURL in startGio instead of passing a string with the URL, so
+        that we can handle removing refs and queries more elegantly. This
+        is fixing more regressions that came from the curl->soup switch.
+
+        Original work by Zan Dobersek.
+
+        * platform/network/ResourceHandle.h:
+        * platform/network/soup/ResourceHandleSoup.cpp:
+        (WebCore::ResourceHandle::start):
+        (WebCore::ResourceHandle::startGio):
+
 2009-02-18  Holger Hans Peter Freyther  <zecke@selfish.org>
 
         Reviewed by Alexey Proskuryakov.
index c93af21..ee937f1 100644 (file)
@@ -179,7 +179,7 @@ private:
 #if USE(SOUP)
     bool startData(String urlString);
     bool startHttp(String urlString);
-    bool startGio(String urlString);
+    bool startGio(KURL url);
 #endif
 
     void scheduleFailure(FailureType);
index b18ec93..cc4713b 100644 (file)
@@ -490,7 +490,7 @@ bool ResourceHandle::start(Frame* frame)
         return startHttp(urlString);
     else if (equalIgnoringCase(protocol, "file") || equalIgnoringCase(protocol, "ftp") || equalIgnoringCase(protocol, "ftps"))
         // FIXME: should we be doing any other protocols here?
-        return startGio(urlString);
+        return startGio(url);
     else {
         // If we don't call didFail the job is not complete for webkit even false is returned.
         if (d->client()) {
@@ -734,20 +734,21 @@ static void queryInfoCallback(GObject* source, GAsyncResult* res, gpointer)
                       openCallback, NULL);
 }
 
-bool ResourceHandle::startGio(String urlString)
+bool ResourceHandle::startGio(KURL url)
 {
     if (request().httpMethod() != "GET") {
-        ResourceError error("webkit-network-error", ERROR_BAD_NON_HTTP_METHOD, urlString, request().httpMethod());
+        ResourceError error("webkit-network-error", ERROR_BAD_NON_HTTP_METHOD, url.string(), request().httpMethod());
         d->client()->didFail(this, error);
         return false;
     }
 
-    // Remove the fragment part of the URL since the file backend doesn't deal with it
-    int fragPos;
-    if ((fragPos = urlString.find("#")) != -1)
-        urlString = urlString.left(fragPos);
+    // GIO doesn't know how to handle refs and queries, so remove them
+    // TODO: use KURL.fileSystemPath after KURLGtk and FileSystemGtk are
+    // using GIO internally, and providing URIs instead of file paths
+    url.removeRef();
+    url.setQuery(String());
 
-    d->m_gfile = g_file_new_for_uri(urlString.utf8().data());
+    d->m_gfile = g_file_new_for_uri(url.string().utf8().data());
     g_object_set_data(G_OBJECT(d->m_gfile), "webkit-resource", this);
     d->m_cancellable = g_cancellable_new();
     g_file_query_info_async(d->m_gfile,