Issue #4177 - Configure HTTP proxy with SslContextFactory.
Small fixes after merge. Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
This commit is contained in:
parent
ce41c122a6
commit
cf687457e7
|
@ -133,8 +133,23 @@ public abstract class HttpDestination extends ContainerLifeCycle implements Dest
|
|||
return new BlockingArrayQueue<>(client.getMaxRequestsQueuedPerDestination());
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new {@code SslClientConnectionFactory} wrapping the given connection factory.
|
||||
*
|
||||
* @param connectionFactory the connection factory to wrap
|
||||
* @return a new SslClientConnectionFactory
|
||||
* @deprecated use {@link #newSslClientConnectionFactory(SslContextFactory, ClientConnectionFactory)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
protected ClientConnectionFactory newSslClientConnectionFactory(ClientConnectionFactory connectionFactory)
|
||||
{
|
||||
return client.newSslClientConnectionFactory(null, connectionFactory);
|
||||
}
|
||||
|
||||
protected ClientConnectionFactory newSslClientConnectionFactory(SslContextFactory sslContextFactory, ClientConnectionFactory connectionFactory)
|
||||
{
|
||||
if (sslContextFactory == null)
|
||||
return newSslClientConnectionFactory(connectionFactory);
|
||||
return client.newSslClientConnectionFactory(sslContextFactory, connectionFactory);
|
||||
}
|
||||
|
||||
|
|
|
@ -208,8 +208,7 @@ public class HttpProxy extends ProxyConfiguration.Proxy
|
|||
// Replace the promise back with the original
|
||||
context.put(HttpClientTransport.HTTP_CONNECTION_PROMISE_CONTEXT_KEY, promise);
|
||||
HttpDestination destination = (HttpDestination)context.get(HttpClientTransport.HTTP_DESTINATION_CONTEXT_KEY);
|
||||
HttpClient client = destination.getHttpClient();
|
||||
ClientConnectionFactory sslConnectionFactory = client.newSslClientConnectionFactory(null, connectionFactory);
|
||||
ClientConnectionFactory sslConnectionFactory = destination.newSslClientConnectionFactory(null, connectionFactory);
|
||||
HttpConnectionOverHTTP oldConnection = (HttpConnectionOverHTTP)endPoint.getConnection();
|
||||
context.put(SslClientConnectionFactory.SSL_PEER_HOST_CONTEXT_KEY, destination.getHost());
|
||||
context.put(SslClientConnectionFactory.SSL_PEER_PORT_CONTEXT_KEY, destination.getPort());
|
||||
|
|
|
@ -73,7 +73,7 @@ public class ProxyConfiguration
|
|||
this(address, secure, null);
|
||||
}
|
||||
|
||||
public Proxy(Origin.Address address, SslContextFactory.Client sslContextFactory)
|
||||
protected Proxy(Origin.Address address, SslContextFactory.Client sslContextFactory)
|
||||
{
|
||||
this(address, true, Objects.requireNonNull(sslContextFactory));
|
||||
}
|
||||
|
|
|
@ -195,10 +195,9 @@ public class Socks4Proxy extends ProxyConfiguration.Proxy
|
|||
try
|
||||
{
|
||||
HttpDestination destination = (HttpDestination)context.get(HttpClientTransport.HTTP_DESTINATION_CONTEXT_KEY);
|
||||
HttpClient client = destination.getHttpClient();
|
||||
ClientConnectionFactory connectionFactory = this.connectionFactory;
|
||||
if (destination.isSecure())
|
||||
connectionFactory = client.newSslClientConnectionFactory(null, connectionFactory);
|
||||
connectionFactory = destination.newSslClientConnectionFactory(null, connectionFactory);
|
||||
org.eclipse.jetty.io.Connection newConnection = connectionFactory.newConnection(getEndPoint(), context);
|
||||
getEndPoint().upgrade(newConnection);
|
||||
if (LOG.isDebugEnabled())
|
||||
|
|
Loading…
Reference in New Issue