From 7f6cbe457744438557f61d7dad76c98cd301f37a Mon Sep 17 00:00:00 2001 From: Dmytro Tretiakov Date: Wed, 3 Jun 2015 12:25:25 +0300 Subject: [PATCH] Made it possible to send custom http-headers to all request URLs (no just to devmate.com domain). --- SUBasicUpdateDriver.m | 30 ++++++------------------------ 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/SUBasicUpdateDriver.m b/SUBasicUpdateDriver.m index ad951c7e..38cf8682 100644 --- a/SUBasicUpdateDriver.m +++ b/SUBasicUpdateDriver.m @@ -25,21 +25,6 @@ #if SPARKLE_IS_COMPATIBLE_WITH_DEVMATE CF_EXPORT CFDictionaryRef DMCopyHTTPRequestHeaders(CFBundleRef appBundle, CFDataRef httpBodyData); - -NSArray *SUGetAllDevMateURLHosts(void); -NSArray *SUGetAllDevMateURLHosts(void) -{ - static NSArray *sAllKnownDevMateURLHosts = nil; - if (nil == sAllKnownDevMateURLHosts) - { - sAllKnownDevMateURLHosts = [[NSArray alloc] initWithObjects: - @"updates.devmate.com", - @"test.updates.aws.devmate.vpn", - nil]; - } - - return sAllKnownDevMateURLHosts; -} #endif @interface SUBasicUpdateDriver () ; @end @@ -169,16 +154,13 @@ NSArray *SUGetAllDevMateURLHosts(void) - (void)updateURLRequestIfNeeds:(NSMutableURLRequest *)request { #if SPARKLE_IS_COMPATIBLE_WITH_DEVMATE - if ([SUGetAllDevMateURLHosts() containsObject:[[request URL] host]]) - { - CFBundleRef hostBundle = CFBundleCreate(kCFAllocatorDefault, (CFURLRef)[NSURL fileURLWithPath:[host bundlePath]]); - NSDictionary *devmateHeaders = (NSDictionary *)DMCopyHTTPRequestHeaders(hostBundle, NULL) ? : [NSDictionary new]; - [request setAllHTTPHeaderFields:(NSDictionary *)devmateHeaders]; + CFBundleRef hostBundle = CFBundleCreate(kCFAllocatorDefault, (CFURLRef)[NSURL fileURLWithPath:[host bundlePath]]); + NSDictionary *devmateHeaders = (NSDictionary *)DMCopyHTTPRequestHeaders(hostBundle, NULL) ? : [NSDictionary new]; + [request setAllHTTPHeaderFields:(NSDictionary *)devmateHeaders]; - [devmateHeaders release]; - if (NULL != hostBundle) - CFRelease(hostBundle); - } + [devmateHeaders release]; + if (NULL != hostBundle) + CFRelease(hostBundle); #endif }