libostree: Add support for ETag and Last-Modified headers

Add support in the soup and curl fetchers to send the `If-None-Match`
and `If-Modified-Since` request headers, and pass on the `ETag` and
`Last-Modified` response headers.

This currently introduces no functional changes, but once call sites
provide the appropriate integration, this will allow HTTP caching to
happen with requests (typically with metadata requests, where the data
is not immutable due to being content-addressed). That should reduce
bandwidth requirements.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
This commit is contained in:
Philip Withnall committed 2020-10-22 21:03:34 +01:00
1 parent 9f98aa9223
commit 407c683524
7 files changed
+410 -19

No files matched your search

+10
View File
@@ -56,8 +56,13 @@ gboolean _ostree_fetcher_mirrored_request_to_membuf (OstreeFetcher *fetcher,
GPtrArray *mirrorlist,
const char *filename,
OstreeFetcherRequestFlags flags,
const char *if_none_match,
guint64 if_modified_since,
guint n_network_retries,
GBytes **out_contents,
gboolean *out_not_modified,
char **out_etag,
guint64 *out_last_modified,
guint64 max_size,
GCancellable *cancellable,
GError **error);
@@ -65,8 +70,13 @@ gboolean _ostree_fetcher_mirrored_request_to_membuf (OstreeFetcher *fetcher,
gboolean _ostree_fetcher_request_uri_to_membuf (OstreeFetcher *fetcher,
OstreeFetcherURI *uri,
OstreeFetcherRequestFlags flags,
const char *if_none_match,
guint64 if_modified_since,
guint n_network_retries,
GBytes **out_contents,
gboolean *out_not_modified,
char **out_etag,
guint64 *out_last_modified,
guint64 max_size,
GCancellable *cancellable,
GError **error);