Skip to content

cache-control not read #8

dqueffeulouatw opened this Issue Jul 11, 2011 · 1 comment

2 participants


It seems like sometimes the cache-control: max-age in the response is not read.
Actually, I found maybe an explanation for that in the AFURLCache :

- (void)storeCachedResponse:(NSCachedURLResponse *)cachedResponse forRequest:(NSURLRequest *)request


        AFCacheableItem *item = [[AFCacheableItem alloc] initWithURL:oURL lastModified:lastModified expireDate:expireDate contentType:contentTypeHeader];
        // MUST BE DONE ??
        [item handleResponse:cachedResponse.response];
        [[AFCache sharedInstance] importCacheableItem:item];   
        [item release];

the handleResponse: is not called (I added myself), so all the stuff made on headers is not done, only those passed as parameters.
Is it safe to call handleResponse: here ?


Don't use AFURLCache anymore:

Instead, register AFHTTPURLProtocol for http requests, so they'll be routed through AFCache:

[NSURLProtocol registerClass:[AFHTTPURLProtocol class]];

NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@""]];
[self.webView loadRequest:request];
@artifacts artifacts closed this Sep 26, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.