headers icon indicating copy to clipboard operation
headers copied to clipboard

If-Range cannot be used correctly with etags

Open lolbinarycat opened this issue 1 year ago • 3 comments

a weak entity tag must not be used with If-Range, but there is no easy way to check if an ETag is weak.

additionally, IfRange::etag is infallible, which means it is very easy to create an incorrect implementation.

lolbinarycat avatar Oct 28 '24 19:10 lolbinarycat

Indeed! RFC 9110 Section 13.1.5:

A client MUST NOT generate an If-Range header field containing an entity tag that is marked as weak.

Welp, that's an unfortunate oversight. We can include adjustments in the next breaking change (which are not as catastrophic, since the trait is separate from the impls.) Would do well to design what the changes are here.

seanmonstar avatar Oct 28 '24 19:10 seanmonstar

At the very least we should add an is_weak method to ETag so this can be mitigated in the meantime.

lolbinarycat avatar Oct 28 '24 19:10 lolbinarycat

somewhat related, there's no way to get the string of an etag so i can nicely print it in error messages.

lolbinarycat avatar Oct 28 '24 20:10 lolbinarycat