Hi all, a slightly better patch attached.
Cheers, Tomas
>From 08c4b45e2003726a4c3f8d7ef856d5ca5c68aff7 Mon Sep 17 00:00:00 2001 From: Tomas Hlavaty <[email protected]> Date: Tue, 29 Nov 2011 09:44:28 +0100 Subject: [dev][surf] -c command-line option to disable cookies --- surf.1 | 3 +++ surf.c | 15 ++++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/surf.1 b/surf.1 index ce72203..86b1676 100644 --- a/surf.1 +++ b/surf.1 @@ -29,6 +29,9 @@ Disable Plugins .B \-s Disable Javascript .TP +.B \-c +Disable Cookies +.TP .B \-v Prints version information to standard output, then exits. .TP diff --git a/surf.c b/surf.c index baebe5c..0a80866 100644 --- a/surf.c +++ b/surf.c @@ -62,7 +62,7 @@ static GdkNativeWindow embed = 0; static gboolean showxid = FALSE; static char winid[64]; static char *progname; -static gboolean loadimage = 1, plugin = 1, script = 1; +static gboolean loadimage = 1, plugin = 1, script = 1, cookie = 1; static char *buildpath(const char *path); static void cleanup(void); @@ -556,10 +556,12 @@ newrequest(SoupSession *s, SoupMessage *msg, gpointer v) { const char *c; soup_message_headers_remove(h, "Cookie"); - uri = soup_message_get_uri(msg); - if((c = getcookies(uri))) - soup_message_headers_append(h, "Cookie", c); - g_signal_connect_after(G_OBJECT(msg), "got-headers", G_CALLBACK(gotheaders), NULL); + if(cookie) { + uri = soup_message_get_uri(msg); + if((c = getcookies(uri))) + soup_message_headers_append(h, "Cookie", c); + g_signal_connect_after(G_OBJECT(msg), "got-headers", G_CALLBACK(gotheaders), NULL); + } } void @@ -863,6 +865,9 @@ main(int argc, char *argv[]) { case 's': script = 0; break; + case 'c': + cookie = 0; + break; case 'x': showxid = TRUE; break; -- 1.7.0.4
