- for (int i = 0; i < proxies.Length; i++) {
- switch (proxies[i].ProxyType) {
- case CFProxyType.AutoConfigurationJavaScript:
- if ((uri = GetProxyUriFromScript (proxies[i].AutoConfigurationJavaScript, targetUri)) != null)
- return uri;
- break;
- case CFProxyType.AutoConfigurationUrl:
- // unsupported proxy type (requires fetching script from remote url)
- break;
- case CFProxyType.HTTPS:
- case CFProxyType.HTTP:
- case CFProxyType.FTP:
- // create a Uri based on the hostname/port/etc info
- return GetProxyUri (proxies[i]);
- case CFProxyType.SOCKS:
- // unsupported proxy type, try the next one
- break;
- case CFProxyType.None:
- // no proxy should be used
- return targetUri;
+ if (proxies != null) {
+ for (int i = 0; i < proxies.Length && proxy == null; i++) {
+ switch (proxies[i].ProxyType) {
+ case CFProxyType.AutoConfigurationJavaScript:
+ proxy = GetProxyUriFromScript (proxies[i].AutoConfigurationJavaScript, targetUri, out credentials);
+ break;
+ case CFProxyType.AutoConfigurationUrl:
+ // unsupported proxy type (requires fetching script from remote url)
+ break;
+ case CFProxyType.HTTPS:
+ case CFProxyType.HTTP:
+ case CFProxyType.FTP:
+ // create a Uri based on the hostname/port/etc info
+ proxy = GetProxyUri (proxies[i], out credentials);
+ break;
+ case CFProxyType.SOCKS:
+ // unsupported proxy type, try the next one
+ break;
+ case CFProxyType.None:
+ // no proxy should be used
+ proxy = targetUri;
+ break;
+ }