Merged branch 'jetty-9.3.x' into 'jetty-9.4.x'.

This commit is contained in:
Simone Bordet 2018-07-18 16:21:00 +02:00
commit eceaff7bed
8 changed files with 88 additions and 4 deletions

View File

@ -0,0 +1,7 @@
DO NOT EDIT - See: https://www.eclipse.org/jetty/documentation/current/startup-modules.html
[files]
maven://org.mortbay.jetty.alpn/alpn-boot/8.1.12.v20180117|lib/alpn/alpn-boot-8.1.12.v20180117.jar
[exec]
-Xbootclasspath/p:lib/alpn/alpn-boot-8.1.12.v20180117.jar

View File

@ -346,6 +346,7 @@ The ALPN implementation, relying on modifications of OpenJDK classes, updates ev
|1.8.0u162 |8.1.12.v20180117
|1.8.0u171 |8.1.12.v20180117
|1.8.0u172 |8.1.12.v20180117
|1.8.0u181 |8.1.12.v20180117
|=============================
[[alpn-build]]

View File

@ -43,6 +43,8 @@ public class SslClientConnectionFactory implements ClientConnectionFactory
private final ByteBufferPool byteBufferPool;
private final Executor executor;
private final ClientConnectionFactory connectionFactory;
private boolean _directBuffersForEncryption = true;
private boolean _directBuffersForDecryption = true;
private boolean allowMissingCloseMessage = true;
public SslClientConnectionFactory(SslContextFactory sslContextFactory, ByteBufferPool byteBufferPool, Executor executor, ClientConnectionFactory connectionFactory)
@ -53,6 +55,26 @@ public class SslClientConnectionFactory implements ClientConnectionFactory
this.connectionFactory = connectionFactory;
}
public void setDirectBuffersForEncryption(boolean useDirectBuffers)
{
this._directBuffersForEncryption = useDirectBuffers;
}
public void setDirectBuffersForDecryption(boolean useDirectBuffers)
{
this._directBuffersForDecryption = useDirectBuffers;
}
public boolean isDirectBuffersForDecryption()
{
return _directBuffersForDecryption;
}
public boolean isDirectBuffersForEncryption()
{
return _directBuffersForEncryption;
}
public boolean isAllowMissingCloseMessage()
{
return allowMissingCloseMessage;
@ -85,7 +107,7 @@ public class SslClientConnectionFactory implements ClientConnectionFactory
protected SslConnection newSslConnection(ByteBufferPool byteBufferPool, Executor executor, EndPoint endPoint, SSLEngine engine)
{
return new SslConnection(byteBufferPool, executor, endPoint, engine);
return new SslConnection(byteBufferPool, executor, endPoint, engine, isDirectBuffersForEncryption(), isDirectBuffersForDecryption());
}
@Override

View File

@ -110,8 +110,8 @@ public class SslConnection extends AbstractConnection
private ByteBuffer _decryptedInput;
private ByteBuffer _encryptedInput;
private ByteBuffer _encryptedOutput;
private final boolean _encryptedDirectBuffers = true;
private final boolean _decryptedDirectBuffers = false;
private final boolean _encryptedDirectBuffers;
private final boolean _decryptedDirectBuffers;
private boolean _renegotiationAllowed;
private int _renegotiationLimit = -1;
private boolean _closedOutbound;
@ -180,6 +180,12 @@ public class SslConnection extends AbstractConnection
};
public SslConnection(ByteBufferPool byteBufferPool, Executor executor, EndPoint endPoint, SSLEngine sslEngine)
{
this(byteBufferPool, executor, endPoint, sslEngine, false, false);
}
public SslConnection(ByteBufferPool byteBufferPool, Executor executor, EndPoint endPoint, SSLEngine sslEngine,
boolean useDirectBuffersForEncryption, boolean useDirectBuffersForDecryption)
{
// This connection does not execute calls to onFillable(), so they will be called by the selector thread.
// onFillable() does not block and will only wakeup another thread to do the actual reading and handling.
@ -187,6 +193,8 @@ public class SslConnection extends AbstractConnection
this._bufferPool = byteBufferPool;
this._sslEngine = sslEngine;
this._decryptedEndPoint = newDecryptedEndPoint();
this._encryptedDirectBuffers = useDirectBuffersForEncryption;
this._decryptedDirectBuffers = useDirectBuffersForDecryption;
}
public void addHandshakeListener(SslHandshakeListener listener)

View File

@ -47,6 +47,7 @@ import org.eclipse.jetty.util.thread.QueuedThreadPool;
import org.eclipse.jetty.util.thread.Scheduler;
import org.eclipse.jetty.util.thread.TimerScheduler;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
@ -142,6 +143,12 @@ public class SslConnectionTest
__sslCtxFactory.start();
}
@AfterClass
public static void stopSsl() throws Exception
{
__sslCtxFactory.stop();
}
@Before
public void startManager() throws Exception
{

View File

@ -37,6 +37,8 @@ public class SslConnectionFactory extends AbstractConnectionFactory
{
private final SslContextFactory _sslContextFactory;
private final String _nextProtocol;
private boolean _directBuffersForEncryption = false;
private boolean _directBuffersForDecryption = false;
public SslConnectionFactory()
{
@ -61,6 +63,26 @@ public class SslConnectionFactory extends AbstractConnectionFactory
return _sslContextFactory;
}
public void setDirectBuffersForEncryption(boolean useDirectBuffers)
{
this._directBuffersForEncryption = useDirectBuffers;
}
public void setDirectBuffersForDecryption(boolean useDirectBuffers)
{
this._directBuffersForDecryption = useDirectBuffers;
}
public boolean isDirectBuffersForDecryption()
{
return _directBuffersForDecryption;
}
public boolean isDirectBuffersForEncryption()
{
return _directBuffersForEncryption;
}
public String getNextProtocol()
{
return _nextProtocol;
@ -100,7 +122,7 @@ public class SslConnectionFactory extends AbstractConnectionFactory
protected SslConnection newSslConnection(Connector connector, EndPoint endPoint, SSLEngine engine)
{
return new SslConnection(connector.getByteBufferPool(), connector.getExecutor(), endPoint, engine);
return new SslConnection(connector.getByteBufferPool(), connector.getExecutor(), endPoint, engine, isDirectBuffersForEncryption(), isDirectBuffersForDecryption());
}
@Override

View File

@ -0,0 +1,5 @@
[files]
maven://org.mortbay.jetty.alpn/alpn-boot/8.1.12.v20180117|lib/alpn/alpn-boot-8.1.12.v20180117.jar
[exec]
-Xbootclasspath/p:lib/alpn/alpn-boot-8.1.12.v20180117.jar

12
pom.xml
View File

@ -1707,6 +1707,18 @@
<alpn.version>8.1.12.v20180117</alpn.version>
</properties>
</profile>
<profile>
<id>8u181</id>
<activation>
<property>
<name>java.version</name>
<value>1.8.0_181</value>
</property>
</activation>
<properties>
<alpn.version>8.1.12.v20180117</alpn.version>
</properties>
</profile>
<profile>
<id>jdk9</id>
<activation>