hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jurgen <jegvoornev...@kpnmail.nl>
Subject SSL support in HttpCore 4.0.1
Date Sun, 05 Sep 2010 17:55:13 GMT
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 

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?

Jurgen Voorneveld

To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org

View raw message