IosHttpURLConnection - stop NSURLSession caching to disk when useCaches is false
NSURLSession has a disk cache that is on by default. This change disables the disk
cache when HttpURLConnection.useCaches is false.
@@ -653,6 +653,19 @@ public class IosHttpURLConnection extends HttpURLConnection {
}
]-*/
+ /*
+ * NSURLSessionDataDelegate method: should we store the response in the cache.
+ */
+ /*-[
+ - (void)URLSession:(NSURLSession *)session
+ dataTask:(NSURLSessionDataTask *)dataTask
+ willCacheResponse:(NSCachedURLResponse *)proposedResponse
+ completionHandler:(void (^)(NSCachedURLResponse *cachedResponse))completionHandler {
+ completionHandler( self->useCaches_ ? proposedResponse : nil );
+ }
+ ]-*/
+
+
/*
* NSURLSessionDelegate method: task completed.
*/
