tommiionfire / proxy-vole

Automatically exported from code.google.com/p/proxy-vole
0 stars 0 forks source link

Improvement in proxy fallback selection #54

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1.Configure a PAC file having one or more unreachable proxies.
2.Wrap ProxyListFallbackSelector around PacProxySelector.
3.Try to browse some URL for which no proxy is responsive.

What is the expected output? What do you see instead?

Actual behavior: The selection completely relies on filtering of unresponsive 
proxies even if we don't have anything to fallback on, i.e. empty list.
Expected behavior: Better to retry unresponsive proxy when there is nothing to 
fallback on.

What version of the product are you using? On what operating system?

Library version: 2013-12-09
OS version: Windows 7

Please provide any additional information below.

Proposed fix code snippet:

@Override
public List<Proxy> select(URI uri) {
    cleanupCache();
    List<Proxy> proxyList = this.delegate.select(uri);
    List<Proxy> result = filterUnresponsiveProxiesFromList(proxyList);
    if (result.isEmpty()) {
        return proxyList;
    }
    return result;
}

Original issue reported on code.google.com by dharmara...@gmail.com on 17 Nov 2014 at 10:45