views:

18

answers:

1

Hi, I'm using HtmlUnit in a Groovy script to get a csv file from the www.goodreads.com site. This script used to work until recently, where some strange SSL error appeared.

Here is the used Groovy code

    WebClient client = new WebClient(com.gargoylesoftware.htmlunit.BrowserVersion.INTERNET_EXPLORER_6);
    client.setJavaScriptEnabled(false);
    HtmlPage signIn = client.getPage("http://www.goodreads.com/user/sign_in");
    HtmlForm signInForm = signIn.getFormByName("sign_in")
    signInForm.getInputByName("user[email]").setValueAttribute(username);
    signInForm.getInputByName("user[password]").setValueAttribute(password);
    println "I'm gonna click it !"
    HtmlPage signedIn = signInForm.getInputByName("next").click()

And the associated @Grab

@Grab(group='net.sourceforge.htmlunit', module='htmlunit', version='2.8')

Each time this code is run, I've got

INFO: Bad input type: "email", creating a text input
I'm gonna click it !
Caught: java.lang.RuntimeException: java.net.SocketException: java.security.NoSuchAlgorithmException:
 Error constructing implementation (algorithm: Default, provider: SunJSSE, class: com.sun.net.ssl.internal.ssl.DefaultSSLContextImpl)
    at Goodreads.getCSV(goodreads.groovy:184)
    at Goodreads.run(goodreads.groovy:38)
    at Goodreads.main(goodreads.groovy:215)

Line 184 being the one of signInForm.getInputByName("next").click() where I suppose the error happens. Maybe has it something to do with goodreads SSL choice of implementation, which is

Considering I can correctly login to that site using Opera, Firefox, how does that error appears ? and, more important, what can I do to fix it ?

Additionnaly notice form destination is url https://www.goodreads.com/user/sign_in

Opening this url gives access to a page that Opera indicates as TLS v1.0 256 bit AES (1024 bit DHE_RSA/SHA)

A: 

Ah, didn't knew that trick.

A little googling indicated that in such a case, calling WebClient#setUseInsecureSSL(true) is a right solution. But I don't know why ...

Riduidel