Hey Ken,

Thanks for that link. That is exactly what I was looking for. I took the parts that were relevant, implemented the code and ran a test. Everything works great.

Thanks for the quick reply
Jurgen

On 9/5/2010 8:07 PM, Ken Krugler wrote:
Hi Jurgen,

You can take a look at how Bixo does this in its SimpleHttpFetcher code:

http://github.com/bixo/bixo/blob/master/src/main/java/bixo/fetcher/http/SimpleHttpFetcher.java

And the DummyX509TrustManager.java code:

http://github.com/bixo/bixo/blob/master/src/main/java/bixo/fetcher/http/DummyX509TrustManager.java

-- Ken

On Sep 5, 2010, at 10:55am, Jurgen wrote:

Hello list,

I'm writing a web spider using HttpCore 4.0.1 as the HTTP protocol handler. I want to implement SSL support and I'm having some trouble.

Right now I have included only a single line of code to implement SSL:

schemes.register(new Scheme(PROTOCOL_HTTPS, SSLSocketFactory.getSocketFactory(), 443));

This works, sort of, except that it doesn't allow the program to talk SSL using untrusted certificates. Since my program is a spider I don't actually care about security, the spider will never send anything of value to a webserver anyway. So I want to configure the socket factory to always accept all certificates and SSL setup stuff no matter how fucked up it might be.

Reading through the javadoc I found the following SSLSocketFactory constructor:

new SSLSocketFactory(TrustStrategy customTrustStrategy)

So I thought I could use this with a TrustStrategy of my own:

public CustomTrustStrategy implements TrustStrategy
{
 public boolean isTrusted(X509Certificate[] chain, String authType)
 {
   return true;
 }
}

Unfortunately, this constructor doesn't exist in version 4.0.1 and version 4.1 is still in beta. Is there another way that I can accomplish what I want using HttpCore 4.0.1 and also is what I'm doing even the right way to do what I want?

Thanks,
Jurgen Voorneveld

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


--------------------------------------------
<http://ken-blog.krugler.org>
+1 530-265-2225






--------------------------
Ken Krugler
+1 530-210-6378
http://bixolabs.com
e l a s t i c   w e b   m i n i n g






---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]




---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to