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

View File

@ -28,7 +28,12 @@ public class MultiplexHttpDestination extends HttpDestination implements HttpDes
{ {
public MultiplexHttpDestination(HttpClient client, Origin origin) 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") @ManagedAttribute(value = "The maximum number of concurrent requests per connection")

View File

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

View File

@ -64,7 +64,7 @@ public class ConnectionPoolsBenchmark
promise.succeeded(new MockConnection()); 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)
{ {
}; };