Skip to content

Commit

Permalink
Add custom timeout setting for testing unreliable connection
Browse files Browse the repository at this point in the history
  • Loading branch information
zorgiepoo committed Dec 7, 2024
1 parent 2c95fa4 commit 4eaedee
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion Sparkle/SPUDownloadDriver.m
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,18 @@ - (instancetype)initWithRequestURL:(NSURL *)requestURL host:(SUHost *)host userA
_delegate = delegate;
_inBackground = background;

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:requestURL cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:30.0];
NSProcessInfo *processInfo = [NSProcessInfo processInfo];
NSString *customTimeout = processInfo.environment[@"SPARKLE_TIMEOUT"];
NSTimeInterval timeout;
if (customTimeout != nil) {
timeout = customTimeout.doubleValue;
} else {
timeout = 60.0;
}

NSLog(@"SPARKLE_TIMEOUT: %f", timeout);

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:requestURL cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:timeout];

if (userAgent != nil) {
[request setValue:(NSString * _Nonnull)userAgent forHTTPHeaderField:@"User-Agent"];
Expand Down

0 comments on commit 4eaedee

Please sign in to comment.