[hackers] [surf] reimplementing cookies. Now we need some file locking. || Enno Boland (tox)

From: <hg_AT_suckless.org>
Date: Thu, 25 Mar 2010 08:59:31 +0000 (UTC)

changeset: 188:a1246674794b
tag: tip
user: Enno Boland (tox) <tox_AT_s01.de>
date: Thu Mar 25 09:59:30 2010 +0100
files: surf.c
description:
reimplementing cookies. Now we need some file locking.

diff -r 0d21e6434a5d -r a1246674794b surf.c
--- a/surf.c Thu Mar 25 00:05:37 2010 +0100
+++ b/surf.c Thu Mar 25 09:59:30 2010 +0100
@@ -306,7 +306,11 @@
 
 const char *
 getcookies(SoupURI *uri) {
- return NULL;
+ const char *c;
+ SoupCookieJar *j = soup_cookie_jar_text_new(cookiefile, TRUE);
+ c = soup_cookie_jar_get_cookies(j, uri, TRUE);
+ g_object_unref(j);
+ return c;
 }
 
 const char *
@@ -700,7 +704,15 @@
 
 void
 setcookie(SoupCookie *c) {
-
+ SoupDate *e;
+ SoupCookieJar *j = soup_cookie_jar_text_new(cookiefile, FALSE);
+ c = soup_cookie_copy(c);
+ if(c && c->expires == NULL) {
+ e = soup_date_new_from_time_t(time(NULL) + sessiontime);
+ soup_cookie_set_expires(c, e);
+ }
+ soup_cookie_jar_add_cookie(j, c);
+ g_object_unref(j);
 }
 
 void
Received on Thu Mar 25 2010 - 08:59:31 UTC

This archive was generated by hypermail 2.2.0 : Thu Mar 25 2010 - 09:00:08 UTC