Add request address scheme to cookie_handler's arguments.
authorTom Adams <tom@holizz.com>
Sun, 12 Jul 2009 20:54:21 +0000 (21:54 +0100)
committerTom Adams <tom@holizz.com>
Sun, 12 Jul 2009 21:38:09 +0000 (22:38 +0100)
README
examples/data/uzbl/scripts/cookies.sh
uzbl.c

diff --git a/README b/README
index ae9932b..d5db188 100644 (file)
--- a/README
+++ b/README
@@ -290,9 +290,10 @@ The script specific arguments are this:
 * cookie handler
 
     $8 GET/PUT
-    $9 request address host (if current page url is www.foo.com/somepage, this could be something else than foo, eg advertising from another host)
-    $10 request address path
-    $11 cookie (only with PUT requests)
+    $9 request address scheme (e.g. http or https)
+    $10 request address host (if current page url is www.foo.com/somepage, this could be something else than foo, eg advertising from another host)
+    $11 request address path
+    $12 cookie (only with PUT requests)
 
 
 Custom, userdefined scripts (`spawn foo bar`) get first the arguments as specified in the config and then the above 7 are added at the end.
index 56b9c79..4398a03 100755 (executable)
@@ -48,6 +48,7 @@ which zenity &>/dev/null || exit 2
 # uri=${uri/http:\/\/} # strip 'http://' part
 # host=${uri/\/*/}
 action=$8 # GET/PUT
+shift
 host=$9
 shift
 path=$9
diff --git a/uzbl.c b/uzbl.c
index 193d0ba..c31b41c 100644 (file)
--- a/uzbl.c
+++ b/uzbl.c
@@ -2554,7 +2554,7 @@ static void handle_cookies (SoupSession *session, SoupMessage *msg, gpointer use
     soup_message_add_header_handler(msg, "got-headers", "Set-Cookie", G_CALLBACK(save_cookies), NULL);
     GString *s = g_string_new ("");
     SoupURI * soup_uri = soup_message_get_uri(msg);
-    g_string_printf(s, "GET '%s' '%s'", soup_uri->host, soup_uri->path);
+    g_string_printf(s, "GET '%s' '%s' '%s'", soup_uri->scheme, soup_uri->host, soup_uri->path);
     run_handler(uzbl.behave.cookie_handler, s->str);
 
     if(uzbl.comm.sync_stdout && strcmp (uzbl.comm.sync_stdout, "") != 0) {
@@ -2577,7 +2577,7 @@ save_cookies (SoupMessage *msg, gpointer user_data){
         cookie = soup_cookie_to_set_cookie_header(ck->data);
         SoupURI * soup_uri = soup_message_get_uri(msg);
         GString *s = g_string_new ("");
-        g_string_printf(s, "PUT '%s' '%s' '%s'", soup_uri->host, soup_uri->path, cookie);
+        g_string_printf(s, "PUT '%s' '%s' '%s' '%s'", soup_uri->scheme, soup_uri->host, soup_uri->path, cookie);
         run_handler(uzbl.behave.cookie_handler, s->str);
         g_free (cookie);
         g_string_free(s, TRUE);