From 4f1d9c18af78b34bd87b061bd49f55bcd0d92719 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Wed, 11 Feb 2015 22:15:27 +0100 Subject: [PATCH] Update HTTP client to 4.4, ignore faulty SSL hostnames --- pom.xml | 2 +- src/main/java/net/pterodactylus/rhynodge/queries/HttpQuery.java | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index da82358..287d593 100644 --- a/pom.xml +++ b/pom.xml @@ -137,7 +137,7 @@ org.apache.httpcomponents httpclient - 4.2.2 + 4.4 org.jsoup diff --git a/src/main/java/net/pterodactylus/rhynodge/queries/HttpQuery.java b/src/main/java/net/pterodactylus/rhynodge/queries/HttpQuery.java index d0e3545..362a04b 100644 --- a/src/main/java/net/pterodactylus/rhynodge/queries/HttpQuery.java +++ b/src/main/java/net/pterodactylus/rhynodge/queries/HttpQuery.java @@ -29,9 +29,11 @@ import net.pterodactylus.rhynodge.states.HttpState; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.HttpStatus; +import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.protocol.ResponseContentEncoding; import org.apache.http.impl.client.DefaultHttpClient; +import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.params.HttpConnectionParams; import org.apache.http.util.EntityUtils; @@ -67,8 +69,9 @@ public class HttpQuery implements Query { @Override @SuppressWarnings("deprecation") public State state() { - DefaultHttpClient httpClient = new DefaultHttpClient(); - httpClient.addResponseInterceptor(new ResponseContentEncoding()); + HttpClient httpClient = HttpClientBuilder.create() + .setSSLHostnameVerifier((hostname, session) -> true) + .addInterceptorFirst(new ResponseContentEncoding()).build(); HttpGet get = new HttpGet(uri); InputStreamReader inputStreamReader = null; -- 2.7.4