From 0f228ada91a9460d1042b1a854fb1a0a32ed3f10 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Mon, 6 Feb 2006 00:10:09 +0000 Subject: [project @ 2006-02-06 00:10:09 by jmb] Implement HTTP caching algorithm; this should avoid stale cache entries being used. svn path=/import/netsurf/; revision=2059 --- content/fetch.h | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) (limited to 'content/fetch.h') diff --git a/content/fetch.h b/content/fetch.h index 38de5d090..b65e150ff 100644 --- a/content/fetch.h +++ b/content/fetch.h @@ -23,6 +23,7 @@ typedef enum { FETCH_FINISHED, FETCH_ERROR, FETCH_REDIRECT, + FETCH_NOTMODIFIED, #ifdef WITH_AUTH FETCH_AUTH #endif @@ -30,9 +31,19 @@ typedef enum { struct content; struct fetch; -#ifdef WITH_POST struct form_successful_control; -#endif + +struct cache_data { + time_t req_time; /**< Time of request */ + time_t res_time; /**< Time of response */ + time_t date; /**< Date: response header */ + time_t expires; /**< Expires: response header */ +#define INVALID_AGE -1 + int age; /**< Age: response header */ + int max_age; /**< Max-age Cache-control parameter */ + bool no_cache; /**< no-cache Cache-control parameter */ + char *etag; /**< Etag: response header */ +}; extern bool fetch_active; extern CURLM *fetch_curl_multi; @@ -41,15 +52,9 @@ void fetch_init(void); struct fetch * fetch_start(char *url, char *referer, void (*callback)(fetch_msg msg, void *p, const char *data, unsigned long size), - void *p, bool only_2xx -#ifdef WITH_POST - , char *post_urlenc, - struct form_successful_control *post_multipart -#endif -#ifdef WITH_COOKIES - ,bool cookies -#endif - ); + void *p, bool only_2xx, char *post_urlenc, + struct form_successful_control *post_multipart, + bool cookies, char *headers[]); void fetch_abort(struct fetch *f); void fetch_poll(void); void fetch_quit(void); -- cgit v1.2.3