diff options
author | Brendan Taylor <whateley@gmail.com> | 2011-12-13 18:06:37 -0700 |
---|---|---|
committer | Brendan Taylor <whateley@gmail.com> | 2012-01-10 20:24:36 -0700 |
commit | 3d31b1baf6f17c955db018a81aa77efee36f263a (patch) | |
tree | b339c00af2fd4440856244f47f828f807df54de3 | |
parent | eff8d68812c996b2ce8cc0747935f702ba64ccf9 (diff) | |
parent | a964be6bd96583f8735fd297856f1c9845850f6a (diff) |
Merge remote-tracking branch 'dylex/master'
Conflicts:
src/uzbl-core.c
-rwxr-xr-x | bin/uzbl-event-manager | 2 | ||||
-rw-r--r-- | examples/data/plugins/cookies.py | 16 | ||||
-rw-r--r-- | src/commands.c | 29 | ||||
-rw-r--r-- | src/cookie-jar.c | 4 | ||||
-rw-r--r-- | src/io.c | 1 | ||||
-rw-r--r-- | src/uzbl-core.c | 29 | ||||
-rw-r--r-- | src/uzbl-core.h | 1 |
7 files changed, 45 insertions, 37 deletions
diff --git a/bin/uzbl-event-manager b/bin/uzbl-event-manager index 17be22b..56253ef 100755 --- a/bin/uzbl-event-manager +++ b/bin/uzbl-event-manager @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 # Event Manager for Uzbl # Copyright (c) 2009-2010, Mason Larobina <mason.larobina@gmail.com> diff --git a/examples/data/plugins/cookies.py b/examples/data/plugins/cookies.py index e29ee36..a09cf69 100644 --- a/examples/data/plugins/cookies.py +++ b/examples/data/plugins/cookies.py @@ -39,7 +39,9 @@ class TextStore(object): 'TRUE' : 'https', 'FALSE' : 'http' } + extra = '' if cookie[0].startswith("#HttpOnly_"): + extra = 'Only' domain = cookie[0][len("#HttpOnly_"):] elif cookie[0].startswith('#'): return None @@ -50,7 +52,7 @@ class TextStore(object): cookie[2], cookie[5], cookie[6], - scheme[cookie[3]], + scheme[cookie[3]] + extra, cookie[4]) except (KeyError,IndexError): # Let malformed rows pass through like comments @@ -60,9 +62,17 @@ class TextStore(object): """Convert cookie event to cookie.txt row""" secure = { 'https' : 'TRUE', - 'http' : 'FALSE' + 'http' : 'FALSE', + 'httpsOnly' : 'TRUE', + 'httpOnly' : 'FALSE' } - return (cookie[0], + http_only = { + 'https' : '', + 'http' : '', + 'httpsOnly' : '#HttpOnly_', + 'httpOnly' : '#HttpOnly_' + } + return (http_only[cookie[4]] + cookie[0], 'TRUE' if cookie[0].startswith('.') else 'FALSE', cookie[1], secure[cookie[4]], diff --git a/src/commands.c b/src/commands.c index 2e60233..b3546a9 100644 --- a/src/commands.c +++ b/src/commands.c @@ -93,11 +93,23 @@ VIEWFUNC(reload_bypass_cache) VIEWFUNC(stop_loading) VIEWFUNC(zoom_in) VIEWFUNC(zoom_out) -VIEWFUNC(go_back) -VIEWFUNC(go_forward) #undef VIEWFUNC void +view_go_back(WebKitWebView *page, GArray *argv, GString *result) { + (void)result; + int n = argv_idx(argv, 0) ? atoi(argv_idx(argv, 0)) : 1; + webkit_web_view_go_back_or_forward(page, -n); +} + +void +view_go_forward(WebKitWebView *page, GArray *argv, GString *result) { + (void)result; + int n = argv_idx(argv, 0) ? atoi(argv_idx(argv, 0)) : 1; + webkit_web_view_go_back_or_forward(page, n); +} + +void toggle_zoom_type (WebKitWebView* page, GArray *argv, GString *result) { (void)page; (void)argv; (void)result; @@ -338,8 +350,8 @@ show_inspector(WebKitWebView *page, GArray *argv, GString *result) { void add_cookie(WebKitWebView *page, GArray *argv, GString *result) { (void) page; (void) result; - gchar *host, *path, *name, *value; - gboolean secure = 0; + gchar *host, *path, *name, *value, *scheme; + gboolean secure = 0, httponly = 0; SoupDate *expires = NULL; if(argv->len != 6) @@ -350,14 +362,19 @@ add_cookie(WebKitWebView *page, GArray *argv, GString *result) { path = argv_idx (argv, 1); name = argv_idx (argv, 2); value = argv_idx (argv, 3); - secure = strcmp (argv_idx (argv, 4), "https") == 0; - if (strlen (argv_idx (argv, 5)) != 0) + scheme = argv_idx (argv, 4); + if (strncmp (scheme, "http", 4) == 0) { + secure = scheme[4] == 's'; + httponly = strncmp (&scheme[4+secure], "Only", 4) == 0; + } + if (argv->len >= 6 && *argv_idx (argv, 5)) expires = soup_date_new_from_time_t ( strtoul (argv_idx (argv, 5), NULL, 10)); // Create new cookie SoupCookie * cookie = soup_cookie_new (name, value, host, path, -1); soup_cookie_set_secure (cookie, secure); + soup_cookie_set_http_only (cookie, httponly); if (expires) soup_cookie_set_expires (cookie, expires); diff --git a/src/cookie-jar.c b/src/cookie-jar.c index dd9585b..2f6be83 100644 --- a/src/cookie-jar.c +++ b/src/cookie-jar.c @@ -40,7 +40,9 @@ changed(SoupCookieJar *jar, SoupCookie *old_cookie, SoupCookie *new_cookie) { * command because otherwise a loop would occur when a cookie change is * propagated to other uzbl instances using add/delete_cookie. */ if(!uzbl_jar->in_manual_add) { - gchar *scheme = cookie->secure ? "https" : "http"; + gchar *scheme = cookie->secure + ? cookie->http_only ? "httpsOnly" : "https" + : cookie->http_only ? "httpOnly" : "http"; gchar *expires = NULL; if(cookie->expires) @@ -116,6 +116,7 @@ control_stdin(GIOChannel *gio, GIOCondition condition) { parse_cmd_line(ctl_line, result); g_free(ctl_line); + if (*result->str) puts(result->str); g_string_free(result, TRUE); diff --git a/src/uzbl-core.c b/src/uzbl-core.c index e70b5e7..770d832 100644 --- a/src/uzbl-core.c +++ b/src/uzbl-core.c @@ -531,8 +531,8 @@ split_quoted(const gchar* src, const gboolean unquote) { gchar **ret; gchar *dup; for (p = src; *p != '\0'; p++) { - if ((*p == '\\') && unquote) g_string_append_c(s, *++p); - else if (*p == '\\') { g_string_append_c(s, *p++); + if ((*p == '\\') && unquote && p[1]) g_string_append_c(s, *++p); + else if (*p == '\\' && p[1]) { g_string_append_c(s, *p++); g_string_append_c(s, *p); } else if ((*p == '"') && unquote && !sq) dq = !dq; else if (*p == '"' && !sq) { g_string_append_c(s, *p); @@ -599,10 +599,9 @@ spawn_sh(GArray *argv, GString *result) { if(!cmd) return; - gchar *cmdname = g_strdup(cmd[0]); - g_array_insert_val(argv, 1, cmdname); + g_array_insert_val(argv, 1, cmd[0]); - for (i = 1; i < g_strv_length(cmd); i++) + for (i = g_strv_length(cmd)-1; i > 0; i--) g_array_prepend_val(argv, cmd[i]); if (result) { @@ -613,7 +612,6 @@ spawn_sh(GArray *argv, GString *result) { } else run_command(cmd[0], (const gchar **) argv->data, FALSE, NULL); - g_free (cmdname); g_strfreev (cmd); } @@ -623,7 +621,6 @@ run_parsed_command(const CommandInfo *c, GArray *a, GString *result) { if(strcmp("set", c->key) && strcmp("event", c->key) && strcmp("request", c->key)) { - Event *event = format_event (COMMAND_EXECUTED, NULL, TYPE_NAME, c->key, TYPE_STR_ARRAY, a, @@ -696,24 +693,6 @@ parse_command_parts(const gchar *line, GArray *a) { return c; } -void -parse_command(const char *cmd, const char *params, GString *result) { - CommandInfo *c = g_hash_table_lookup(uzbl.behave.commands, cmd); - if(c) { - GArray *a = g_array_new (TRUE, FALSE, sizeof(gchar*)); - - parse_command_arguments(params, a, c->no_split); - run_parsed_command(c, a, result); - - g_array_free (a, TRUE); - } else { - send_event(COMMAND_ERROR, NULL, - TYPE_NAME, cmd, - TYPE_STR, params ? params : "", - NULL); - } -} - gboolean valid_name(const gchar* name) { char *invalid_chars = "\t^°!\"§$%&/()=?'`'+~*'#-:,;@<>| \\{}[]¹²³¼½"; diff --git a/src/uzbl-core.h b/src/uzbl-core.h index c0d7583..29b7b64 100644 --- a/src/uzbl-core.h +++ b/src/uzbl-core.h @@ -221,7 +221,6 @@ gchar* expand(const char* s, guint recurse); gboolean run_command(const gchar *command, const gchar **args, const gboolean sync, char **output_stdout); void run_command_file(const gchar *path); -void parse_command(const char *cmd, const char *param, GString *result); void parse_cmd_line(const char *ctl_line, GString *result); const CommandInfo * parse_command_parts(const gchar *line, GArray *a); |