http icon indicating copy to clipboard operation
http copied to clipboard

Support weak validation ETag

Open NoNoNo opened this issue 5 years ago • 0 comments

It should be possible to generate a weak validation ETag in https://github.com/nette/http/blob/master/src/Http/Context.php#L46

Quoting https://en.wikipedia.org/wiki/HTTP_ETag#Strong_and_weak_validation :

The ETag mechanism supports both strong validation and weak validation. They are distinguished by the presence of an initial "W/" in the ETag identifier, as:

"123456789" – A strong ETag validator W/"123456789" – A weak ETag validator

A strongly validating ETag match indicates that the content of the two resource representations is byte-for-byte identical and that all other entity fields (such as Content-Language) are also unchanged. Strong ETags permit the caching and reassembly of partial responses, as with byte-range requests.

A weakly validating ETag match only indicates that the two representations are semantically equivalent, meaning that for practical purposes they are interchangeable and that cached copies can be used. However the resource representations are not necessarily byte-for-byte identical, and thus weak ETags are not suitable for byte-range requests. Weak ETags may be useful for cases in which strong ETags are impractical for a web server to generate, such as with dynamically-generated content.

Thanks & greetings!

NoNoNo avatar Feb 25 '19 11:02 NoNoNo