http spec like ETag, but client-side calculation?

22 Views Asked by At

Is there a http spec which makes possible, that a client can avoid a download, since the client already has the latest version?

ETags are great, but a client needs to remember the ETag. Otherwise it has no value.

Is there a way that the client calculates a hash sum of the local file, and then asks the http server:

Hi, I have URL https://example.comm/foo.tgz and the hash sum of my local file is asfdhasdfhzwsdf. Please tell me the hash sum of your version.

Then the http server can reply accordingly. If the file has not changed, then the client does not need to download the data.

1

There are 1 best solutions below

0
Evert On

You could use the (work in progress) Content-Digest headers:

https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-digest-headers

Or the older RFC which that draft will opsolete if standardized: https://www.rfc-editor.org/rfc/rfc3230

To ask a server for the digest hash without fetching the contetn, you use a HEAD request.