Hacker News new | past | comments | ask | show | jobs | submit login

I have a hard time agreeing with chromium this is reasonable. https://www.rfc-editor.org/rfc/rfc9111.html#name-storing-inc...

> A cache MUST NOT use an incomplete response to answer requests unless the response has been made complete, or the request is partial and specifies a range wholly within the incomplete response.

This behavior as described

1. client requests 1-200; [cached]

2. client requests 1-400; [cache responds with 206 with 1-200]

The cache is able to extend it's cache (which would result in a 403 non-successful). But otherwise MUST NOT use an incomplete cache, to answer a request for a complete answer. Is there room for the cache to pretend it's a server, and behave as if it was just the server? The server is allowed to return 206 however it wants, but unless I missed something, why is the cache allowed to yolo out a 206?

edit: additionally section 3.2 seems to make this even more explicit, this behavior is invalid.

> Caches are required to update a stored response's header fields from another (typically newer) response in several situations; for example.

The ambiguity here is unfortunate because they say required here, but don't use the keyword MUST.




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.


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




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: