Update HTTP client to 4.4, ignore faulty SSL hostnames
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 11 Feb 2015 21:15:27 +0000 (22:15 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 11 Feb 2015 21:15:27 +0000 (22:15 +0100)
pom.xml
src/main/java/net/pterodactylus/rhynodge/queries/HttpQuery.java

diff --git a/pom.xml b/pom.xml
index da82358..287d593 100644 (file)
--- a/pom.xml
+++ b/pom.xml
                <dependency>
                        <groupId>org.apache.httpcomponents</groupId>
                        <artifactId>httpclient</artifactId>
-                       <version>4.2.2</version>
+                       <version>4.4</version>
                </dependency>
                <dependency>
                        <groupId>org.jsoup</groupId>
index d0e3545..362a04b 100644 (file)
@@ -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;