Fixes #9326 - Rename DecryptedEndPoint to SslEndPoint.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
This commit is contained in:
parent
55357f4b00
commit
4db0c70735
|
@ -116,14 +116,14 @@ circle application
|
|||
|
||||
network - SocketChannelEndPoint
|
||||
SocketChannelEndPoint - SslConnection
|
||||
SslConnection -- DecryptedEndPoint
|
||||
DecryptedEndPoint - HttpConnection
|
||||
SslConnection -- SslEndPoint
|
||||
SslEndPoint - HttpConnection
|
||||
HttpConnection - application
|
||||
----
|
||||
|
||||
Bytes read by the `SocketChannelEndPoint` will be interpreted as TLS bytes by the `SslConnection`, then decrypted and made available to the `DecryptedEndPoint` (a component part of `SslConnection`), which will then provide them to `HttpConnection`.
|
||||
Bytes read by the `SocketChannelEndPoint` will be interpreted as TLS bytes by the `SslConnection`, then decrypted and made available to the `SslEndPoint` (a component part of `SslConnection`), which will then provide them to `HttpConnection`.
|
||||
|
||||
The application writes bytes through the `HttpConnection` to the `DecryptedEndPoint`, which will encrypt them through the `SslConnection` and write the encrypted bytes to the `SocketChannelEndPoint`.
|
||||
The application writes bytes through the `HttpConnection` to the `SslEndPoint`, which will encrypt them through the `SslConnection` and write the encrypted bytes to the `SocketChannelEndPoint`.
|
||||
|
||||
[[pg-server-io-arch-connection-factory-detecting]]
|
||||
==== Choosing `ConnectionFactory` via Bytes Detection
|
||||
|
|
|
@ -402,7 +402,7 @@ public class ClientConnectorDocs
|
|||
if (failure == null)
|
||||
{
|
||||
// Unwrap the SslConnection to access the "line" APIs in TelnetConnection.
|
||||
TelnetConnection connection = (TelnetConnection)sslConnection.getDecryptedEndPoint().getConnection();
|
||||
TelnetConnection connection = (TelnetConnection)sslConnection.getSslEndPoint().getConnection();
|
||||
// Register a listener that receives string lines.
|
||||
connection.onLine(line -> System.getLogger("app").log(INFO, "line: {0}", line));
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ import org.conscrypt.OpenSSLProvider;
|
|||
import org.eclipse.jetty.alpn.client.ALPNClientConnection;
|
||||
import org.eclipse.jetty.io.Connection;
|
||||
import org.eclipse.jetty.io.ssl.ALPNProcessor;
|
||||
import org.eclipse.jetty.io.ssl.SslConnection;
|
||||
import org.eclipse.jetty.io.ssl.SslConnection.SslEndPoint;
|
||||
import org.eclipse.jetty.io.ssl.SslHandshakeListener;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -55,8 +55,8 @@ public class ConscryptClientALPNProcessor implements ALPNProcessor.Client
|
|||
ALPNClientConnection alpn = (ALPNClientConnection)connection;
|
||||
String[] protocols = alpn.getProtocols().toArray(new String[0]);
|
||||
Conscrypt.setApplicationProtocols(sslEngine, protocols);
|
||||
((SslConnection.DecryptedEndPoint)connection.getEndPoint()).getSslConnection()
|
||||
.addHandshakeListener(new ALPNListener(alpn));
|
||||
SslEndPoint sslEndPoint = (SslEndPoint)connection.getEndPoint();
|
||||
sslEndPoint.getSslConnection().addHandshakeListener(new ALPNListener(alpn));
|
||||
}
|
||||
catch (RuntimeException x)
|
||||
{
|
||||
|
|
|
@ -24,7 +24,7 @@ import org.conscrypt.OpenSSLProvider;
|
|||
import org.eclipse.jetty.alpn.server.ALPNServerConnection;
|
||||
import org.eclipse.jetty.io.Connection;
|
||||
import org.eclipse.jetty.io.ssl.ALPNProcessor;
|
||||
import org.eclipse.jetty.io.ssl.SslConnection.DecryptedEndPoint;
|
||||
import org.eclipse.jetty.io.ssl.SslConnection.SslEndPoint;
|
||||
import org.eclipse.jetty.io.ssl.SslHandshakeListener;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -74,7 +74,8 @@ public class ConscryptServerALPNProcessor implements ALPNProcessor.Server
|
|||
private ALPNCallback(ALPNServerConnection connection)
|
||||
{
|
||||
alpnConnection = connection;
|
||||
((DecryptedEndPoint)alpnConnection.getEndPoint()).getSslConnection().addHandshakeListener(this);
|
||||
SslEndPoint sslEndPoint = (SslEndPoint)alpnConnection.getEndPoint();
|
||||
sslEndPoint.getSslConnection().addHandshakeListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -20,7 +20,7 @@ import javax.net.ssl.SSLParameters;
|
|||
import org.eclipse.jetty.alpn.client.ALPNClientConnection;
|
||||
import org.eclipse.jetty.io.Connection;
|
||||
import org.eclipse.jetty.io.ssl.ALPNProcessor;
|
||||
import org.eclipse.jetty.io.ssl.SslConnection.DecryptedEndPoint;
|
||||
import org.eclipse.jetty.io.ssl.SslConnection.SslEndPoint;
|
||||
import org.eclipse.jetty.io.ssl.SslHandshakeListener;
|
||||
import org.eclipse.jetty.util.JavaVersion;
|
||||
import org.slf4j.Logger;
|
||||
|
@ -52,8 +52,8 @@ public class JDK9ClientALPNProcessor implements ALPNProcessor.Client
|
|||
List<String> protocols = alpn.getProtocols();
|
||||
sslParameters.setApplicationProtocols(protocols.toArray(new String[0]));
|
||||
sslEngine.setSSLParameters(sslParameters);
|
||||
((DecryptedEndPoint)connection.getEndPoint()).getSslConnection()
|
||||
.addHandshakeListener(new ALPNListener(alpn));
|
||||
SslEndPoint sslEndPoint = (SslEndPoint)connection.getEndPoint();
|
||||
sslEndPoint.getSslConnection().addHandshakeListener(new ALPNListener(alpn));
|
||||
}
|
||||
|
||||
private static final class ALPNListener implements SslHandshakeListener
|
||||
|
|
|
@ -20,7 +20,7 @@ import javax.net.ssl.SSLEngine;
|
|||
import org.eclipse.jetty.alpn.server.ALPNServerConnection;
|
||||
import org.eclipse.jetty.io.Connection;
|
||||
import org.eclipse.jetty.io.ssl.ALPNProcessor;
|
||||
import org.eclipse.jetty.io.ssl.SslConnection;
|
||||
import org.eclipse.jetty.io.ssl.SslConnection.SslEndPoint;
|
||||
import org.eclipse.jetty.io.ssl.SslHandshakeListener;
|
||||
import org.eclipse.jetty.util.JavaVersion;
|
||||
import org.slf4j.Logger;
|
||||
|
@ -57,7 +57,8 @@ public class JDK9ServerALPNProcessor implements ALPNProcessor.Server, SslHandsha
|
|||
private ALPNCallback(ALPNServerConnection connection)
|
||||
{
|
||||
alpnConnection = connection;
|
||||
((SslConnection.DecryptedEndPoint)alpnConnection.getEndPoint()).getSslConnection().addHandshakeListener(this);
|
||||
SslEndPoint sslEndPoint = (SslEndPoint)alpnConnection.getEndPoint();
|
||||
sslEndPoint.getSslConnection().addHandshakeListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -50,7 +50,7 @@ public class SslConnectionTest
|
|||
SSLEngine sslEngine = sslContextFactory.newSSLEngine();
|
||||
sslEngine.setUseClientMode(false);
|
||||
SslConnection sslConnection = new SslConnection(bufferPool, threadPool, endPoint, sslEngine);
|
||||
EndPoint sslEndPoint = sslConnection.getDecryptedEndPoint();
|
||||
EndPoint sslEndPoint = sslConnection.getSslEndPoint();
|
||||
sslEndPoint.setConnection(new AbstractConnection(sslEndPoint, threadPool)
|
||||
{
|
||||
@Override
|
||||
|
|
|
@ -114,8 +114,8 @@ public class ClientConnectionFactoryOverHTTP2 extends ContainerLifeCycle impleme
|
|||
// Avoid double TLS wrapping. We want to keep the existing
|
||||
// SslConnection that has already performed the TLS handshake,
|
||||
// and just upgrade the nested connection.
|
||||
if (factory instanceof SslClientConnectionFactory && endPoint instanceof SslConnection.DecryptedEndPoint)
|
||||
factory = ((SslClientConnectionFactory)factory).getClientConnectionFactory();
|
||||
if (factory instanceof SslClientConnectionFactory sslFactory && endPoint instanceof SslConnection.SslEndPoint)
|
||||
factory = sslFactory.getClientConnectionFactory();
|
||||
var newConnection = factory.newConnection(endPoint, context);
|
||||
endPoint.upgrade(newConnection);
|
||||
}
|
||||
|
|
|
@ -390,7 +390,7 @@ public class HTTP2ServerConnection extends HTTP2Connection implements Connection
|
|||
@Override
|
||||
public boolean isSecure()
|
||||
{
|
||||
return getEndPoint() instanceof SslConnection.DecryptedEndPoint;
|
||||
return getEndPoint() instanceof SslConnection.SslEndPoint;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -121,7 +121,7 @@ public class SslClientConnectionFactory implements ClientConnectionFactory
|
|||
|
||||
SslConnection sslConnection = newSslConnection(byteBufferPool, executor, endPoint, engine);
|
||||
|
||||
EndPoint appEndPoint = sslConnection.getDecryptedEndPoint();
|
||||
EndPoint appEndPoint = sslConnection.getSslEndPoint();
|
||||
appEndPoint.setConnection(connectionFactory.newConnection(appEndPoint, context));
|
||||
|
||||
sslConnection.addHandshakeListener(new HTTPSHandshakeListener(context));
|
||||
|
|
|
@ -52,21 +52,21 @@ import org.slf4j.LoggerFactory;
|
|||
* wants unencrypted data.
|
||||
* <p>
|
||||
* The connector uses an {@link EndPoint} (typically SocketChannelEndPoint) as
|
||||
* it's source/sink of encrypted data. It then provides an endpoint via {@link #getDecryptedEndPoint()} to
|
||||
* it's source/sink of encrypted data. It then provides an endpoint via {@link #getSslEndPoint()} to
|
||||
* expose a source/sink of unencrypted data to another connection (eg HttpConnection).
|
||||
* <p>
|
||||
* The design of this class is based on a clear separation between the passive methods, which do not block nor schedule any
|
||||
* asynchronous callbacks, and active methods that do schedule asynchronous callbacks.
|
||||
* <p>
|
||||
* The passive methods are {@link DecryptedEndPoint#fill(ByteBuffer)} and {@link DecryptedEndPoint#flush(ByteBuffer...)}. They make best
|
||||
* The passive methods are {@link SslEndPoint#fill(ByteBuffer)} and {@link SslEndPoint#flush(ByteBuffer...)}. They make best
|
||||
* effort attempts to progress the connection using only calls to the encrypted {@link EndPoint#fill(ByteBuffer)} and {@link EndPoint#flush(ByteBuffer...)}
|
||||
* methods. They will never block nor schedule any readInterest or write callbacks. If a fill/flush cannot progress either because
|
||||
* of network congestion or waiting for an SSL handshake message, then the fill/flush will simply return with zero bytes filled/flushed.
|
||||
* Specifically, if a flush cannot proceed because it needs to receive a handshake message, then the flush will attempt to fill bytes from the
|
||||
* encrypted endpoint, but if insufficient bytes are read it will NOT call {@link EndPoint#fillInterested(Callback)}.
|
||||
* <p>
|
||||
* It is only the active methods : {@link DecryptedEndPoint#fillInterested(Callback)} and
|
||||
* {@link DecryptedEndPoint#write(Callback, ByteBuffer...)} that may schedule callbacks by calling the encrypted
|
||||
* It is only the active methods : {@link SslEndPoint#fillInterested(Callback)} and
|
||||
* {@link SslEndPoint#write(Callback, ByteBuffer...)} that may schedule callbacks by calling the encrypted
|
||||
* {@link EndPoint#fillInterested(Callback)} and {@link EndPoint#write(Callback, ByteBuffer...)}
|
||||
* methods. For normal data handling, the decrypted fillInterest method will result in an encrypted fillInterest and a decrypted
|
||||
* write will result in an encrypted write. However, due to SSL handshaking requirements, it is also possible for a decrypted fill
|
||||
|
@ -110,7 +110,7 @@ public class SslConnection extends AbstractConnection implements Connection.Upgr
|
|||
private final AtomicLong _bytesOut = new AtomicLong();
|
||||
private final ByteBufferPool _bufferPool;
|
||||
private final SSLEngine _sslEngine;
|
||||
private final DecryptedEndPoint _decryptedEndPoint;
|
||||
private final SslEndPoint _sslEndPoint;
|
||||
private final boolean _encryptedDirectBuffers;
|
||||
private final boolean _decryptedDirectBuffers;
|
||||
private RetainableByteBuffer _decryptedInput;
|
||||
|
@ -128,13 +128,13 @@ public class SslConnection extends AbstractConnection implements Connection.Upgr
|
|||
@Override
|
||||
public void run()
|
||||
{
|
||||
_decryptedEndPoint.getFillInterest().fillable();
|
||||
_sslEndPoint.getFillInterest().fillable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public InvocationType getInvocationType()
|
||||
{
|
||||
return _decryptedEndPoint.getFillInterest().getCallbackInvocationType();
|
||||
return _sslEndPoint.getFillInterest().getCallbackInvocationType();
|
||||
}
|
||||
};
|
||||
private final Callback _sslReadCallback = new Callback()
|
||||
|
@ -154,7 +154,7 @@ public class SslConnection extends AbstractConnection implements Connection.Upgr
|
|||
@Override
|
||||
public InvocationType getInvocationType()
|
||||
{
|
||||
return getDecryptedEndPoint().getFillInterest().getCallbackInvocationType();
|
||||
return getSslEndPoint().getFillInterest().getCallbackInvocationType();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -177,7 +177,7 @@ public class SslConnection extends AbstractConnection implements Connection.Upgr
|
|||
super(endPoint, executor);
|
||||
this._bufferPool = byteBufferPool;
|
||||
this._sslEngine = sslEngine;
|
||||
this._decryptedEndPoint = newDecryptedEndPoint();
|
||||
this._sslEndPoint = newSslEndPoint();
|
||||
this._encryptedDirectBuffers = useDirectBuffersForEncryption;
|
||||
this._decryptedDirectBuffers = useDirectBuffersForDecryption;
|
||||
}
|
||||
|
@ -204,9 +204,9 @@ public class SslConnection extends AbstractConnection implements Connection.Upgr
|
|||
return handshakeListeners.remove(listener);
|
||||
}
|
||||
|
||||
protected DecryptedEndPoint newDecryptedEndPoint()
|
||||
protected SslEndPoint newSslEndPoint()
|
||||
{
|
||||
return new DecryptedEndPoint();
|
||||
return new SslEndPoint();
|
||||
}
|
||||
|
||||
public SSLEngine getSSLEngine()
|
||||
|
@ -214,9 +214,9 @@ public class SslConnection extends AbstractConnection implements Connection.Upgr
|
|||
return _sslEngine;
|
||||
}
|
||||
|
||||
public DecryptedEndPoint getDecryptedEndPoint()
|
||||
public SslEndPoint getSslEndPoint()
|
||||
{
|
||||
return _decryptedEndPoint;
|
||||
return _sslEndPoint;
|
||||
}
|
||||
|
||||
public boolean isRenegotiationAllowed()
|
||||
|
@ -331,26 +331,26 @@ public class SslConnection extends AbstractConnection implements Connection.Upgr
|
|||
public void onOpen()
|
||||
{
|
||||
super.onOpen();
|
||||
getDecryptedEndPoint().getConnection().onOpen();
|
||||
getSslEndPoint().getConnection().onOpen();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClose(Throwable cause)
|
||||
{
|
||||
_decryptedEndPoint.getConnection().onClose(cause);
|
||||
getSslEndPoint().getConnection().onClose(cause);
|
||||
super.onClose(cause);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close()
|
||||
{
|
||||
getDecryptedEndPoint().getConnection().close();
|
||||
getSslEndPoint().getConnection().close();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onIdleExpired()
|
||||
{
|
||||
return getDecryptedEndPoint().getConnection().onIdleExpired();
|
||||
return getSslEndPoint().getConnection().onIdleExpired();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -366,10 +366,10 @@ public class SslConnection extends AbstractConnection implements Connection.Upgr
|
|||
LOG.debug(">c.onFillable {}", SslConnection.this);
|
||||
|
||||
// We have received a close handshake, close the end point to send FIN.
|
||||
if (_decryptedEndPoint.isInputShutdown())
|
||||
_decryptedEndPoint.close();
|
||||
if (_sslEndPoint.isInputShutdown())
|
||||
_sslEndPoint.close();
|
||||
|
||||
_decryptedEndPoint.onFillable();
|
||||
_sslEndPoint.onFillable();
|
||||
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("<c.onFillable {}", SslConnection.this);
|
||||
|
@ -378,7 +378,7 @@ public class SslConnection extends AbstractConnection implements Connection.Upgr
|
|||
@Override
|
||||
public void onFillInterestedFailed(Throwable cause)
|
||||
{
|
||||
_decryptedEndPoint.onFillableFail(cause == null ? new IOException() : cause);
|
||||
_sslEndPoint.onFillableFail(cause == null ? new IOException() : cause);
|
||||
}
|
||||
|
||||
protected SSLEngineResult wrap(SSLEngine sslEngine, ByteBuffer[] input, ByteBuffer output) throws SSLException
|
||||
|
@ -401,14 +401,14 @@ public class SslConnection extends AbstractConnection implements Connection.Upgr
|
|||
b = _decryptedInput == null ? null : _decryptedInput.getByteBuffer();
|
||||
int di = b == null ? -1 : b.remaining();
|
||||
|
||||
Connection connection = _decryptedEndPoint.getConnection();
|
||||
Connection connection = _sslEndPoint.getConnection();
|
||||
return String.format("%s@%x{%s,eio=%d/%d,di=%d,fill=%s,flush=%s}~>%s=>%s",
|
||||
getClass().getSimpleName(),
|
||||
hashCode(),
|
||||
_sslEngine.getHandshakeStatus(),
|
||||
ei, eo, di,
|
||||
_fillState, _flushState,
|
||||
_decryptedEndPoint.toEndPointString(),
|
||||
_sslEndPoint.toEndPointString(),
|
||||
connection instanceof AbstractConnection ? ((AbstractConnection)connection).toConnectionString() : connection);
|
||||
}
|
||||
|
||||
|
@ -481,12 +481,12 @@ public class SslConnection extends AbstractConnection implements Connection.Upgr
|
|||
return getEndPoint().flush(output);
|
||||
}
|
||||
|
||||
public class DecryptedEndPoint extends AbstractEndPoint implements EndPoint.Wrapper
|
||||
public class SslEndPoint extends AbstractEndPoint implements EndPoint.Wrapper
|
||||
{
|
||||
private final Callback _incompleteWriteCallback = new IncompleteWriteCallback();
|
||||
private Throwable _failure;
|
||||
|
||||
public DecryptedEndPoint()
|
||||
public SslEndPoint()
|
||||
{
|
||||
// Disable idle timeout checking: no scheduler and -1 timeout for this instance.
|
||||
super(null);
|
||||
|
@ -824,7 +824,7 @@ public class SslConnection extends AbstractConnection implements Connection.Upgr
|
|||
if (_flushState == FlushState.WAIT_FOR_FILL)
|
||||
{
|
||||
_flushState = FlushState.IDLE;
|
||||
getExecutor().execute(() -> _decryptedEndPoint.getWriteFlusher().onFail(failure));
|
||||
getExecutor().execute(() -> _sslEndPoint.getWriteFlusher().onFail(failure));
|
||||
}
|
||||
throw failure;
|
||||
}
|
||||
|
@ -835,7 +835,7 @@ public class SslConnection extends AbstractConnection implements Connection.Upgr
|
|||
if (_flushState == FlushState.WAIT_FOR_FILL)
|
||||
{
|
||||
_flushState = FlushState.IDLE;
|
||||
getExecutor().execute(() -> _decryptedEndPoint.getWriteFlusher().completeWrite());
|
||||
getExecutor().execute(() -> _sslEndPoint.getWriteFlusher().completeWrite());
|
||||
}
|
||||
|
||||
if (LOG.isDebugEnabled())
|
||||
|
@ -1579,9 +1579,9 @@ public class SslConnection extends AbstractConnection implements Connection.Upgr
|
|||
if (interested)
|
||||
ensureFillInterested();
|
||||
else if (fillable)
|
||||
_decryptedEndPoint.getFillInterest().fillable();
|
||||
_sslEndPoint.getFillInterest().fillable();
|
||||
|
||||
_decryptedEndPoint.getWriteFlusher().completeWrite();
|
||||
_sslEndPoint.getWriteFlusher().completeWrite();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1605,15 +1605,15 @@ public class SslConnection extends AbstractConnection implements Connection.Upgr
|
|||
getExecutor().execute(() ->
|
||||
{
|
||||
if (failFillInterest)
|
||||
_decryptedEndPoint.getFillInterest().onFail(x);
|
||||
_decryptedEndPoint.getWriteFlusher().onFail(x);
|
||||
_sslEndPoint.getFillInterest().onFail(x);
|
||||
_sslEndPoint.getWriteFlusher().onFail(x);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public InvocationType getInvocationType()
|
||||
{
|
||||
return _decryptedEndPoint.getWriteFlusher().getCallbackInvocationType();
|
||||
return _sslEndPoint.getWriteFlusher().getCallbackInvocationType();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -643,8 +643,9 @@ public class SocketChannelEndPointTest
|
|||
SslConnection sslConnection = new SslConnection(_bufferPool, executor, endpoint, engine);
|
||||
sslConnection.setRenegotiationAllowed(_sslCtxFactory.isRenegotiationAllowed());
|
||||
sslConnection.setRenegotiationLimit(_sslCtxFactory.getRenegotiationLimit());
|
||||
Connection appConnection = _normalScenario.newConnection(channel, sslConnection.getDecryptedEndPoint(), executor, blockAt, writeCount);
|
||||
sslConnection.getDecryptedEndPoint().setConnection(appConnection);
|
||||
SslConnection.SslEndPoint sslEndPoint = sslConnection.getSslEndPoint();
|
||||
Connection appConnection = _normalScenario.newConnection(channel, sslEndPoint, executor, blockAt, writeCount);
|
||||
sslEndPoint.setConnection(appConnection);
|
||||
return sslConnection;
|
||||
}
|
||||
|
||||
|
|
|
@ -90,8 +90,9 @@ public class SslConnectionTest
|
|||
SslConnection sslConnection = new SslConnection(_bufferPool, getExecutor(), endpoint, engine);
|
||||
sslConnection.setRenegotiationAllowed(_sslCtxFactory.isRenegotiationAllowed());
|
||||
sslConnection.setRenegotiationLimit(_sslCtxFactory.getRenegotiationLimit());
|
||||
Connection appConnection = new TestConnection(sslConnection.getDecryptedEndPoint());
|
||||
sslConnection.getDecryptedEndPoint().setConnection(appConnection);
|
||||
SslConnection.SslEndPoint sslEndPoint = sslConnection.getSslEndPoint();
|
||||
Connection appConnection = new TestConnection(sslEndPoint);
|
||||
sslEndPoint.setConnection(appConnection);
|
||||
return sslConnection;
|
||||
}
|
||||
|
||||
|
|
|
@ -93,9 +93,8 @@ public abstract class NegotiatingServerConnectionFactory extends AbstractConnect
|
|||
EndPoint ep = endPoint;
|
||||
while (engine == null && ep != null)
|
||||
{
|
||||
// TODO make more generic
|
||||
if (ep instanceof SslConnection.DecryptedEndPoint)
|
||||
engine = ((SslConnection.DecryptedEndPoint)ep).getSslConnection().getSSLEngine();
|
||||
if (ep instanceof SslConnection.SslEndPoint ssl)
|
||||
engine = ssl.getSslConnection().getSSLEngine();
|
||||
else
|
||||
ep = null;
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ import org.eclipse.jetty.http.HttpHeader;
|
|||
import org.eclipse.jetty.http.PreEncodedHttpField;
|
||||
import org.eclipse.jetty.io.EndPoint;
|
||||
import org.eclipse.jetty.io.ssl.SslConnection;
|
||||
import org.eclipse.jetty.io.ssl.SslConnection.DecryptedEndPoint;
|
||||
import org.eclipse.jetty.io.ssl.SslConnection.SslEndPoint;
|
||||
import org.eclipse.jetty.util.StringUtil;
|
||||
import org.eclipse.jetty.util.annotation.Name;
|
||||
import org.eclipse.jetty.util.ssl.SslContextFactory;
|
||||
|
@ -217,7 +217,7 @@ public class SecureRequestCustomizer implements HttpConfiguration.Customizer
|
|||
public Request customize(Request request, HttpFields.Mutable responseHeaders)
|
||||
{
|
||||
EndPoint endPoint = request.getConnectionMetaData().getConnection().getEndPoint();
|
||||
if (endPoint instanceof DecryptedEndPoint sslEndPoint)
|
||||
if (endPoint instanceof SslEndPoint sslEndPoint)
|
||||
{
|
||||
SslConnection sslConnection = sslEndPoint.getSslConnection();
|
||||
SSLEngine sslEngine = sslConnection.getSSLEngine();
|
||||
|
|
|
@ -20,7 +20,7 @@ import org.eclipse.jetty.io.Connection.Listener;
|
|||
import org.eclipse.jetty.io.EndPoint;
|
||||
import org.eclipse.jetty.io.SocketChannelEndPoint;
|
||||
import org.eclipse.jetty.io.ssl.SslConnection;
|
||||
import org.eclipse.jetty.io.ssl.SslConnection.DecryptedEndPoint;
|
||||
import org.eclipse.jetty.io.ssl.SslConnection.SslEndPoint;
|
||||
|
||||
/**
|
||||
* A Connection Lister for customization of SocketConnections.
|
||||
|
@ -57,15 +57,15 @@ public class SocketCustomizationListener implements Listener
|
|||
EndPoint endPoint = connection.getEndPoint();
|
||||
boolean ssl = false;
|
||||
|
||||
if (_ssl && endPoint instanceof DecryptedEndPoint)
|
||||
if (_ssl && endPoint instanceof SslEndPoint sslEndPoint)
|
||||
{
|
||||
endPoint = ((DecryptedEndPoint)endPoint).getSslConnection().getEndPoint();
|
||||
endPoint = sslEndPoint.getSslConnection().getEndPoint();
|
||||
ssl = true;
|
||||
}
|
||||
|
||||
if (endPoint instanceof SocketChannelEndPoint)
|
||||
if (endPoint instanceof SocketChannelEndPoint socketEndPoint)
|
||||
{
|
||||
Socket socket = ((SocketChannelEndPoint)endPoint).getChannel().socket();
|
||||
Socket socket = socketEndPoint.getChannel().socket();
|
||||
customize(socket, connection.getClass(), ssl);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -157,9 +157,9 @@ public class SslConnectionFactory extends AbstractConnectionFactory implements C
|
|||
configure(sslConnection, connector, endPoint);
|
||||
|
||||
ConnectionFactory next = connector.getConnectionFactory(_nextProtocol);
|
||||
EndPoint decryptedEndPoint = sslConnection.getDecryptedEndPoint();
|
||||
Connection connection = next.newConnection(connector, decryptedEndPoint);
|
||||
decryptedEndPoint.setConnection(connection);
|
||||
EndPoint sslEndPoint = sslConnection.getSslEndPoint();
|
||||
Connection connection = next.newConnection(connector, sslEndPoint);
|
||||
sslEndPoint.setConnection(connection);
|
||||
|
||||
return sslConnection;
|
||||
}
|
||||
|
|
|
@ -264,7 +264,7 @@ public class HttpConnection extends AbstractConnection implements Runnable, Writ
|
|||
@Override
|
||||
public boolean isSecure()
|
||||
{
|
||||
return getEndPoint() instanceof SslConnection.DecryptedEndPoint;
|
||||
return getEndPoint() instanceof SslConnection.SslEndPoint;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1233,7 +1233,7 @@ public class HttpConnection extends AbstractConnection implements Runnable, Writ
|
|||
|
||||
// Set the scheme in the URI
|
||||
if (!_uri.isAbsolute())
|
||||
_uri.scheme(getEndPoint() instanceof SslConnection.DecryptedEndPoint ? HttpScheme.HTTPS : HttpScheme.HTTP);
|
||||
_uri.scheme(getEndPoint() instanceof SslConnection.SslEndPoint ? HttpScheme.HTTPS : HttpScheme.HTTP);
|
||||
|
||||
// Set the authority (if not already set) in the URI
|
||||
if (!HttpMethod.CONNECT.is(_method) && _uri.getAuthority() == null)
|
||||
|
|
|
@ -184,8 +184,8 @@ public abstract class ConnectorTimeoutTest extends HttpServerTestFixture
|
|||
|
||||
// Get the server side endpoint
|
||||
EndPoint endPoint = exchanger.exchange(null, 10, TimeUnit.SECONDS);
|
||||
if (endPoint instanceof SslConnection.DecryptedEndPoint)
|
||||
endPoint = ((SslConnection.DecryptedEndPoint)endPoint).getSslConnection().getEndPoint();
|
||||
if (endPoint instanceof SslConnection.SslEndPoint sslEndPoint)
|
||||
endPoint = sslEndPoint.getSslConnection().getEndPoint();
|
||||
|
||||
// read the response
|
||||
String result = IO.toString(is);
|
||||
|
@ -247,8 +247,8 @@ public abstract class ConnectorTimeoutTest extends HttpServerTestFixture
|
|||
|
||||
// Get the server side endpoint
|
||||
EndPoint endPoint = exchanger.exchange(null, 10, TimeUnit.SECONDS);
|
||||
if (endPoint instanceof SslConnection.DecryptedEndPoint)
|
||||
endPoint = ((SslConnection.DecryptedEndPoint)endPoint).getSslConnection().getEndPoint();
|
||||
if (endPoint instanceof SslConnection.SslEndPoint sslEndPoint)
|
||||
endPoint = sslEndPoint.getSslConnection().getEndPoint();
|
||||
|
||||
// read the response
|
||||
IO.toString(is);
|
||||
|
|
|
@ -103,7 +103,7 @@ public class SniSslConnectionFactoryTest
|
|||
public boolean process(Request request, Response response, Callback callback) throws Exception
|
||||
{
|
||||
EndPoint endPoint = request.getConnectionMetaData().getConnection().getEndPoint();
|
||||
SslConnection.DecryptedEndPoint sslEndPoint = (SslConnection.DecryptedEndPoint)endPoint;
|
||||
SslConnection.SslEndPoint sslEndPoint = (SslConnection.SslEndPoint)endPoint;
|
||||
SslConnection sslConnection = sslEndPoint.getSslConnection();
|
||||
SSLEngine sslEngine = sslConnection.getSSLEngine();
|
||||
SSLSession session = sslEngine.getSession();
|
||||
|
|
Loading…
Reference in New Issue