> On Nov 29, 2017, at 3:39 AM, Quinn The Eskimo! <eski...@apple.com> wrote: > > 1. Implement `-URLSession:dataTask:willCacheResponse:completionHandler:` and > normalise the `User-Agent` string in the cached response.
This is what I ended up having to do, but implemented it in the -storeCachedResponse:forRequest and -cachedResponseForRequest: of my custom NSURLCache subclass instead (since I am using block-based completion). Now that I have a shared cache working for different processes using the same custom URL cache, I'm back to the question I asked earlier: what part(s) of the request is significant when the cache is matching a request for a cached response to return. The URL for our requests are of the format: https://example.com/api/v1/object/1000 <https://example.com/api/v1/object/1000> As part of the request, there's a Authorization header that's added, specific to each user, so there would be two different server responses (different contents) for this same URL depending on the Authorization header sent by the client. What I'm seeing in my setup (again, a custom NSURLCache I use to store responses, with no other modifications than to normalize the User-Agent string) is that the most recently cached data is always returned for the URL, regardless of the value of the Authorization header used in the NSURLRequest when asking the cache for a cached response (that header doesn't seem like it's significant). So my question would be: what parts of the request are significant when a NSURLCache evaluates what to return as a cached response - the URL only, or is there any other combination of headers or other properties that come into play? The docs do say to refer to the RFC, however I'm not really clear if the server response headers are the only way to control how things get cached (and subsequently returned by NSURLCached when asked for a cached response), or if there's specific characteristics in the URL loading system that also come into play.
_______________________________________________ Do not post admin requests to the list. They will be ignored. Macnetworkprog mailing list (Macnetworkprog@lists.apple.com) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/macnetworkprog/archive%40mail-archive.com This email sent to arch...@mail-archive.com