Fixes merge from branch 'jetty-9.4.x' into 'jetty-10.0.x'.
This commit is contained in:
parent
6430177685
commit
2ebd1ff62d
|
@ -1106,23 +1106,10 @@ public class HttpClient extends ContainerLifeCycle
|
|||
return HttpScheme.HTTPS.is(scheme) || HttpScheme.WSS.is(scheme);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 new SslClientConnectionFactory(getSslContextFactory(), getByteBufferPool(), getExecutor(), connectionFactory);
|
||||
}
|
||||
|
||||
protected ClientConnectionFactory newSslClientConnectionFactory(SslContextFactory sslContextFactory, ClientConnectionFactory connectionFactory)
|
||||
{
|
||||
if (sslContextFactory == null)
|
||||
return newSslClientConnectionFactory(connectionFactory);
|
||||
sslContextFactory = getSslContextFactory();
|
||||
return new SslClientConnectionFactory(sslContextFactory, getByteBufferPool(), getExecutor(), connectionFactory);
|
||||
}
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@ import org.eclipse.jetty.io.EndPoint;
|
|||
import org.eclipse.jetty.util.Promise;
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.util.log.Logger;
|
||||
import org.eclipse.jetty.util.ssl.SslContextFactory;
|
||||
|
||||
public class HttpProxy extends ProxyConfiguration.Proxy
|
||||
{
|
||||
|
@ -52,22 +53,27 @@ public class HttpProxy extends ProxyConfiguration.Proxy
|
|||
|
||||
public HttpProxy(Origin.Address address, boolean secure)
|
||||
{
|
||||
this(address, secure, new HttpDestination.Protocol(List.of("http/1.1"), false));
|
||||
this(address, secure, null, new HttpDestination.Protocol(List.of("http/1.1"), false));
|
||||
}
|
||||
|
||||
public HttpProxy(Origin.Address address, boolean secure, HttpDestination.Protocol protocol)
|
||||
{
|
||||
super(address, secure, Objects.requireNonNull(protocol));
|
||||
this(address, secure, null, Objects.requireNonNull(protocol));
|
||||
}
|
||||
|
||||
public HttpProxy(Origin.Address address, SslContextFactory.Client sslContextFactory)
|
||||
{
|
||||
super(address, sslContextFactory);
|
||||
this(address, true, sslContextFactory, new HttpDestination.Protocol(List.of("http/1.1"), false));
|
||||
}
|
||||
|
||||
public HttpProxy(Origin.Address address, SslContextFactory.Client sslContextFactory, HttpDestination.Protocol protocol)
|
||||
{
|
||||
super(address, sslContextFactory, Objects.requireNonNull(protocol));
|
||||
this(address, true, sslContextFactory, Objects.requireNonNull(protocol));
|
||||
}
|
||||
|
||||
private HttpProxy(Origin.Address address, boolean secure, SslContextFactory.Client sslContextFactory, HttpDestination.Protocol protocol)
|
||||
{
|
||||
super(address, secure, sslContextFactory, Objects.requireNonNull(protocol));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -22,7 +22,6 @@ import java.net.URI;
|
|||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.jetty.io.ClientConnectionFactory;
|
||||
|
@ -69,17 +68,7 @@ public class ProxyConfiguration
|
|||
private final SslContextFactory.Client sslContextFactory;
|
||||
private final HttpDestination.Protocol protocol;
|
||||
|
||||
protected Proxy(Origin.Address address, boolean secure)
|
||||
{
|
||||
this(address, secure, null);
|
||||
}
|
||||
|
||||
public Proxy(Origin.Address address, SslContextFactory.Client sslContextFactory)
|
||||
{
|
||||
this(address, true, Objects.requireNonNull(sslContextFactory));
|
||||
}
|
||||
|
||||
private Proxy(Origin.Address address, boolean secure, SslContextFactory.Client sslContextFactory)
|
||||
protected Proxy(Origin.Address address, boolean secure, SslContextFactory.Client sslContextFactory, HttpDestination.Protocol protocol)
|
||||
{
|
||||
this.address = address;
|
||||
this.secure = secure;
|
||||
|
@ -111,6 +100,9 @@ public class ProxyConfiguration
|
|||
return sslContextFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the protocol spoken by this proxy
|
||||
*/
|
||||
public HttpDestination.Protocol getProtocol()
|
||||
{
|
||||
return protocol;
|
||||
|
|
|
@ -45,7 +45,7 @@ public class Socks4Proxy extends ProxyConfiguration.Proxy
|
|||
|
||||
public Socks4Proxy(Origin.Address address, boolean secure)
|
||||
{
|
||||
super(address, secure, null);
|
||||
super(address, secure, null, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -116,7 +116,7 @@ public class HttpClientCustomProxyTest
|
|||
{
|
||||
private CAFEBABEProxy(Origin.Address address, boolean secure)
|
||||
{
|
||||
super(address, secure, null);
|
||||
super(address, secure, null, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -731,7 +731,10 @@ public class ForwardProxyTLSServerTest
|
|||
clientTLS.setKeyStorePath(MavenTestingUtils.getTestResourceFile("client_server_keystore.p12").getAbsolutePath());
|
||||
clientTLS.setKeyStorePassword("storepwd");
|
||||
clientTLS.setEndpointIdentificationAlgorithm(null);
|
||||
HttpClient httpClient = new HttpClient(clientTLS);
|
||||
ClientConnector clientConnector = new ClientConnector();
|
||||
clientConnector.setSelectors(1);
|
||||
clientConnector.setSslContextFactory(clientTLS);
|
||||
HttpClient httpClient = new HttpClient(new HttpClientTransportOverHTTP(clientConnector));
|
||||
|
||||
SslContextFactory.Client proxyClientTLS = new SslContextFactory.Client()
|
||||
{
|
||||
|
@ -757,7 +760,7 @@ public class ForwardProxyTLSServerTest
|
|||
ContentResponse response = httpClient.newRequest("localhost", serverConnector.getLocalPort())
|
||||
.scheme(HttpScheme.HTTPS.asString())
|
||||
.method(HttpMethod.GET)
|
||||
.path("/echo?body=" + URLEncoder.encode(body, "UTF-8"))
|
||||
.path("/echo?body=" + URLEncoder.encode(body, StandardCharsets.UTF_8))
|
||||
.timeout(5, TimeUnit.SECONDS)
|
||||
.send();
|
||||
|
||||
|
|
Loading…
Reference in New Issue