« Return to Thread: how to ignore ssl certificate error

Re: how to ignore ssl certificate error

by Milind W :: Rate this Message:

Reply to Author | View in Thread

hi Ahmed,
Looks like I need a commons-httpclient contrib jar which seems to be
available nowhere. Can somone send me one, with no warranties :)  if you
have build one. I just want to be able to use htmlunit with sites that have
expired certificates without having to figure out how to build
commons-httpclient contrib (if I can get away with that).
Thanks
-Milind

>From: Ahmed Ashour <asashour@...>
>Reply-To: htmlunit-user@...
>To: htmlunit-user@...
>Subject: Re: [Htmlunit-user] how to ignore ssl certificate error
>Date: Thu, 11 Oct 2007 00:31:50 -0700 (PDT)
>
>I believe you should try:
>
>Protocol easyhttps = new Protocol("https", new
>EasySSLProtocolSocketFactory(), 443);
>Protocol.registerProtocol("https", easyhttps);
>
>1- Put it before you call any HtmlUnit stuff.
>2- It doesn't depend on your HttpClient code usage, it just registers the
>protocol at static level.
>
>This was successful for me some time ago.
>
>Many thanks,
>Ahmed
>
>----- Original Message ----
>From: Milind W <ycol@...>
>To: htmlunit-user@...
>Sent: Thursday, October 11, 2007 12:12:50 AM
>Subject: Re: [Htmlunit-user] how to ignore ssl certificate error
>
>
>This does not really help me to get htmlunit to ignore the ssl error, or am
>I missing something?
>
>
> >From: Vinay Srini <vsrini@...>
> >Reply-To: htmlunit-user@...
> >To: htmlunit-user@...
> >Subject: Re: [Htmlunit-user] how to ignore ssl certificate error
> >Date: Wed, 10 Oct 2007 13:27:06 -0700
> >
> >You might want to take a look at:
> >http://juliusdavies.ca/commons-ssl/javadocs/org/apache/commons/httpclient/contrib/ssl/EasySSLProtocolSocketFactory.html
> >
> >The package is not a part of commons-httpclient, but a part of the
> >contrib packages.
> >
> >Vinay
> >
> >Milind W wrote:
> > > hi,
> > > I am trying to connect to a website that has a expired certificate.
> >Instead
> > > of fixing this by importing the self signed certificate my prefered
> >option
> > > is to  ignore the message progrmatically (similar to how a user does
>in
> >a
> > > browser). Is there a option I can set some where in htmlunit to do
>this?
> > > preferably at the page level.
> > >
> > > I found this thread which suggest how to do this for httpclient but my
> > > understanding we do not have direct access to httpclient in htmlunit.
> > >
>http://forum.java.sun.com/thread.jspa?threadID=411937&messageID=1886339
> > >
> > > Please help! This is a critical feature for me. At this rate hopefully
>I
> >can
> > > cross the newbie stage pretty past :)
> > > Thanks
> > > -Milind
> > >
> > > Copy of my console.
> > >
> > > javax.net.ssl.SSLHandshakeException:
> > > sun.security.validator.ValidatorException: PKIX path building failed:
> > >
> > > sun.security.provider.certpath.SunCertPathBuilderException: unable to
> >find
> > > valid certification path to requested target
> > >     at
>com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:174)
> > >     at
> > >
> >com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1520)
> > >     at
>com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Handshaker.java:182)
> > >     at
>com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Handshaker.java:176)
> > >     at
> > >
> >com.sun.net.ssl.internal.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:975)
> > >     at
> > >
> >com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:123)
> > >     at
> >com.sun.net.ssl.internal.ssl.Handshaker.processLoop(Handshaker.java:511)
> > >     at
> > >
> >com.sun.net.ssl.internal.ssl.Handshaker.process_record(Handshaker.java:449)
> > >     at
> > >
> >com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:817)
> > >     at
> > >
> >com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1029)
> > >     at
> > >
> >com.sun.net.ssl.internal.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:621)
> > >     at
> > >
> >com.sun.net.ssl.internal.ssl.AppOutputStream.write(AppOutputStream.java:59)
> > >     at
> >java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)
> > >     at
>java.io.BufferedOutputStream.flush(BufferedOutputStream.java:123)
> > >     at
> > >
> >org.apache.commons.httpclient.HttpConnection.flushRequestOutputStream(HttpConnection.java:827)
> > >     at
> > >
> > >
> >org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.flushRequestOutputStream(MultiThreadedHttpConnectionManager.java:1525)
> > >     at
> > >
> >org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase.java:1975)
> > >     at
> > >
> >org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:993)
> > >     at
> > >
> >org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:397)
> > >     at
> > >
> >org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:170)
> > >     at
> > >
> >org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:396)
> > >     at
> > >
> >org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:346)
> > >     at
> > >
> >com.gargoylesoftware.htmlunit.HttpWebConnection.getResponse(HttpWebConnection.java:126)
> > >     at
> > >
> >com.gargoylesoftware.htmlunit.util.DebuggingWebConnection.getResponse(DebuggingWebConnection.java:107)
> > >     at
> > >
> >com.gargoylesoftware.htmlunit.WebClient.loadWebResponseFromWebConnection(WebClient.java:1397)
> > >     at
> > >
> >com.gargoylesoftware.htmlunit.WebClient.loadWebResponse(WebClient.java:1354)
> > >     at
>com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:330)
> > >     at
>com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:397)
> > >     at
>com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:384)
> > >
> > > Caused by: sun.security.validator.ValidatorException: PKIX path
>building
> > > failed: sun.security.provider.certpath.SunCertPathBuilderException:
> >unable
> > > to find
> > >
> > > valid certification path to requested target
> > >     at
>sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:285)
> > >     at
> > >
> >sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:191)
> > >     at sun.security.validator.Validator.validate(Validator.java:218)
> > >     at
> > >
> >com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:126)
> > >     at
> > >
> >com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:209)
> > >     at
> > >
> >com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:249)
> > >     at
> > >
> >com.sun.net.ssl.internal.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:954)
> > >     ... 27 more
> > > 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:174)
> > >     at
>java.security.cert.CertPathBuilder.build(CertPathBuilder.java:238)
> > >     at
>sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:280)
> > >     ... 33 more
> > > -------------------------------------------------------
> > >
> > >
> > >
> > >
> >-------------------------------------------------------------------------
> > > This SF.net email is sponsored by: Splunk Inc.
> > > Still grepping through log files to find problems?  Stop.
> > > Now Search log events and configuration files using AJAX and a
>browser.
> > > Download your FREE copy of Splunk now >> http://get.splunk.com/
> > > _______________________________________________
> > > Htmlunit-user mailing list
> > > Htmlunit-user@...
> > > https://lists.sourceforge.net/lists/listinfo/htmlunit-user
> > >
> > >
> >
> >--
> >Why is it called "Windows"? "Gates" would be more appropriate...
> >
> >
> >-------------------------------------------------------------------------
> >This SF.net email is sponsored by: Splunk Inc.
> >Still grepping through log files to find problems?  Stop.
> >Now Search log events and configuration files using AJAX and a browser.
> >Download your FREE copy of Splunk now >> http://get.splunk.com/
> >_______________________________________________
> >Htmlunit-user mailing list
> >Htmlunit-user@...
> >https://lists.sourceforge.net/lists/listinfo/htmlunit-user
>
>
>
>-------------------------------------------------------------------------
>This SF.net email is sponsored by: Splunk Inc.
>Still grepping through log files to find problems?  Stop.
>Now Search log events and configuration files using AJAX and a browser.
>Download your FREE copy of Splunk now >> http://get.splunk.com/
>_______________________________________________
>Htmlunit-user mailing list
>Htmlunit-user@...
>https://lists.sourceforge.net/lists/listinfo/htmlunit-user
>
>
>      
>____________________________________________________________________________________
>Catch up on fall's hot new shows on Yahoo! TV. Watch previews, get
>listings, and more!
>http://tv.yahoo.com/collections/3658


>-------------------------------------------------------------------------
>This SF.net email is sponsored by: Splunk Inc.
>Still grepping through log files to find problems?  Stop.
>Now Search log events and configuration files using AJAX and a browser.
>Download your FREE copy of Splunk now >> http://get.splunk.com/


>_______________________________________________
>Htmlunit-user mailing list
>Htmlunit-user@...
>https://lists.sourceforge.net/lists/listinfo/htmlunit-user



-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Htmlunit-user mailing list
Htmlunit-user@...
https://lists.sourceforge.net/lists/listinfo/htmlunit-user

 « Return to Thread: how to ignore ssl certificate error

LightInTheBox - Buy quality products at wholesale price