Fixed #1993 Load image with option `SDWebImageRefreshCached` get error
#1737 introduced an issue that is using NSURLRequestReturnCacheDataDontLoad for our cached images which makes us never download again, which is not ok when using `SDWebImageRefreshCached`. Fixed by reverting to the original implementation here: `NSURLRequestUseProtocolCachePolicy` vs `NSURLRequestReloadIgnoringLocalCacheData` (when `SDWebImageRefreshCached` is set)
This commit is contained in:
parent
2f892f968f
commit
ecdd0128ab
|
@ -166,16 +166,10 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
// In order to prevent from potential duplicate caching (NSURLCache + SDImageCache) we disable the cache for image requests if told otherwise
|
// In order to prevent from potential duplicate caching (NSURLCache + SDImageCache) we disable the cache for image requests if told otherwise
|
||||||
NSURLRequestCachePolicy cachePolicy = NSURLRequestReloadIgnoringLocalCacheData;
|
NSURLRequestCachePolicy cachePolicy = options & SDWebImageDownloaderUseNSURLCache ? NSURLRequestUseProtocolCachePolicy : NSURLRequestReloadIgnoringLocalCacheData;
|
||||||
if (options & SDWebImageDownloaderUseNSURLCache) {
|
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:url
|
||||||
if (options & SDWebImageDownloaderIgnoreCachedResponse) {
|
cachePolicy:cachePolicy
|
||||||
cachePolicy = NSURLRequestReturnCacheDataDontLoad;
|
timeoutInterval:timeoutInterval];
|
||||||
} else {
|
|
||||||
cachePolicy = NSURLRequestUseProtocolCachePolicy;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:url cachePolicy:cachePolicy timeoutInterval:timeoutInterval];
|
|
||||||
|
|
||||||
request.HTTPShouldHandleCookies = (options & SDWebImageDownloaderHandleCookies);
|
request.HTTPShouldHandleCookies = (options & SDWebImageDownloaderHandleCookies);
|
||||||
request.HTTPShouldUsePipelining = YES;
|
request.HTTPShouldUsePipelining = YES;
|
||||||
|
|
Loading…
Reference in New Issue