0

I'm having a similar issue as Is it possible to use HTTPS proxy in HTMLunit? , but I'm using httpunit version 2.10. The previous post was around the time of the 2.10 release (changelog, so I don't know if anything has changed since then.

Specifically, this code:

WebClient webClient = new WebClient(BrowserVersion.FIREFOX_3_6);
ProxyConfig proxyConfig = new ProxyConfig("localhost",8080);
proxyConfig.setSocksProxy(true);
webClient.setProxyConfig(proxy);
webClient.addRequestHeader("referer", "http://www.google.com");
webClient.setThrowExceptionOnScriptError(false);
webClient.setCssEnabled(false);
webClient.setJavaScriptEnabled(false);
HtmlPage page = webClient.getPage("https://somewebsite");

This should not work if I have no proxy running on 8080, but it does connect, just not through the proxy. In contrast, this crashes, like it should, when the proxy is not running:

HtmlPage page = webClient.getPage("http://somewebsite"); //not https

Is this still a deficiency in htmlunit? Is there a good workaround or hack to get socks proxy working with https?

4

1 回答 1

0

这是 2.10 版中存在的错误,现在已在 2.11 版中修复

于 2012-11-13T02:19:15.300 回答