From 56a0eea94150836e0030b9bc172dd8d519c08486 Mon Sep 17 00:00:00 2001 From: Olivier Poitrey Date: Sun, 4 Nov 2012 14:40:09 +0100 Subject: [PATCH] Setup NSURLRequest - Activate pipelineing - Disable cookie support - Add image/* Accept header to force image on servers handling content negociation --- SDWebImage/SDWebImageDownloader.m | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/SDWebImage/SDWebImageDownloader.m b/SDWebImage/SDWebImageDownloader.m index 769ae49a..05019ee3 100644 --- a/SDWebImage/SDWebImageDownloader.m +++ b/SDWebImage/SDWebImageDownloader.m @@ -106,7 +106,11 @@ NSString *const kCompletedCallbackKey = @"completed"; if (performDownload) { // In order to prevent from potential duplicate caching (NSURLCache + SDImageCache) we disable the cache for image requests - NSURLRequest *request = [[NSURLRequest alloc] initWithURL:url cachePolicy:NSURLCacheStorageNotAllowed timeoutInterval:15]; + NSMutableURLRequest *request = [NSMutableURLRequest.alloc initWithURL:url cachePolicy:NSURLCacheStorageNotAllowed timeoutInterval:15]; + NSMutableURLRequest *request = [NSMutableURLRequest.alloc initWithURL:url cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:15]; + request.HTTPShouldHandleCookies = NO; + request.HTTPShouldUsePipelining = YES; + [request addValue:@"image/*" forHTTPHeaderField:@"Accept"]; operation = [SDWebImageDownloaderOperation.alloc initWithRequest:request options:options progress:^(NSUInteger receivedSize, long long expectedSize) { dispatch_async(dispatch_get_main_queue(), ^