lib/pull: Hook up HTTP caching headers for summary and summary.sig
authorPhilip Withnall <pwithnall@endlessos.org>
Tue, 29 Sep 2020 09:51:26 +0000 (10:51 +0100)
committerPhilip Withnall <pwithnall@endlessos.org>
Thu, 22 Oct 2020 20:03:34 +0000 (21:03 +0100)
commit0e3add8d4057b920422bba6405de208cdead00ec
tree48f6ec91da79b9e768ba68d0277ced00b41d9a50
parent407c683524bb362cbc39b8445015e4b06e5296a5
lib/pull: Hook up HTTP caching headers for summary and summary.sig

As `summary` and `summary.sig` aren’t immutable, HTTP requests to
download them can be optimised by sending the `If-None-Match` and
`If-Modified-Since` headers to avoid unnecessarily re-downloading them
if they haven’t changed since last being checked.

Hook them up to the new support for that in the fetcher.

The `ETag` and `Last-Modified` for each file in the cache are stored as
the `user.etag` xattr and the mtime, respectively. For flatpak, for
example, this affects the cached files in
`~/.local/share/flatpak/repo/tmp/cache/summaries`.

If xattrs aren’t supported, or if the server doesn’t support the caching
headers, the pull behaviour is unchanged from before.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
src/libostree/ostree-repo-pull-private.h
src/libostree/ostree-repo-pull.c