From 894703b53b27a25d58d9a6fa77e99d967e9588f6 Mon Sep 17 00:00:00 2001 From: James Bursa Date: Fri, 26 Dec 2003 16:20:57 +0000 Subject: [project @ 2003-12-26 16:20:57 by bursa] Enable cookies. svn path=/import/netsurf/; revision=443 --- content/fetch.c | 12 +++++++++++- content/fetch.h | 6 +++--- content/fetchcache.c | 4 ++-- content/fetchcache.h | 2 +- 4 files changed, 17 insertions(+), 7 deletions(-) (limited to 'content') diff --git a/content/fetch.c b/content/fetch.c index f7197a7aa..3140581d8 100644 --- a/content/fetch.c +++ b/content/fetch.c @@ -151,7 +151,7 @@ void fetch_quit(void) struct fetch * fetch_start(char *url, char *referer, void (*callback)(fetch_msg msg, void *p, char *data, unsigned long size), void *p, bool only_2xx, char *post_urlenc, - struct form_successful_control *post_multipart) + struct form_successful_control *post_multipart, bool cookies) { struct fetch *fetch = xcalloc(1, sizeof(*fetch)), *host_fetch; CURLcode code; @@ -298,6 +298,16 @@ struct fetch * fetch_start(char *url, char *referer, assert(code == CURLE_OK); } + /* Cookies */ + if (cookies) { + code = curl_easy_setopt(fetch->curl_handle, CURLOPT_COOKIEFILE, + messages_get("cookiefile")); + assert(code == CURLE_OK); + code = curl_easy_setopt(fetch->curl_handle, CURLOPT_COOKIEJAR, + messages_get("cookiejar")); + assert(code == CURLE_OK); + } + /* add to the global curl multi handle */ codem = curl_multi_add_handle(curl_multi, fetch->curl_handle); assert(codem == CURLM_OK || codem == CURLM_CALL_MULTI_PERFORM); diff --git a/content/fetch.h b/content/fetch.h index fad1f50f0..159921610 100644 --- a/content/fetch.h +++ b/content/fetch.h @@ -24,9 +24,9 @@ extern bool fetch_active; void fetch_init(void); struct fetch * fetch_start(char *url, char *referer, - void (*callback)(fetch_msg msg, void *p, char *data, unsigned long size), - void *p, bool only_2xx, char *post_urlenc, - struct form_successful_control *post_multipart); + void (*callback)(fetch_msg msg, void *p, char *data, unsigned long size), + void *p, bool only_2xx, char *post_urlenc, + struct form_successful_control *post_multipart, bool cookies); void fetch_abort(struct fetch *f); void fetch_poll(void); void fetch_quit(void); diff --git a/content/fetchcache.c b/content/fetchcache.c index 63bd5be35..9e89f5876 100644 --- a/content/fetchcache.c +++ b/content/fetchcache.c @@ -43,7 +43,7 @@ struct content * fetchcache(const char *url0, char *referer, void *p2, const char *error), void *p1, void *p2, unsigned long width, unsigned long height, bool only_2xx, char *post_urlenc, - struct form_successful_control *post_multipart) + struct form_successful_control *post_multipart, bool cookies) { struct content *c; char *url = xstrdup(url0); @@ -72,7 +72,7 @@ struct content * fetchcache(const char *url0, char *referer, c->width = width; c->height = height; c->fetch = fetch_start(url, referer, fetchcache_callback, c, only_2xx, - post_urlenc, post_multipart); + post_urlenc, post_multipart, cookies); free(url); if (c->fetch == 0) { LOG(("warning: fetch_start failed")); diff --git a/content/fetchcache.h b/content/fetchcache.h index a0a25c2f8..36d40e098 100644 --- a/content/fetchcache.h +++ b/content/fetchcache.h @@ -25,6 +25,6 @@ struct content * fetchcache(const char *url, char *referer, void *p2, const char *error), void *p1, void *p2, unsigned long width, unsigned long height, bool only_2xx, char *post_urlenc, - struct form_successful_control *post_multipart); + struct form_successful_control *post_multipart, bool cookies); #endif -- cgit v1.2.3