jgritman / httpbuilder

315 stars 154 forks source link

A way to coerce this to use a certain set of https protocols? #56

Open seanleblanc opened 8 years ago

seanleblanc commented 8 years ago

I'm trying to get an application that is using Java 1.7 + httpbuilder to honor the ideas here:

https://blogs.oracle.com/java-platform-group/entry/diagnosing_tls_ssl_and_https

It seems that https.protocols is not inspected by httpclient, or at least the version that httpbuilder is using.

Any other ideas on how to make it honor a given set of https protocols?

kairas commented 8 years ago

Were you ever able to find a fork that accomplished this? If not I'm about to attempt it.

seanleblanc commented 8 years ago

I don't think so.

lamon commented 6 years ago

This worked for me:

def http = new HTTPBuilder(baseUrl)
SSLContext ctx = SSLContext.getInstance("TLSv1.2")
ctx.init(null, null, null)
def scheme = new Scheme("https", 443, new SSLSocketFactory(ctx))
http.client.connectionManager.schemeRegistry.register(scheme)

Hope it helps someone else...