commit 27a14a3d46603ab452dba10796a24591db096d76 parent bffe41223467cb6d9a87c1a057966924fbda6c40 Author: Hiltjo Posthuma <hiltjo@codemadness.org> Date: Sun, 18 Oct 2020 13:31:11 +0200 README: add example to support ETag caching Diffstat:
M | README | | | 26 | +++++++++++++++++++++++++- |
1 file changed, 25 insertions(+), 1 deletion(-)
diff --git 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