mirror of https://github.com/apache/nifi.git
Adding a plain socket factory for use with regular proxies
This commit is contained in:
parent
05772a07cf
commit
2ac61c5972
|
@ -62,6 +62,7 @@ import org.apache.http.config.Registry;
|
|||
import org.apache.http.config.RegistryBuilder;
|
||||
import org.apache.http.conn.HttpClientConnectionManager;
|
||||
import org.apache.http.conn.socket.ConnectionSocketFactory;
|
||||
import org.apache.http.conn.socket.PlainConnectionSocketFactory;
|
||||
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
|
||||
import org.apache.http.conn.ssl.SSLContexts;
|
||||
import org.apache.http.conn.ssl.TrustSelfSignedStrategy;
|
||||
|
@ -358,7 +359,12 @@ public class GetHTTP extends AbstractSessionFactoryProcessor {
|
|||
|
||||
final SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(sslContext, new String[]{"TLSv1"}, null, SSLConnectionSocketFactory.BROWSER_COMPATIBLE_HOSTNAME_VERIFIER);
|
||||
|
||||
final Registry<ConnectionSocketFactory> socketFactoryRegistry = RegistryBuilder.<ConnectionSocketFactory>create().register("https", sslsf).build();
|
||||
// Also include a plain socket factory for regular http connections (especially proxies)
|
||||
final Registry<ConnectionSocketFactory> socketFactoryRegistry =
|
||||
RegistryBuilder.<ConnectionSocketFactory>create()
|
||||
.register("https", sslsf)
|
||||
.register("http", PlainConnectionSocketFactory.getSocketFactory())
|
||||
.build();
|
||||
|
||||
conMan = new BasicHttpClientConnectionManager(socketFactoryRegistry);
|
||||
}
|
||||
|
|
|
@ -64,6 +64,7 @@ import org.apache.http.config.RegistryBuilder;
|
|||
import org.apache.http.conn.HttpClientConnectionManager;
|
||||
import org.apache.http.conn.ManagedHttpClientConnection;
|
||||
import org.apache.http.conn.socket.ConnectionSocketFactory;
|
||||
import org.apache.http.conn.socket.PlainConnectionSocketFactory;
|
||||
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
|
||||
import org.apache.http.conn.ssl.SSLContextBuilder;
|
||||
import org.apache.http.conn.ssl.SSLContexts;
|
||||
|
@ -362,7 +363,12 @@ public class PostHTTP extends AbstractProcessor {
|
|||
|
||||
final SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(sslContext, new String[]{"TLSv1"}, null, SSLConnectionSocketFactory.BROWSER_COMPATIBLE_HOSTNAME_VERIFIER);
|
||||
|
||||
final Registry<ConnectionSocketFactory> socketFactoryRegistry = RegistryBuilder.<ConnectionSocketFactory>create().register("https", sslsf).build();
|
||||
// Also use a plain socket factory for regular http connections (especially proxies)
|
||||
final Registry<ConnectionSocketFactory> socketFactoryRegistry =
|
||||
RegistryBuilder.<ConnectionSocketFactory>create()
|
||||
.register("https", sslsf)
|
||||
.register("http", PlainConnectionSocketFactory.getSocketFactory())
|
||||
.build();
|
||||
|
||||
conMan = new PoolingHttpClientConnectionManager(socketFactoryRegistry);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue