NIFI-300, NIFI-298: Fixed bugs causing failures when sending to non-https addresses and sending as flowfile

This commit is contained in:
Mark Payne 2015-01-23 12:00:21 -05:00
parent 8b3f3c75cd
commit c8ecdd9ddf
1 changed files with 22 additions and 12 deletions

View File

@ -319,7 +319,11 @@ public class PostHTTP extends AbstractProcessor {
return config;
}
final PoolingHttpClientConnectionManager conMan;
final SSLContextService sslContextService = context.getProperty(SSL_CONTEXT_SERVICE).asControllerService(SSLContextService.class);
if ( sslContextService == null ) {
conMan = new PoolingHttpClientConnectionManager();
} else {
final SSLContext sslContext;
try {
sslContext = createSSLContext(sslContextService);
@ -333,7 +337,9 @@ public class PostHTTP extends AbstractProcessor {
final Registry<ConnectionSocketFactory> socketFactoryRegistry = RegistryBuilder.<ConnectionSocketFactory>create()
.register("https", sslsf).build();
final PoolingHttpClientConnectionManager conMan = new PoolingHttpClientConnectionManager(socketFactoryRegistry);
conMan = new PoolingHttpClientConnectionManager(socketFactoryRegistry);
}
conMan.setDefaultMaxPerRoute(context.getMaxConcurrentTasks());
conMan.setMaxTotal(context.getMaxConcurrentTasks());
config = new Config(conMan);
@ -428,6 +434,10 @@ public class PostHTTP extends AbstractProcessor {
public void process(final HttpResponse response, final HttpContext httpContext) throws HttpException, IOException {
HttpCoreContext coreContext = HttpCoreContext.adapt(httpContext);
ManagedHttpClientConnection conn = coreContext.getConnection(ManagedHttpClientConnection.class);
if ( !conn.isOpen() ) {
return;
}
SSLSession sslSession = conn.getSSLSession();
if ( sslSession != null ) {