Merge pull request #553 from danpe/master
Added SDWebImageOption to enable Cookies Handling.
This commit is contained in:
commit
417feed2ca
|
@ -28,7 +28,12 @@ typedef enum
|
|||
* In iOS 4+, continue the download of the image if the app goes to background. This is achieved by asking the system for
|
||||
* extra time in background to let the request finish. If the background task expires the operation will be cancelled.
|
||||
*/
|
||||
SDWebImageDownloaderContinueInBackground = 1 << 4
|
||||
SDWebImageDownloaderContinueInBackground = 1 << 4,
|
||||
/**
|
||||
* Handles cookies stored in NSHTTPCookieStore by setting
|
||||
* NSMutableURLRequest.HTTPShouldHandleCookies = YES;
|
||||
*/
|
||||
SDWebImageDownloaderHandleCookies = 1 << 5
|
||||
|
||||
} SDWebImageDownloaderOptions;
|
||||
|
||||
|
|
|
@ -118,7 +118,7 @@ static NSString *const kCompletedCallbackKey = @"completed";
|
|||
{
|
||||
// In order to prevent from potential duplicate caching (NSURLCache + SDImageCache) we disable the cache for image requests if told otherwise
|
||||
NSMutableURLRequest *request = [NSMutableURLRequest.alloc initWithURL:url cachePolicy:(options & SDWebImageDownloaderUseNSURLCache ? NSURLRequestUseProtocolCachePolicy : NSURLRequestReloadIgnoringLocalCacheData) timeoutInterval:15];
|
||||
request.HTTPShouldHandleCookies = NO;
|
||||
request.HTTPShouldHandleCookies = (options & SDWebImageDownloaderHandleCookies);
|
||||
request.HTTPShouldUsePipelining = YES;
|
||||
request.allHTTPHeaderFields = wself.HTTPHeaders;
|
||||
operation = [SDWebImageDownloaderOperation.alloc initWithRequest:request options:options progress:^(NSUInteger receivedSize, long long expectedSize)
|
||||
|
|
|
@ -46,7 +46,12 @@ typedef enum
|
|||
* In iOS 4+, continue the download of the image if the app goes to background. This is achieved by asking the system for
|
||||
* extra time in background to let the request finish. If the background task expires the operation will be cancelled.
|
||||
*/
|
||||
SDWebImageContinueInBackground = 1 << 5
|
||||
SDWebImageContinueInBackground = 1 << 5,
|
||||
/**
|
||||
* Handles cookies stored in NSHTTPCookieStore by setting
|
||||
* NSMutableURLRequest.HTTPShouldHandleCookies = YES;
|
||||
*/
|
||||
SDWebImageHandleCookies = 1 << 6
|
||||
} SDWebImageOptions;
|
||||
|
||||
typedef void(^SDWebImageCompletedBlock)(UIImage *image, NSError *error, SDImageCacheType cacheType);
|
||||
|
|
|
@ -145,6 +145,7 @@
|
|||
if (options & SDWebImageProgressiveDownload) downloaderOptions |= SDWebImageDownloaderProgressiveDownload;
|
||||
if (options & SDWebImageRefreshCached) downloaderOptions |= SDWebImageDownloaderUseNSURLCache;
|
||||
if (options & SDWebImageContinueInBackground) downloaderOptions |= SDWebImageDownloaderContinueInBackground;
|
||||
if (options & SDWebImageHandleCookies) downloaderOptions |= SDWebImageDownloaderHandleCookies;
|
||||
if (image && options & SDWebImageRefreshCached)
|
||||
{
|
||||
// force progressive off if image already cached but forced refreshing
|
||||
|
|
Loading…
Reference in New Issue