HttpDestination can now be told to use cleartext even when the scheme is secure

Signed-off-by: Ludovic Orban <lorban@bitronix.be>
This commit is contained in:
Ludovic Orban 2021-03-22 19:02:50 +01:00 committed by Simone Bordet
parent c19988af28
commit 16cbcc0e4f
5 changed files with 13 additions and 10 deletions

View File

@ -22,6 +22,6 @@ public class DuplexHttpDestination extends HttpDestination
{
public DuplexHttpDestination(HttpClient client, Origin origin)
{
super(client, origin);
super(client, origin, false);
}
}

View File

@ -62,7 +62,7 @@ public abstract class HttpDestination extends ContainerLifeCycle implements Dest
private final RequestTimeouts requestTimeouts;
private ConnectionPool connectionPool;
public HttpDestination(HttpClient client, Origin origin)
public HttpDestination(HttpClient client, Origin origin, boolean intrinsicallySecure)
{
this.client = client;
this.origin = origin;
@ -85,12 +85,12 @@ public abstract class HttpDestination extends ContainerLifeCycle implements Dest
if (proxy != null)
{
connectionFactory = proxy.newClientConnectionFactory(connectionFactory);
if (proxy.isSecure())
if (!intrinsicallySecure && proxy.isSecure())
connectionFactory = newSslClientConnectionFactory(proxy.getSslContextFactory(), connectionFactory);
}
else
{
if (isSecure())
if (!intrinsicallySecure && isSecure())
connectionFactory = newSslClientConnectionFactory(null, connectionFactory);
}
Object tag = origin.getTag();
@ -142,9 +142,7 @@ public abstract class HttpDestination extends ContainerLifeCycle implements Dest
public boolean isSecure()
{
return false;
// TODO: restore this, but ATM this breaks cleartext HTTP over QUIC
// return HttpClient.isSchemeSecure(getScheme());
return HttpClient.isSchemeSecure(getScheme());
}
public HttpClient getHttpClient()

View File

@ -28,7 +28,12 @@ public class MultiplexHttpDestination extends HttpDestination implements HttpDes
{
public MultiplexHttpDestination(HttpClient client, Origin origin)
{
super(client, origin);
this(client, origin, false);
}
public MultiplexHttpDestination(HttpClient client, Origin origin, boolean intrinsicallySecure)
{
super(client, origin, intrinsicallySecure);
}
@ManagedAttribute(value = "The maximum number of concurrent requests per connection")

View File

@ -69,7 +69,7 @@ public class HttpClientTransportOverQuic extends AbstractHttpClientTransport
@Override
public HttpDestination newHttpDestination(Origin origin)
{
return new MultiplexHttpDestination(getHttpClient(), origin);
return new MultiplexHttpDestination(getHttpClient(), origin, true);
}
@Override

View File

@ -64,7 +64,7 @@ public class ConnectionPoolsBenchmark
promise.succeeded(new MockConnection());
}
};
HttpDestination httpDestination = new HttpDestination(httpClient, new Origin("http", "localhost", 8080))
HttpDestination httpDestination = new HttpDestination(httpClient, new Origin("http", "localhost", 8080), false)
{
};