Merged branch 'jetty-12.0.x' into 'jetty-12.1.x'.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
This commit is contained in:
commit
838b97d5d2
|
@ -401,8 +401,8 @@ public interface EndPoint extends Closeable, Content.Sink
|
|||
interface SslSessionData
|
||||
{
|
||||
/**
|
||||
* The name at which an {@code SslSessionData} instance may be found as a request
|
||||
* {@link org.eclipse.jetty.util.Attributes Attribute} or from {@link SSLSession#getValue(String)}.
|
||||
* The name at which an {@code SslSessionData} instance may be found
|
||||
* as a request {@link org.eclipse.jetty.util.Attributes attribute}.
|
||||
*/
|
||||
String ATTRIBUTE = "org.eclipse.jetty.io.Endpoint.SslSessionData";
|
||||
|
||||
|
|
|
@ -507,6 +507,7 @@ public class SslConnection extends AbstractConnection implements Connection.Upgr
|
|||
|
||||
private final Callback _incompleteWriteCallback = new IncompleteWriteCallback();
|
||||
private Throwable _failure;
|
||||
private SslSessionData _sslSessionData;
|
||||
|
||||
public SslEndPoint()
|
||||
{
|
||||
|
@ -1572,6 +1573,28 @@ public class SslConnection extends AbstractConnection implements Connection.Upgr
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SslSessionData getSslSessionData()
|
||||
{
|
||||
SSLSession sslSession = _sslEngine.getSession();
|
||||
SslSessionData sslSessionData = _sslSessionData;
|
||||
if (sslSessionData == null)
|
||||
{
|
||||
String cipherSuite = sslSession.getCipherSuite();
|
||||
|
||||
X509Certificate[] peerCertificates = _sslContextFactory != null
|
||||
? _sslContextFactory.getX509CertChain(sslSession)
|
||||
: SslContextFactory.getCertChain(sslSession);
|
||||
|
||||
byte[] bytes = sslSession.getId();
|
||||
String idStr = StringUtil.toHexString(bytes);
|
||||
|
||||
sslSessionData = SslSessionData.from(sslSession, idStr, cipherSuite, peerCertificates);
|
||||
_sslSessionData = sslSessionData;
|
||||
}
|
||||
return sslSessionData;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
|
@ -1644,28 +1667,6 @@ public class SslConnection extends AbstractConnection implements Connection.Upgr
|
|||
return String.format("SSL@%h.DEP.writeCallback", SslConnection.this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SslSessionData getSslSessionData()
|
||||
{
|
||||
SSLSession sslSession = _sslEngine.getSession();
|
||||
SslSessionData sslSessionData = (SslSessionData)sslSession.getValue(SslSessionData.ATTRIBUTE);
|
||||
if (sslSessionData == null)
|
||||
{
|
||||
String cipherSuite = sslSession.getCipherSuite();
|
||||
|
||||
X509Certificate[] peerCertificates = _sslContextFactory != null
|
||||
? _sslContextFactory.getX509CertChain(sslSession)
|
||||
: SslContextFactory.getCertChain(sslSession);
|
||||
|
||||
byte[] bytes = sslSession.getId();
|
||||
String idStr = StringUtil.toHexString(bytes);
|
||||
|
||||
sslSessionData = SslSessionData.from(sslSession, idStr, cipherSuite, peerCertificates);
|
||||
sslSession.putValue(SslSessionData.ATTRIBUTE, sslSessionData);
|
||||
}
|
||||
return sslSessionData;
|
||||
}
|
||||
}
|
||||
|
||||
private abstract class RunnableTask implements Invocable.Task
|
||||
|
|
Loading…
Reference in New Issue