aboutsummaryrefslogtreecommitdiffhomepage
path: root/uzbl.c
diff options
context:
space:
mode:
Diffstat (limited to 'uzbl.c')
-rw-r--r--uzbl.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/uzbl.c b/uzbl.c
index 9041f35..bb11fcf 100644
--- a/uzbl.c
+++ b/uzbl.c
@@ -1136,6 +1136,9 @@ run_command (const gchar *command, const guint npre, const gchar **args,
g_string_append_printf(s, " -- result: %s", (result ? "true" : "false"));
printf("%s\n", s->str);
g_string_free(s, TRUE);
+ if(stdout) {
+ printf("Stdout: %s\n", *stdout);
+ }
}
if (err) {
g_printerr("error on run_command: %s\n", err->message);
@@ -2213,7 +2216,8 @@ settings_init () {
static void handle_cookies (SoupSession *session, SoupMessage *msg, gpointer user_data){
(void) session;
(void) user_data;
- if (!uzbl.behave.cookie_handler) return;
+ if (!uzbl.behave.cookie_handler)
+ return;
soup_message_add_header_handler(msg, "got-headers", "Set-Cookie", G_CALLBACK(save_cookies), NULL);
GString *s = g_string_new ("");
@@ -2221,10 +2225,13 @@ static void handle_cookies (SoupSession *session, SoupMessage *msg, gpointer use
g_string_printf(s, "GET '%s' '%s'", soup_uri->host, soup_uri->path);
run_handler(uzbl.behave.cookie_handler, s->str);
- if(uzbl.comm.sync_stdout)
- soup_message_headers_replace (msg->request_headers, "Cookie", uzbl.comm.sync_stdout);
- //printf("stdout: %s\n", uzbl.comm.sync_stdout); // debugging
- if (uzbl.comm.sync_stdout) uzbl.comm.sync_stdout = strfree(uzbl.comm.sync_stdout);
+ if(uzbl.comm.sync_stdout && strcmp (uzbl.comm.sync_stdout, "") != 0) {
+ char *p = strchr(uzbl.comm.sync_stdout, '\n' );
+ if ( p != NULL ) *p = '\0';
+ soup_message_headers_replace (msg->request_headers, "Cookie", (const char *) uzbl.comm.sync_stdout);
+ }
+ if (uzbl.comm.sync_stdout)
+ uzbl.comm.sync_stdout = strfree(uzbl.comm.sync_stdout);
g_string_free(s, TRUE);
}