bigbadhacker / proxy-vole

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

Cannot detect Linux EVN_VAR IPv6 proxy #57

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Write an arbitrary Java program which uses proxy-vole
2. In a Linux env (for example Ubuntu) set an IPv6 network proxy - for example
export http_proxy=[::1]:8080
3. Run the program and it won't detect the proxy. If the proxy is changed to 
IPv4 address - for example export http_proxy=127.0.0.1:8080 everything works 
fine

I debugged the library and there's a bug in the ProxyUtil.parseProxySettings(). 
It tries to parse the proxy port and host assuming the proxy address is IPv4. 
The provided pattern - "\\w*?:?/*([^:/]+):?(\\d*)/?" 

What is the expected output? What do you see instead?
Expected to see that my proxy is detected, but instead it is not.

What version of the product are you using? On what operating system?
Latest at the moment - 20131209

Please provide any additional information below.

Here's a simple test to validate the desired behavior:
@Test
public void testIpv6Compatibility() {
      String proxyVar = "[::1]:8080";
      FixedProxySelector proxySelector =    proxyUtil.parseProxySettings(proxyVar);

      assertNotNull(proxySelector);
   }

I believe this issue can be very easily fixed and it will greatly increase the 
IPv6 support of the library.

Original issue reported on code.google.com by bobo.bo...@gmail.com on 11 Mar 2015 at 4:57