From: Ahmed A. <asa...@ya...> - 2014-06-04 20:49:10
|
Hi Paul, - If I remove the call to youtube, an exception is still thrown - But, there is "SSLProtocolException: handshake alert: unrecognized_name", even after setUseInsecureSSL(), which you should create a bug report for. Not sure if there is CA chain difference, but what JRE you use? Ahmed ________________________________ From: Paul Rubel <pr...@bb...> To: htm...@li... Sent: Wednesday, June 4, 2014 9:56 PM Subject: [Htmlunit-user] changing useInsecureSSL after a request Hi, First off thanks for some very nice software. I'm trying to get data from sites, some of which have ssl certificates that are self-signed or have some other issue. I can set the options to use insecure ssl and that works, I see content. However, if I try to call setUseInsecureSSL(true) after making a getPage call, my next call to getPage going to a problematic certificate fails with a certificate exception. I thought that setting insecure to true would avoid this problem. If I just set useInsecure and then call the problematic site, without visiting another site first it works as expected, retrieving the content even though the cert is "dodgy". Is this expected behavior? Do I need to set the options only once at the beginning before making getPage calls? I'm new so I very well may have missed something. Thank you, Paul Here's some code using 2.15: public static void main(String[] args) { WebClient web = new WebClient(); web.getOptions().setThrowExceptionOnScriptError(false); web.getOptions().setThrowExceptionOnFailingStatusCode(false); try { //with the below youtube uncommented //an exception is thrown. Comment it out, no exception. web.getPage("https://www.youtube.com/"); web.getOptions().setUseInsecureSSL(true); web.getPage("https://www.cppbackup.com/"); } catch (FailingHttpStatusCodeException e) { e.printStackTrace(); } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } ... Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:196) at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:268) at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:380) ... 31 more ------------------------------------------------------------------------------ Learn Graph Databases - Download FREE O'Reilly Book "Graph Databases" is the definitive new guide to graph databases and their applications. Written by three acclaimed leaders in the field, this first edition is now available. Download your free book today! http://p.sf.net/sfu/NeoTech _______________________________________________ Htmlunit-user mailing list Htm...@li... https://lists.sourceforge.net/lists/listinfo/htmlunit-user |