[Xfce4-commits] <midori:master> Form action NULL or "": assume relative path

Christian Dywan noreply at xfce.org
Mon Sep 17 19:28:08 CEST 2012


Updating branch refs/heads/master
         to dd39dab307c89c0cee81418e4e36ee21a0e3c9cf (commit)
       from b3984ab2520888d0f4910137340bc6fe82bf8885 (commit)

commit dd39dab307c89c0cee81418e4e36ee21a0e3c9cf
Author: Christian Dywan <christian at twotoasts.de>
Date:   Mon Sep 17 19:21:54 2012 +0200

    Form action NULL or "": assume relative path

 midori/midori-searchaction.c |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/midori/midori-searchaction.c b/midori/midori-searchaction.c
index 9972c46..7d01734 100644
--- a/midori/midori-searchaction.c
+++ b/midori/midori-searchaction.c
@@ -945,6 +945,7 @@ midori_search_action_get_engine_for_form (WebKitWebView*     web_view,
     const gchar* title;
     GString* uri_str;
     gulong form_len;
+    const gchar* action;
     guint i;
     KatzeItem* item;
     gchar** parts;
@@ -968,8 +969,17 @@ midori_search_action_get_engine_for_form (WebKitWebView*     web_view,
     form_nodes = webkit_dom_html_form_element_get_elements (active_form);
     form_len = webkit_dom_html_form_element_get_length (active_form);
 
-    uri_str = g_string_new (webkit_dom_html_form_element_get_action (active_form));
-    g_string_append (uri_str, "?");
+    /* action NULL or "": relative path */
+    if ((action = webkit_dom_html_form_element_get_action (active_form)) && *action)
+        uri_str = g_string_new (action);
+    else
+    {
+        gchar* hostname = midori_uri_parse_hostname (webkit_web_view_get_uri (web_view), NULL);
+        uri_str = g_string_new ("http://");
+        g_string_append (uri_str, hostname);
+        g_free (hostname);
+    }
+    g_string_append_c (uri_str, '?');
 
     for (i = 0; i < form_len; i++)
     {


More information about the Xfce4-commits mailing list