Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use different cache keys for different methods. (google#191)
RFC 7234 states that cache keys should contain both the request method and target URI. Volley's was only including the URI. However, simply changing the key as specified would result in complete invalidation of existing caches, which, while technically being safe, could have significant latency impact for many apps. Given that the majority of cached requests should be using GET, we omit the method for GET requests so that these cache entries have the same key, while adding the method for other requests so they don't collide unexpectedly. This will result in a cache clear for apps which are reliant on caching non-GET requests, which should be significantly rarer. If caches were previously poisoned due to this bug, it's possible they will remain poisoned until the cache entry expires. But this is no worse than the previous behavior. Finally - for DEPRECATED_GET_OR_POST, we can't tell which method will be used, so we assume it is GET (identical to previous behavior). In a future release, we will disable POST caching by default, as Volley's implementation is rarely going to be correct (and it is far from trivial to implement correctly, which is why most caches don't bother). Fixes google#154
- Loading branch information