From 0ef42d4e5ee0322bfe4143ae57d0b9f7b485ca87 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Tue, 27 Jun 2006 00:35:48 +0000 Subject: Remove clean_cookiejar; it's been redundant for years svn path=/trunk/netsurf/; revision=2654 --- utils/utils.c | 77 ----------------------------------------------------------- 1 file changed, 77 deletions(-) (limited to 'utils/utils.c') diff --git a/utils/utils.c b/utils/utils.c index d2cab2aa5..1db7f18b9 100644 --- a/utils/utils.c +++ b/utils/utils.c @@ -136,83 +136,6 @@ void regcomp_wrapper(regex_t *preg, const char *regex, int cflags) } } -/** - * Remove expired cookies from the cookie jar. - * libcurl /really/ should do this for us. - * This gets called every time a window is closed or NetSurf is quit. - */ -#ifdef WITH_COOKIES -void clean_cookiejar(void) { - - FILE *fp; - int len; - char *cookies = 0, *pos; - char domain[256], flag[10], path[256], secure[10], - exp[50], name[256], val[256]; - long int expiry; - - fp = fopen(messages_get("cookiefile"), "r"); - if (!fp) { - LOG(("Failed to open cookie jar")); - return; - } - - /* read file length */ - fseek(fp, 0, SEEK_END); - len = ftell(fp); - fseek(fp, 0, SEEK_SET); - - cookies = calloc((unsigned int)len, sizeof(char)); - if ( NULL == cookies ) { - warn_user( "NoMemory", 0); - return; - } - - fread(cookies, (unsigned int)len, sizeof(char), fp); - fclose(fp); - - if (remove(messages_get("cookiejar"))) { - LOG(("Failed to remove old jar")); - free(cookies); - return; - } - - fp = fopen(messages_get("cookiejar"), "w+"); - if (!fp) { - free(cookies); - LOG(("Failed to create new jar")); - return; - } - /* write header */ - fputs("# Netscape HTTP Cookie File\n" - "# http://www.netscape.com/newsref/std/cookie_spec.html\n" - "# This file was generated by libcurl! Edit at your own risk.\n\n", - fp); - - pos = cookies; - while (pos != (cookies+len-1)) { - if (*pos == '#') { - for (; *pos != '\n'; pos++); - pos += 1; - continue; - } - sscanf(pos, "%s\t%s\t%s\t%s\t%s\t%s\t%s\n", domain, flag, - path, secure, exp, name, val); - pos += (strlen(domain) + strlen(flag) + strlen(path) + - strlen(secure) + strlen(exp) + strlen(name) + - strlen(val) + 7); - sscanf(exp, "%ld", &expiry); - if (time(NULL) < expiry) { /* cookie hasn't expired */ - fprintf(fp, "%s\t%s\t%s\t%s\t%s\t%s\t%s\n", domain, - flag, path, secure, exp, name, val); - } - } - fclose(fp); - - free(cookies); -} -#endif - /** We can have a fairly good estimate of how long the buffer needs to * be. The unsigned long can store a value representing a maximum size * of around 4 GB. Therefore the greatest space required is to -- cgit v1.2.3