tempesta
tempesta copied to clipboard
RFC compliance for caching of various request types
- [x] The response to a GET request is cacheable; a cache MAY use it to satisfy subsequent GET and HEAD requests. RFC 9110 9.3.1. Test to reproduce -
cache.test_cache.TestCacheMultipleMethodsHttp.test_HEAD_after_GETER: Tempesta use cache for GET and HEAD requests AR: Tempesta use cache only GET requests - [x] Responses to POST requests are only cacheable when they include explicit freshness information and a Content-Location header field that has the same value as the POST's target URI. A cached POST response can be reused to satisfy a later GET or HEAD request. RFC 9110 9.3.3.
Test to reproduce -
cache.test_cache.TestCacheMultipleMethodsHttp.test_cache_POST_requestER: Tempesta caches response to POST request and returns it for GET requests for same uri. AR: Tempesta doesn't cache response to POST request. - [x] If a successful PUT request passes through a cache that has one or more stored responses for the target URI, those stored responses will be invalidated. RFC 9110 9.3.4/9.3.5.
Test to reproduce -
cache.test_cache.TestCacheMultipleMethodsHttp.test_update_cache_via_DELETE_requestandcache.test_cache.TestCacheMultipleMethodsHttp.test_update_cache_via_PUT_requestER: Tempesta invalidate cache with same uri for GET and HEAD requests. AR: Tempesta doesn't invalidate cache with same uri for GET and HEAD requests. - [x] A 308 response is heuristically cacheable; i.e., unless otherwise indicated by the method definition or explicit cache controls. RFC 9110 15.4.9.
Test to reproduce -
cache.test_cache.TestQueryParamsAndRedirectHttp.test_redirect_308_permanent_redirect. ER: Tempesta caches the 308 responses. AR: Tempesta does not cache the 308 responses. - [x] An origin server that evaluates an If-None-Match condition MUST NOT perform the requested method if the condition evaluates to false; instead, the origin server MUST respond with either a) the 304 (Not Modified) status code if the request method is GET or HEAD or b) the 412 (Precondition Failed) status code for all other request methods. RFC 9110 13.1.2.
Test to reproduce -
cache.test_conditional.TestConditionalHttp.test_none_match_HEADandcache.test_conditional.TestConditionalHttp.test_none_match_POSTER: Tempesta returns the 412 response for a POST request withif-none-matchheader. Tempesta returns the 304 response for a HEAD requests withif-none-matchheader. AR: Tempesta returns the 200 response for a POST request withif-none-matchheader.Tempesta returns the 200 response for a HEAD requests withif-none-matchheader.
Tempesta commit - fb00a82c34cc6005686ee92f94a87228fbaabbe0
Related issue #1663
Related issue #506