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?

Community
  • 1
  • 1
Arcymag
  • 1,037
  • 1
  • 8
  • 18

1 Answers1

0

This was a bug present in version 2.10 and is now fixed in version 2.11

Mosty Mostacho
  • 42,742
  • 16
  • 96
  • 123
  • I have not gotten a chance to test https with a proxy, but I cannot even get regular https logins to work with 2.11 . I'll try to see if it's something unique about what I'm doing. – Arcymag Nov 21 '12 at 07:57