开发者

HtmlUnit to use proxy from JVM properties

开发者 https://www.devze.com 2023-03-17 15:37 出处:网络
it seems that HtmlUnit uses it\'s own centralized ProxyConfig object to开发者_Go百科 set up proxy settings. Is there a way to make it ignore the ProxyConfig and use JVM properties https.proxyHost,http

it seems that HtmlUnit uses it's own centralized ProxyConfig object to开发者_Go百科 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.


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
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号