add webp accepted content type only if WebP enabled
Send WebP as accepted content type only if it is enabled. In case it's not, stick with the standard formats in order to avoid the server sending us back WebP images.
Showing
1 changed file
with
5 additions
and
1 deletions
@@ -67,7 +67,11 @@ static NSString *const kCompletedCallbackKey = @"completed"; | @@ -67,7 +67,11 @@ static NSString *const kCompletedCallbackKey = @"completed"; | ||
67 | _downloadQueue = [NSOperationQueue new]; | 67 | _downloadQueue = [NSOperationQueue new]; |
68 | _downloadQueue.maxConcurrentOperationCount = 6; | 68 | _downloadQueue.maxConcurrentOperationCount = 6; |
69 | _URLCallbacks = [NSMutableDictionary new]; | 69 | _URLCallbacks = [NSMutableDictionary new]; |
70 | - _HTTPHeaders = [NSMutableDictionary dictionaryWithObject:@"image/webp,image/*;q=0.8" forKey:@"Accept"]; | 70 | +#ifdef SD_WEBP |
71 | + _HTTPHeaders = [@{@"Accept": @"image/webp,image/*;q=0.8"} mutableCopy]; | ||
72 | +#elseif | ||
73 | + _HTTPHeaders = [@{@"Accept": @"image/*;q=0.8"} mutableCopy]; | ||
74 | +#endif | ||
71 | _barrierQueue = dispatch_queue_create("com.hackemist.SDWebImageDownloaderBarrierQueue", DISPATCH_QUEUE_CONCURRENT); | 75 | _barrierQueue = dispatch_queue_create("com.hackemist.SDWebImageDownloaderBarrierQueue", DISPATCH_QUEUE_CONCURRENT); |
72 | _downloadTimeout = 15.0; | 76 | _downloadTimeout = 15.0; |
73 | } | 77 | } |
-
Please register or login to post a comment