File trim-deps.patch of Package netty_mini_ssl
--- java/io/netty/handler/ssl/JdkSslContext.java 2023-12-15 11:49:56.000000000 +0300
+++ java/io/netty/handler/ssl/JdkSslContext.java 2024-03-26 01:04:38.000000000 +0300
@@ -394,50 +394,6 @@
switch(config.protocol()) {
case NONE:
return JdkDefaultApplicationProtocolNegotiator.INSTANCE;
- case ALPN:
- if (isServer) {
- switch(config.selectorFailureBehavior()) {
- case FATAL_ALERT:
- return new JdkAlpnApplicationProtocolNegotiator(true, config.supportedProtocols());
- case NO_ADVERTISE:
- return new JdkAlpnApplicationProtocolNegotiator(false, config.supportedProtocols());
- default:
- throw new UnsupportedOperationException(new StringBuilder("JDK provider does not support ")
- .append(config.selectorFailureBehavior()).append(" failure behavior").toString());
- }
- } else {
- switch(config.selectedListenerFailureBehavior()) {
- case ACCEPT:
- return new JdkAlpnApplicationProtocolNegotiator(false, config.supportedProtocols());
- case FATAL_ALERT:
- return new JdkAlpnApplicationProtocolNegotiator(true, config.supportedProtocols());
- default:
- throw new UnsupportedOperationException(new StringBuilder("JDK provider does not support ")
- .append(config.selectedListenerFailureBehavior()).append(" failure behavior").toString());
- }
- }
- case NPN:
- if (isServer) {
- switch(config.selectedListenerFailureBehavior()) {
- case ACCEPT:
- return new JdkNpnApplicationProtocolNegotiator(false, config.supportedProtocols());
- case FATAL_ALERT:
- return new JdkNpnApplicationProtocolNegotiator(true, config.supportedProtocols());
- default:
- throw new UnsupportedOperationException(new StringBuilder("JDK provider does not support ")
- .append(config.selectedListenerFailureBehavior()).append(" failure behavior").toString());
- }
- } else {
- switch(config.selectorFailureBehavior()) {
- case FATAL_ALERT:
- return new JdkNpnApplicationProtocolNegotiator(true, config.supportedProtocols());
- case NO_ADVERTISE:
- return new JdkNpnApplicationProtocolNegotiator(false, config.supportedProtocols());
- default:
- throw new UnsupportedOperationException(new StringBuilder("JDK provider does not support ")
- .append(config.selectorFailureBehavior()).append(" failure behavior").toString());
- }
- }
default:
throw new UnsupportedOperationException(new StringBuilder("JDK provider does not support ")
.append(config.protocol()).append(" protocol").toString());
--- java/io/netty/handler/ssl/OpenSslClientContext.java 2023-12-15 11:49:56.000000000 +0300
+++ java/io/netty/handler/ssl/OpenSslClientContext.java 2024-03-17 14:22:35.000000000 +0300
@@ -181,7 +181,7 @@
sessionTimeout, false, KeyStore.getDefaultType());
}
- OpenSslClientContext(X509Certificate[] trustCertCollection, TrustManagerFactory trustManagerFactory,
+ public OpenSslClientContext(X509Certificate[] trustCertCollection, TrustManagerFactory trustManagerFactory,
X509Certificate[] keyCertChain, PrivateKey key, String keyPassword,
KeyManagerFactory keyManagerFactory, Iterable<String> ciphers,
CipherSuiteFilter cipherFilter, ApplicationProtocolConfig apn, String[] protocols,
--- java/io/netty/handler/ssl/SslContext.java 2023-12-15 11:49:56.000000000 +0300
+++ java/io/netty/handler/ssl/SslContext.java 2024-03-26 00:49:04.000000000 +0300
@@ -1156,14 +1156,6 @@
return null;
}
- // try BC first, if this fail fallback to original key extraction process
- if (tryBouncyCastle && BouncyCastlePemReader.isAvailable()) {
- PrivateKey pk = BouncyCastlePemReader.getPrivateKey(keyFile, keyPassword);
- if (pk != null) {
- return pk;
- }
- }
-
return getPrivateKeyFromByteBuffer(PemReader.readPrivateKey(keyFile), keyPassword);
}
@@ -1176,21 +1168,6 @@
return null;
}
- // try BC first, if this fail fallback to original key extraction process
- if (BouncyCastlePemReader.isAvailable()) {
- if (!keyInputStream.markSupported()) {
- // We need an input stream that supports resetting, in case BouncyCastle fails to read.
- keyInputStream = new BufferedInputStream(keyInputStream);
- }
- keyInputStream.mark(1048576); // Be able to reset up to 1 MiB of data.
- PrivateKey pk = BouncyCastlePemReader.getPrivateKey(keyInputStream, keyPassword);
- if (pk != null) {
- return pk;
- }
- // BouncyCastle could not read the key. Reset the input stream in case the input position changed.
- keyInputStream.reset();
- }
-
return getPrivateKeyFromByteBuffer(PemReader.readPrivateKey(keyInputStream), keyPassword);
}
--- java/io/netty/handler/ssl/SslHandler.java 2023-12-15 11:49:56.000000000 +0300
+++ java/io/netty/handler/ssl/SslHandler.java 2024-03-26 00:59:26.000000000 +0300
@@ -252,55 +252,6 @@
return ((ReferenceCountedOpenSslEngine) engine).jdkCompatibilityMode;
}
},
- CONSCRYPT(true, COMPOSITE_CUMULATOR) {
- @Override
- SSLEngineResult unwrap(SslHandler handler, ByteBuf in, int len, ByteBuf out) throws SSLException {
- int nioBufferCount = in.nioBufferCount();
- int writerIndex = out.writerIndex();
- final SSLEngineResult result;
- if (nioBufferCount > 1) {
- /*
- * Use a special unwrap method without additional memory copies.
- */
- try {
- handler.singleBuffer[0] = toByteBuffer(out, writerIndex, out.writableBytes());
- result = ((ConscryptAlpnSslEngine) handler.engine).unwrap(
- in.nioBuffers(in.readerIndex(), len),
- handler.singleBuffer);
- } finally {
- handler.singleBuffer[0] = null;
- }
- } else {
- result = handler.engine.unwrap(toByteBuffer(in, in.readerIndex(), len),
- toByteBuffer(out, writerIndex, out.writableBytes()));
- }
- out.writerIndex(writerIndex + result.bytesProduced());
- return result;
- }
-
- @Override
- ByteBuf allocateWrapBuffer(SslHandler handler, ByteBufAllocator allocator,
- int pendingBytes, int numComponents) {
- return allocator.directBuffer(
- ((ConscryptAlpnSslEngine) handler.engine).calculateOutNetBufSize(pendingBytes, numComponents));
- }
-
- @Override
- int calculateRequiredOutBufSpace(SslHandler handler, int pendingBytes, int numComponents) {
- return ((ConscryptAlpnSslEngine) handler.engine)
- .calculateRequiredOutBufSpace(pendingBytes, numComponents);
- }
-
- @Override
- int calculatePendingData(SslHandler handler, int guess) {
- return guess;
- }
-
- @Override
- boolean jdkCompatibilityMode(SSLEngine engine) {
- return true;
- }
- },
JDK(false, MERGE_CUMULATOR) {
@Override
SSLEngineResult unwrap(SslHandler handler, ByteBuf in, int len, ByteBuf out) throws SSLException {
@@ -360,7 +311,7 @@
static SslEngineType forEngine(SSLEngine engine) {
return engine instanceof ReferenceCountedOpenSslEngine ? TCNATIVE :
- engine instanceof ConscryptAlpnSslEngine ? CONSCRYPT : JDK;
+ JDK;
}
SslEngineType(boolean wantsDirectBuffer, Cumulator cumulator) {
--- java/io/netty/handler/ssl/SslProvider.java 2023-12-15 11:49:56.000000000 +0300
+++ java/io/netty/handler/ssl/SslProvider.java 2024-03-26 01:05:30.000000000 +0300
@@ -47,7 +47,7 @@
public static boolean isAlpnSupported(final SslProvider provider) {
switch (provider) {
case JDK:
- return JdkAlpnApplicationProtocolNegotiator.isAlpnSupported();
+ return false;
case OPENSSL:
case OPENSSL_REFCNT:
return OpenSsl.isAlpnSupported();
--- java/io/netty/util/concurrent/AbstractEventExecutor.java 2023-12-15 11:49:56.000000000 +0300
+++ java/io/netty/util/concurrent/AbstractEventExecutor.java 2024-03-26 01:15:57.000000000 +0300
@@ -19,8 +19,6 @@
import io.netty.util.internal.logging.InternalLogger;
import io.netty.util.internal.logging.InternalLoggerFactory;
-import org.jetbrains.annotations.Async.Execute;
-
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
@@ -169,7 +167,7 @@
}
}
- protected static void runTask(@Execute Runnable task) {
+ protected static void runTask(Runnable task) {
task.run();
}
--- java/io/netty/util/concurrent/GlobalEventExecutor.java 2023-12-15 11:49:56.000000000 +0300
+++ java/io/netty/util/concurrent/GlobalEventExecutor.java 2024-03-26 01:15:36.000000000 +0300
@@ -21,8 +21,6 @@
import io.netty.util.internal.logging.InternalLogger;
import io.netty.util.internal.logging.InternalLoggerFactory;
-import org.jetbrains.annotations.Async.Schedule;
-
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Queue;
@@ -221,7 +219,7 @@
execute0(task);
}
- private void execute0(@Schedule Runnable task) {
+ private void execute0(Runnable task) {
addTask(ObjectUtil.checkNotNull(task, "task"));
if (!inEventLoop()) {
startThread();
--- java/io/netty/util/concurrent/SingleThreadEventExecutor.java 2023-12-15 11:49:56.000000000 +0300
+++ java/io/netty/util/concurrent/SingleThreadEventExecutor.java 2024-03-26 01:16:15.000000000 +0300
@@ -22,7 +22,6 @@
import io.netty.util.internal.UnstableApi;
import io.netty.util.internal.logging.InternalLogger;
import io.netty.util.internal.logging.InternalLoggerFactory;
-import org.jetbrains.annotations.Async.Schedule;
import java.lang.Thread.State;
import java.util.ArrayList;
@@ -822,12 +821,12 @@
lazyExecute0(task);
}
- private void execute0(@Schedule Runnable task) {
+ private void execute0(Runnable task) {
ObjectUtil.checkNotNull(task, "task");
execute(task, wakesUpForTask(task));
}
- private void lazyExecute0(@Schedule Runnable task) {
+ private void lazyExecute0(Runnable task) {
execute(ObjectUtil.checkNotNull(task, "task"), false);
}
--- java/io/netty/util/internal/logging/InternalLoggerFactory.java 2023-12-15 11:49:56.000000000 +0300
+++ java/io/netty/util/internal/logging/InternalLoggerFactory.java 2024-03-26 01:26:23.000000000 +0300
@@ -39,63 +39,9 @@
@SuppressWarnings("UnusedCatchParameter")
private static InternalLoggerFactory newDefaultFactory(String name) {
- InternalLoggerFactory f = useSlf4JLoggerFactory(name);
- if (f != null) {
- return f;
- }
-
- f = useLog4J2LoggerFactory(name);
- if (f != null) {
- return f;
- }
-
- f = useLog4JLoggerFactory(name);
- if (f != null) {
- return f;
- }
-
return useJdkLoggerFactory(name);
}
- private static InternalLoggerFactory useSlf4JLoggerFactory(String name) {
- try {
- InternalLoggerFactory f = Slf4JLoggerFactory.getInstanceWithNopCheck();
- f.newInstance(name).debug("Using SLF4J as the default logging framework");
- return f;
- } catch (LinkageError ignore) {
- return null;
- } catch (Exception ignore) {
- // We catch Exception and not ReflectiveOperationException as we still support java 6
- return null;
- }
- }
-
- private static InternalLoggerFactory useLog4J2LoggerFactory(String name) {
- try {
- InternalLoggerFactory f = Log4J2LoggerFactory.INSTANCE;
- f.newInstance(name).debug("Using Log4J2 as the default logging framework");
- return f;
- } catch (LinkageError ignore) {
- return null;
- } catch (Exception ignore) {
- // We catch Exception and not ReflectiveOperationException as we still support java 6
- return null;
- }
- }
-
- private static InternalLoggerFactory useLog4JLoggerFactory(String name) {
- try {
- InternalLoggerFactory f = Log4JLoggerFactory.INSTANCE;
- f.newInstance(name).debug("Using Log4J as the default logging framework");
- return f;
- } catch (LinkageError ignore) {
- return null;
- } catch (Exception ignore) {
- // We catch Exception and not ReflectiveOperationException as we still support java 6
- return null;
- }
- }
-
private static InternalLoggerFactory useJdkLoggerFactory(String name) {
InternalLoggerFactory f = JdkLoggerFactory.INSTANCE;
f.newInstance(name).debug("Using java.util.logging as the default logging framework");
--- java/io/netty/util/Recycler.java 2023-12-15 11:49:56.000000000 +0300
+++ java/io/netty/util/Recycler.java 2024-03-26 01:14:22.000000000 +0300
@@ -24,7 +24,6 @@
import io.netty.util.internal.logging.InternalLogger;
import io.netty.util.internal.logging.InternalLoggerFactory;
import org.jctools.queues.MessagePassingQueue;
-import org.jetbrains.annotations.VisibleForTesting;
import java.util.ArrayDeque;
import java.util.Queue;
@@ -208,7 +207,6 @@
return true;
}
- @VisibleForTesting
final int threadLocalSize() {
LocalPool<T> localPool = threadLocal.getIfExists();
return localPool == null ? 0 : localPool.pooledHandles.size() + localPool.batch.size();
--- java/io/netty/channel/epoll/EpollEventLoop.java 2023-12-15 11:49:56.000000000 +0300
+++ java/io/netty/channel/epoll/EpollEventLoop.java 2024-03-25 22:41:00.000000000 +0300
@@ -90,7 +90,7 @@
// See https://man7.org/linux/man-pages/man2/timerfd_create.2.html.
private static final long MAX_SCHEDULED_TIMERFD_NS = 999999999;
- EpollEventLoop(EventLoopGroup parent, Executor executor, int maxEvents,
+ public EpollEventLoop(EventLoopGroup parent, Executor executor, int maxEvents,
SelectStrategy strategy, RejectedExecutionHandler rejectedExecutionHandler,
EventLoopTaskQueueFactory taskQueueFactory, EventLoopTaskQueueFactory tailTaskQueueFactory) {
super(parent, executor, false, newTaskQueue(taskQueueFactory), newTaskQueue(tailTaskQueueFactory),