File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -119,7 +119,7 @@ - (NSInteger)maxConcurrentDownloads
119
119
120
120
[self addProgressCallback: progressBlock andCompletedBlock: completedBlock forURL: url createCallback: ^
121
121
{
122
- // In order to prevent from potential duplicate caching (NSURLCache + SDImageCache) we disable the cache for image requests
122
+ // In order to prevent from potential duplicate caching (NSURLCache + SDImageCache) we disable the cache for image requests if told otherwise
123
123
NSMutableURLRequest *request = [NSMutableURLRequest .alloc initWithURL: url cachePolicy: (options & SDWebImageDownloaderEnableNSURLCache ? NSURLRequestUseProtocolCachePolicy : NSURLRequestReloadIgnoringLocalCacheData) timeoutInterval: 15 ];
124
124
request.HTTPShouldHandleCookies = NO ;
125
125
request.HTTPShouldUsePipelining = YES ;
Original file line number Diff line number Diff line change @@ -311,8 +311,15 @@ - (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)err
311
311
312
312
- (NSCachedURLResponse *)connection : (NSURLConnection *)connection willCacheResponse : (NSCachedURLResponse *)cachedResponse
313
313
{
314
- // Prevents caching of responses
315
- return nil ;
314
+ if (self.request .cachePolicy == NSURLRequestReloadIgnoringLocalCacheData)
315
+ {
316
+ // Prevents caching of responses
317
+ return nil ;
318
+ }
319
+ else
320
+ {
321
+ return cachedResponse;
322
+ }
316
323
}
317
324
318
325
You can’t perform that action at this time.
0 commit comments