From: David ‘Bombe’ Roden Date: Wed, 11 Feb 2015 21:15:27 +0000 (+0100) Subject: Update HTTP client to 4.4, ignore faulty SSL hostnames X-Git-Tag: v2~200 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=4f1d9c18af78b34bd87b061bd49f55bcd0d92719;p=rhynodge.git Update HTTP client to 4.4, ignore faulty SSL hostnames --- 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;