Skip to content

Commit

Permalink
Fix static analyzer warning in SRProxyConnect.
Browse files Browse the repository at this point in the history
  • Loading branch information
nlutsenko committed Aug 23, 2016
1 parent 35e965f commit 45f03ed
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions SocketRocket/Internal/Proxy/SRProxyConnect.m
Original file line number Diff line number Diff line change
Expand Up @@ -166,14 +166,14 @@ - (void)_configureProxy
if ([proxyType isEqualToString:(NSString *)kCFProxyTypeAutoConfigurationURL]) {
NSURL *pacURL = settings[(NSString *)kCFProxyAutoConfigurationURLKey];
if (pacURL) {
[self _fetchPAC:pacURL];
[self _fetchPAC:pacURL withProxySettings:proxySettings];
return;
}
}
if ([proxyType isEqualToString:(__bridge NSString *)kCFProxyTypeAutoConfigurationJavaScript]) {
NSString *script = settings[(__bridge NSString *)kCFProxyAutoConfigurationJavaScriptKey];
if (script) {
[self _runPACScript:script];
[self _runPACScript:script withProxySettings:proxySettings];
return;
}
}
Expand Down Expand Up @@ -209,7 +209,7 @@ - (void)_readProxySettingWithType:(NSString *)proxyType settings:(NSDictionary *
}
}

- (void)_fetchPAC:(NSURL *)PACurl
- (void)_fetchPAC:(NSURL *)PACurl withProxySettings:(NSDictionary *)proxySettings
{
SRDebugLog(@"SRWebSocket fetchPAC:%@", PACurl);

Expand All @@ -222,7 +222,7 @@ - (void)_fetchPAC:(NSURL *)PACurl
if (error) {
[self _openConnection];
} else {
[self _runPACScript:script];
[self _runPACScript:script withProxySettings:proxySettings];
}
return;
}
Expand All @@ -241,14 +241,14 @@ - (void)_fetchPAC:(NSURL *)PACurl
__strong typeof(wself) sself = wself;
if (!error) {
NSString *script = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
[sself _runPACScript:script];
[sself _runPACScript:script withProxySettings:proxySettings];
} else {
[sself _openConnection];
}
}] resume];
}

- (void)_runPACScript:(NSString *)script
- (void)_runPACScript:(NSString *)script withProxySettings:(NSDictionary *)proxySettings
{
if (!script) {
[self _openConnection];
Expand All @@ -259,8 +259,7 @@ - (void)_runPACScript:(NSString *)script
// Work around <rdar://problem/5530166>. This dummy call to
// CFNetworkCopyProxiesForURL initialise some state within CFNetwork
// that is required by CFNetworkCopyProxiesForAutoConfigurationScript.
NSDictionary *empty = nil;
CFBridgingRelease(CFNetworkCopyProxiesForURL((__bridge CFURLRef)_url, (__bridge CFDictionaryRef)empty));
CFBridgingRelease(CFNetworkCopyProxiesForURL((__bridge CFURLRef)_url, (__bridge CFDictionaryRef)proxySettings));

// Obtain the list of proxies by running the autoconfiguration script
CFErrorRef err = NULL;
Expand Down

0 comments on commit 45f03ed

Please sign in to comment.