From 27a14a3d46603ab452dba10796a24591db096d76 Mon Sep 17 00:00:00 2001 From: Hiltjo Posthuma Date: Sun, 18 Oct 2020 13:31:11 +0200 Subject: README: add example to support ETag caching --- README | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/README b/README index d2b7400..3cc7ca2 100644 --- a/README +++ b/README @@ -552,7 +552,7 @@ Now you can view feeds in mutt(1) for example. - - - -Incremental data updates +Incremental data updates using If-Modified-Since For servers that support it some incremental updates and bandwidth-saving can be done by using the "If-Modified-Since" HTTP header. @@ -573,6 +573,30 @@ vector of the local modification date of the feed file. - - - +Incremental data updates using ETag caching + +For servers that support it some incremental updates and bandwidth-saving can +be done by using the "ETag" HTTP header. + +Create a directory for storing the ETags per feed: + + mkdir -p ~/.sfeed/etags/ + +The curl ETag options can be used to send the previous ETag header value. You +can do this by overriding the fetch() function in the sfeedrc file and adding +the --etag-save and --etag-compare options: + + # fetch(name, url, feedfile) + fetch() { + etag="$HOME/.sfeed/etags/$1" + curl --etag-save "${etag}" --etag-compare "${etag}" "$2" + } + +This comes at a cost of some privacy. For example there can be a unique +generated ETag. + +- - - + CDN's blocking requests due to missing User-Agent sfeed_update will not send the "User-Agent" header by default for privacy -- cgit v1.2.3