diff --git a/jetty-alpn/jetty-alpn-server/src/main/config/modules/alpn-impl/alpn-1.8.0_181.mod b/jetty-alpn/jetty-alpn-server/src/main/config/modules/alpn-impl/alpn-1.8.0_181.mod
new file mode 100644
index 00000000000..00366a87b3d
--- /dev/null
+++ b/jetty-alpn/jetty-alpn-server/src/main/config/modules/alpn-impl/alpn-1.8.0_181.mod
@@ -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
diff --git a/jetty-documentation/src/main/asciidoc/administration/alpn/alpn.adoc b/jetty-documentation/src/main/asciidoc/administration/alpn/alpn.adoc
index aa8414f5592..adb8a86e31a 100644
--- a/jetty-documentation/src/main/asciidoc/administration/alpn/alpn.adoc
+++ b/jetty-documentation/src/main/asciidoc/administration/alpn/alpn.adoc
@@ -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]]
diff --git a/jetty-io/src/main/java/org/eclipse/jetty/io/ssl/SslClientConnectionFactory.java b/jetty-io/src/main/java/org/eclipse/jetty/io/ssl/SslClientConnectionFactory.java
index ccc70dd6eea..5ef729c15c8 100644
--- a/jetty-io/src/main/java/org/eclipse/jetty/io/ssl/SslClientConnectionFactory.java
+++ b/jetty-io/src/main/java/org/eclipse/jetty/io/ssl/SslClientConnectionFactory.java
@@ -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
diff --git a/jetty-io/src/main/java/org/eclipse/jetty/io/ssl/SslConnection.java b/jetty-io/src/main/java/org/eclipse/jetty/io/ssl/SslConnection.java
index 7732e11c1f2..7078c01635b 100644
--- a/jetty-io/src/main/java/org/eclipse/jetty/io/ssl/SslConnection.java
+++ b/jetty-io/src/main/java/org/eclipse/jetty/io/ssl/SslConnection.java
@@ -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)
diff --git a/jetty-io/src/test/java/org/eclipse/jetty/io/SslConnectionTest.java b/jetty-io/src/test/java/org/eclipse/jetty/io/SslConnectionTest.java
index 34404d946c7..fcd320e2448 100644
--- a/jetty-io/src/test/java/org/eclipse/jetty/io/SslConnectionTest.java
+++ b/jetty-io/src/test/java/org/eclipse/jetty/io/SslConnectionTest.java
@@ -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
{
diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/SslConnectionFactory.java b/jetty-server/src/main/java/org/eclipse/jetty/server/SslConnectionFactory.java
index 61b6ee1004f..e6edf0412b4 100644
--- a/jetty-server/src/main/java/org/eclipse/jetty/server/SslConnectionFactory.java
+++ b/jetty-server/src/main/java/org/eclipse/jetty/server/SslConnectionFactory.java
@@ -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
diff --git a/jetty-start/src/test/resources/dist-home/modules/alpn-impl/alpn-1.8.0_181.mod b/jetty-start/src/test/resources/dist-home/modules/alpn-impl/alpn-1.8.0_181.mod
new file mode 100644
index 00000000000..4807b8fa634
--- /dev/null
+++ b/jetty-start/src/test/resources/dist-home/modules/alpn-impl/alpn-1.8.0_181.mod
@@ -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
diff --git a/pom.xml b/pom.xml
index caf6c4832db..5e1d12d5c4c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1707,6 +1707,18 @@
8.1.12.v20180117
+
+ 8u181
+
+
+ java.version
+ 1.8.0_181
+
+
+
+ 8.1.12.v20180117
+
+
jdk9