diff --git a/Sparkle/SUAppcast.h b/Sparkle/SUAppcast.h index c601d8b1..9b4c677b 100644 --- a/Sparkle/SUAppcast.h +++ b/Sparkle/SUAppcast.h @@ -19,6 +19,7 @@ SU_EXPORT @interface SUAppcast : NSObject @property (weak) id delegate; @property (copy) NSString *userAgentString; +@property (copy) NSDictionary *httpHeaders; - (void)fetchAppcastFromURL:(NSURL *)url; diff --git a/Sparkle/SUAppcast.m b/Sparkle/SUAppcast.m index 2bfaedcc..a075200e 100644 --- a/Sparkle/SUAppcast.m +++ b/Sparkle/SUAppcast.m @@ -45,6 +45,7 @@ @synthesize downloadFilename; @synthesize delegate; @synthesize userAgentString; +@synthesize httpHeaders; @synthesize download; @synthesize items; @@ -55,6 +56,13 @@ [request setValue:self.userAgentString forHTTPHeaderField:@"User-Agent"]; } + if (self.httpHeaders) { + for (NSString *key in self.httpHeaders) { + id value = [self.httpHeaders objectForKey:key]; + [request setValue:value forHTTPHeaderField:key]; + } + } + [request setValue:@"application/rss+xml,*/*;q=0.1" forHTTPHeaderField:@"Accept"]; self.download = [[NSURLDownload alloc] initWithRequest:request delegate:self]; diff --git a/Sparkle/SUBasicUpdateDriver.m b/Sparkle/SUBasicUpdateDriver.m index 2591288d..d7de93c6 100644 --- a/Sparkle/SUBasicUpdateDriver.m +++ b/Sparkle/SUBasicUpdateDriver.m @@ -56,6 +56,7 @@ [appcast setDelegate:self]; [appcast setUserAgentString:[self.updater userAgentString]]; + [appcast setHttpHeaders:[self.updater httpHeaders]]; [appcast fetchAppcastFromURL:URL]; } diff --git a/Sparkle/SUUpdater.h b/Sparkle/SUUpdater.h index e3eb861f..90d606fa 100644 --- a/Sparkle/SUUpdater.h +++ b/Sparkle/SUUpdater.h @@ -46,6 +46,8 @@ SU_EXPORT @interface SUUpdater : NSObject @property (nonatomic, copy) NSString *userAgentString; +@property (copy) NSDictionary *httpHeaders; + @property BOOL sendsSystemProfile; @property BOOL automaticallyDownloadsUpdates; diff --git a/Sparkle/SUUpdater.m b/Sparkle/SUUpdater.m index f8e52595..ee26656c 100644 --- a/Sparkle/SUUpdater.m +++ b/Sparkle/SUUpdater.m @@ -51,7 +51,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification @synthesize delegate; @synthesize checkTimer; @synthesize userAgentString = customUserAgentString; - +@synthesize httpHeaders; @synthesize driver; @synthesize host;