2

it seems that HtmlUnit uses it's own centralized ProxyConfig object to set up proxy settings. Is there a way to make it ignore the ProxyConfig and use JVM properties https.proxyHost,https.proxyPort,http.proxyHost and http.proxyPort?

Sure, copying the values manually is an option, but it is not the best option as my WebClient should use both https and http which have different proxies.

Thanks in advance.

bezmax
  • 25,562
  • 10
  • 53
  • 84

1 Answers1

1

HtmlUnit depends on Apache Commons HttpClient and the latter doesn't use the JVM switches http.proxyHost and http.proxyPort.

This HttpClient issue was also discussed here.

The solution would be to submit a patch to HtmlUnit or even HttpClient that does what you want, or re-compile the patched code locally.

For future reference, at the time of writing the versions are:

  • HtmlUnit 2.8
  • HttpClient 4.0.1
Community
  • 1
  • 1
opyate
  • 5,388
  • 1
  • 37
  • 64
  • Well, that's a shame, I think I'll stick to copying the property values into ProxyConfig then. – bezmax Jul 13 '11 at 07:03