Hacker News new | ask | show | jobs
by qbane 474 days ago
Section 6.3 says

> A message is considered "complete" when all of the octets indicated by its framing are available.

So in your scenario, the first response is complete, and so the caching behavior does not conflict with the spec.

1 comments

In the scenario I propose, 200 is less than the 400 requested, so it's incomplete. The cache is permitted to retain the smaller request, and return bytes that fall exclusively within, but like I said, I don't think it's free return 200 octets when 400 are requested. If it was why would it make the other statements?

I do think the cache is allowed to retain, and respond for the 200 bytes. I don't think it's free to ignore the header updates, nor do I think it's free to return half the requested bytes in lieu of extending the existing cache.

> 200 is less than the 400 requested,

That's irrelevant. Otherwise, requests for 400 bytes against a resource that is actually only 200 bytes long would never be considered complete and would be disallowed to be cached.

TIL, the HTTP RFC explicitly allows range end to exceed the length of the content:

https://www.rfc-editor.org/rfc/rfc9110#name-byte-ranges