diff options
author | John Mark Bell <jmb@netsurf-browser.org> | 2006-02-08 00:35:05 +0000 |
---|---|---|
committer | John Mark Bell <jmb@netsurf-browser.org> | 2006-02-08 00:35:05 +0000 |
commit | e724672302fe0e44ed431888903223c200cf8f8f (patch) | |
tree | c160669ae9167a8b9e4f8baf985fea77132402b6 /content/fetch.c | |
parent | 04e7ec32f9182847a7edc6429bb856f5f086e263 (diff) | |
download | netsurf-e724672302fe0e44ed431888903223c200cf8f8f.tar.gz netsurf-e724672302fe0e44ed431888903223c200cf8f8f.tar.bz2 |
[project @ 2006-02-08 00:35:05 by jmb]
Handle case where no cache expiry headers are sent; use (now - last_modified) / 10. This should reduce the frequency of cache entry validation.
svn path=/import/netsurf/; revision=2064
Diffstat (limited to 'content/fetch.c')
-rw-r--r-- | content/fetch.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/content/fetch.c b/content/fetch.c index 9f1b93652..bbe4d3402 100644 --- a/content/fetch.c +++ b/content/fetch.c @@ -285,6 +285,7 @@ struct fetch * fetch_start(char *url, char *referer, fetch->cachedata.max_age = INVALID_AGE; fetch->cachedata.no_cache = false; fetch->cachedata.etag = 0; + fetch->cachedata.last_modified = 0; fetch->last_modified = 0; fetch->file_etag = 0; fetch->queue_prev = 0; @@ -868,6 +869,13 @@ size_t fetch_curl_header(char *data, size_t size, size_t nmemb, f->cachedata.etag[i] == '\r' || f->cachedata.etag[i] == '\n'); --i) f->cachedata.etag[i] = '\0'; + } else if (14 < size && strncasecmp(data, "Last-Modified:", 14) == 0) { + /* extract Last-Modified header */ + SKIP_ST(14); + if (i < (int) size) { + f->cachedata.last_modified = + curl_getdate(&data[i], NULL); + } } return size; @@ -948,6 +956,9 @@ bool fetch_process_headers(struct fetch *f) sprintf(f->cachedata.etag, "\"%10d\"", (int)s.st_mtime); + /* don't set last modified time so as to ensure that local + * files are revalidated at all times. */ + /* If performed a conditional request and unmodified ... */ if (f->last_modified && f->file_etag && f->last_modified > s.st_mtime && |