~alcinnz/hurl

ref: f7a8c1d76fa7ee17b7a81db535639ca2be1b77e5 hurl/ISSUES/cache-responses.md -rw-r--r-- 888 bytes
f7a8c1d7 — Adrian Cochrane Improve data: URI handling, provide utility to convert other URIs to data: URIs. 4 years ago
                                                                                
8deae48f Adrian Cochrane
5123ffb5 Adrian Cochrane
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# Cache Responses
HTTP responses should be cached locally according to their cache-control headers.
Especially once Rhapsode starts supporting hyperlinks.

This could be developed as an independant project and integrated in!

## Caching headers
* `CacheControl`, legacy `Pragma: no-cache`
* `Expires`, may also be set via `CacheControl` or `Last-Modified`
* `Etag` - echo back in `If-None-Match`
* `Last-Modified` - echo back in `If-Modified-Since`
* `Vary` - indicates which headers to compare for equality before using a cache.

Use cached data for 304 responses.

## Implementation
I'd store an index file, with cached bodies stored seperately.

There'd be four parts to implementing the cache:
1. Annotating the request.
2. Loading cached data for 304 responses.
3. Storing cache responses.

GNOME's implementation: https://github.com/GNOME/libsoup/blob/mainline/libsoup/soup-cache.c