update to Netty 4.1.50, better named modules

This commit is contained in:
Jörg Prante 2020-06-05 10:40:42 +02:00
parent b0b05d95d9
commit faf573ff5a
15 changed files with 45 additions and 63 deletions

View file

@ -1,9 +1,9 @@
group = org.xbib group = org.xbib
name = netty-http name = netty-http
version = 4.1.49.1 version = 4.1.50.0
gradle.wrapper.version = 6.4.1 gradle.wrapper.version = 6.4.1
netty.version = 4.1.49.Final netty.version = 4.1.50.Final
tcnative.version = 2.0.29.Final tcnative.version = 2.0.29.Final
tcnative-legacy-macosx.version = 2.0.26.Final tcnative-legacy-macosx.version = 2.0.26.Final
xbib.net.version = 2.0.4 xbib.net.version = 2.0.4
@ -12,8 +12,9 @@ reactivestreams.version = 1.0.2
xbib-guice.version = 4.0.4 xbib-guice.version = 4.0.4
reactivex.version = 1.3.8 reactivex.version = 1.3.8
conscrypt.version = 2.2.1 conscrypt.version = 2.2.1
jackson.version = 2.9.10 jackson.version = 2.11.0
mockito.version = 3.1.0 mockito.version = 3.3.3
asciidoclet.version = 1.5.6 asciidoclet.version = 1.5.6
# uuhh, too many tests to update in rx
junit.version = 5.6.2 junit.version = 5.6.2
junit4.version = 4.13 junit4.version = 4.13

View file

@ -35,3 +35,11 @@ task javadocJar(type: Jar, dependsOn: javadoc) {
artifacts { artifacts {
archives sourcesJar, javadocJar archives sourcesJar, javadocJar
} }
tasks.withType(JavaCompile) {
options.compilerArgs << '-Xlint:all,-exports'
}
javadoc {
options.addStringOption('Xdoclint:none', '-quiet')
}

View file

@ -1,10 +1,10 @@
module org.xbib.netty.http.client.api { module org.xbib.netty.http.client.api {
exports org.xbib.netty.http.client.api; exports org.xbib.netty.http.client.api;
requires org.xbib.netty.http.common; requires transitive org.xbib.netty.http.common;
requires org.xbib.net.url; requires org.xbib.net.url;
requires io.netty.transport;
requires io.netty.buffer; requires io.netty.buffer;
requires io.netty.common; requires io.netty.common;
requires io.netty.codec.http; requires io.netty.codec.http;
requires io.netty.codec.http2; requires io.netty.codec.http2;
requires io.netty.transport;
} }

View file

@ -1,8 +1,6 @@
module org.xbib.netty.http.client.rest { module org.xbib.netty.http.client.rest {
exports org.xbib.netty.http.client.rest; exports org.xbib.netty.http.client.rest;
requires org.xbib.netty.http.client.api; requires transitive org.xbib.netty.http.client;
requires org.xbib.netty.http.client;
requires org.xbib.netty.http.common;
requires org.xbib.net.url; requires org.xbib.net.url;
requires io.netty.buffer; requires io.netty.buffer;
requires io.netty.codec.http; requires io.netty.codec.http;

View file

@ -6,16 +6,15 @@ module org.xbib.netty.http.client {
exports org.xbib.netty.http.client.pool; exports org.xbib.netty.http.client.pool;
exports org.xbib.netty.http.client.retry; exports org.xbib.netty.http.client.retry;
exports org.xbib.netty.http.client.transport; exports org.xbib.netty.http.client.transport;
requires org.xbib.netty.http.client.api; requires transitive org.xbib.netty.http.client.api;
requires org.xbib.netty.http.common;
requires org.xbib.net.url; requires org.xbib.net.url;
requires io.netty.transport;
requires io.netty.buffer; requires io.netty.buffer;
requires io.netty.common; requires io.netty.common;
requires io.netty.handler;
requires io.netty.handler.proxy;
requires io.netty.codec.http; requires io.netty.codec.http;
requires io.netty.codec.http2; requires io.netty.codec.http2;
requires io.netty.handler;
requires io.netty.handler.proxy;
requires io.netty.transport;
requires java.logging; requires java.logging;
provides org.xbib.netty.http.client.api.ProtocolProvider with provides org.xbib.netty.http.client.api.ProtocolProvider with
org.xbib.netty.http.client.Http1Provider, org.xbib.netty.http.client.Http1Provider,

View file

@ -16,7 +16,6 @@ import io.netty.handler.proxy.HttpProxyHandler;
import io.netty.handler.ssl.ApplicationProtocolConfig; import io.netty.handler.ssl.ApplicationProtocolConfig;
import io.netty.handler.ssl.ApplicationProtocolNames; import io.netty.handler.ssl.ApplicationProtocolNames;
import io.netty.handler.ssl.CipherSuiteFilter; import io.netty.handler.ssl.CipherSuiteFilter;
import io.netty.handler.ssl.OpenSsl;
import io.netty.handler.ssl.SslContext; import io.netty.handler.ssl.SslContext;
import io.netty.handler.ssl.SslContextBuilder; import io.netty.handler.ssl.SslContextBuilder;
import io.netty.handler.ssl.SslHandler; import io.netty.handler.ssl.SslHandler;
@ -216,18 +215,6 @@ public final class Client implements AutoCloseable {
return pool != null && !clientConfig.getPoolNodes().isEmpty(); return pool != null && !clientConfig.getPoolNodes().isEmpty();
} }
public void logDiagnostics(Level level) {
logger.log(level, () -> "JDK ciphers: " + SecurityUtil.Defaults.JDK_CIPHERS);
logger.log(level, () -> "OpenSSL ciphers: " + SecurityUtil.Defaults.OPENSSL_CIPHERS);
logger.log(level, () -> "OpenSSL available: " + OpenSsl.isAvailable());
logger.log(level, () -> "Candidate ciphers on client: " + clientConfig.getCiphers());
logger.log(level, () -> "Local host name: " + NetworkUtils.getLocalHostName("localhost"));
logger.log(level, () -> "Event loop group: " + eventLoopGroup + " threads=" + clientConfig.getThreadCount());
logger.log(level, () -> "Socket: " + socketChannelClass.getName());
logger.log(level, () -> "Allocator: " + byteBufAllocator.getClass().getName());
logger.log(level, NetworkUtils::displayNetworkInterfaces);
}
public AtomicLong getRequestCounter() { public AtomicLong getRequestCounter() {
return requestCounter; return requestCounter;
} }

View file

@ -5,8 +5,11 @@ module org.xbib.netty.http.common {
exports org.xbib.netty.http.common.mime; exports org.xbib.netty.http.common.mime;
exports org.xbib.netty.http.common.security; exports org.xbib.netty.http.common.security;
exports org.xbib.netty.http.common.util; exports org.xbib.netty.http.common.util;
requires transitive org.xbib.net.url;
requires io.netty.buffer;
requires io.netty.common;
requires io.netty.transport; requires io.netty.transport;
requires io.netty.handler; requires io.netty.handler;
requires org.xbib.net.url; requires io.netty.codec.http;
requires java.logging; requires java.logging;
} }

View file

@ -3,6 +3,6 @@ dependencies {
implementation "io.netty:netty-codec-http:${project.property('netty.version')}" implementation "io.netty:netty-codec-http:${project.property('netty.version')}"
implementation "io.netty:netty-transport-native-epoll:${project.property('netty.version')}" implementation "io.netty:netty-transport-native-epoll:${project.property('netty.version')}"
testImplementation "org.mockito:mockito-core:${project.property('mockito.version')}" testImplementation "org.mockito:mockito-core:${project.property('mockito.version')}"
testImplementation "org.junit.vintage:junit-vintage-engine:${project.property('junit.version')}" testRuntimeOnly "org.junit.vintage:junit-vintage-engine:${project.property('junit.version')}"
testImplementation "junit:junit:${project.property('junit4.version')}" testImplementation "junit:junit:${project.property('junit4.version')}"
} }

View file

@ -100,6 +100,7 @@ public class CollectBytes implements Transformer<ByteBuf, ByteBuf> {
.cast(ByteBuf.class); .cast(ByteBuf.class);
} }
@SuppressWarnings("serial")
public static class TooMuchDataException extends RuntimeException { public static class TooMuchDataException extends RuntimeException {
public TooMuchDataException(String message) { public TooMuchDataException(String message) {
super(message); super(message);

View file

@ -313,7 +313,7 @@ public class HttpClientRequestImplTest {
} }
@Test(timeout = 60000) @Test(timeout = 60000)
public void testSetDateHeader() throws Exception { public void testSetDateHeader() {
String headerName = "date"; String headerName = "date";
Date date1 = new Date(); Date date1 = new Date();
@ -754,7 +754,7 @@ public class HttpClientRequestImplTest {
public void assertHeaderAdded(HttpClientRequestImpl<Object, ByteBuf> newReq, String headerName, public void assertHeaderAdded(HttpClientRequestImpl<Object, ByteBuf> newReq, String headerName,
Date... dates) { Date... dates) {
SimpleDateFormat sdf = new SimpleDateFormat("E, d MMM yyyy HH:mm:ss z", Locale.ENGLISH); SimpleDateFormat sdf = new SimpleDateFormat("E, dd MMM yyyy HH:mm:ss z", Locale.US);
sdf.setTimeZone(TimeZone.getTimeZone("GMT")); sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
String[] expectedValues = new String[dates.length]; String[] expectedValues = new String[dates.length];

View file

@ -1,8 +1,8 @@
module org.xbib.netty.http.server.api { module org.xbib.netty.http.server.api {
exports org.xbib.netty.http.server.api; exports org.xbib.netty.http.server.api;
exports org.xbib.netty.http.server.api.annotation; exports org.xbib.netty.http.server.api.annotation;
requires transitive org.xbib.netty.http.common;
requires org.xbib.net.url; requires org.xbib.net.url;
requires org.xbib.netty.http.common;
requires io.netty.buffer; requires io.netty.buffer;
requires io.netty.common; requires io.netty.common;
requires io.netty.handler; requires io.netty.handler;

View file

@ -9,14 +9,14 @@ module org.xbib.netty.http.server {
exports org.xbib.netty.http.server.handler.stream; exports org.xbib.netty.http.server.handler.stream;
exports org.xbib.netty.http.server.transport; exports org.xbib.netty.http.server.transport;
exports org.xbib.netty.http.server.util; exports org.xbib.netty.http.server.util;
requires org.xbib.netty.http.server.api; requires transitive org.xbib.netty.http.server.api;
requires org.xbib.netty.http.common;
requires org.xbib.net.url; requires org.xbib.net.url;
requires io.netty.buffer; requires io.netty.buffer;
requires io.netty.common; requires io.netty.common;
requires io.netty.handler; requires io.netty.handler;
requires io.netty.transport; requires io.netty.transport;
requires io.netty.codec.http; requires io.netty.codec.http;
requires io.netty.codec.http2;
requires java.logging; requires java.logging;
provides org.xbib.netty.http.server.api.ProtocolProvider with provides org.xbib.netty.http.server.api.ProtocolProvider with
org.xbib.netty.http.server.Http1Provider, org.xbib.netty.http.server.Http1Provider,

View file

@ -11,10 +11,9 @@ import io.netty.channel.socket.ServerSocketChannel;
import io.netty.channel.socket.nio.NioServerSocketChannel; import io.netty.channel.socket.nio.NioServerSocketChannel;
import io.netty.handler.codec.http.HttpVersion; import io.netty.handler.codec.http.HttpVersion;
import io.netty.handler.logging.LoggingHandler; import io.netty.handler.logging.LoggingHandler;
import io.netty.handler.ssl.OpenSsl;
import io.netty.handler.ssl.SslContext; import io.netty.handler.ssl.SslContext;
import io.netty.util.DomainNameMapping; import io.netty.util.DomainWildcardMappingBuilder;
import io.netty.util.DomainNameMappingBuilder; import io.netty.util.Mapping;
import org.xbib.netty.http.common.HttpAddress; import org.xbib.netty.http.common.HttpAddress;
import org.xbib.netty.http.common.NetworkUtils; import org.xbib.netty.http.common.NetworkUtils;
import org.xbib.netty.http.common.TransportProvider; import org.xbib.netty.http.common.TransportProvider;
@ -140,10 +139,10 @@ public final class Server implements AutoCloseable {
if (serverConfig.getDefaultDomain() == null) { if (serverConfig.getDefaultDomain() == null) {
throw new IllegalStateException("no default named server (with name '*') configured, unable to continue"); throw new IllegalStateException("no default named server (with name '*') configured, unable to continue");
} }
DomainNameMapping<SslContext> domainNameMapping = null; Mapping<String, SslContext> domainNameMapping = null;
if (serverConfig.getAddress().isSecure() && serverConfig.getDefaultDomain().getSslContext() != null) { if (serverConfig.getAddress().isSecure() && serverConfig.getDefaultDomain().getSslContext() != null) {
DomainNameMappingBuilder<SslContext> mappingBuilder = DomainWildcardMappingBuilder<SslContext> mappingBuilder =
new DomainNameMappingBuilder<>(serverConfig.getDefaultDomain().getSslContext()); new DomainWildcardMappingBuilder<>(serverConfig.getDefaultDomain().getSslContext());
for (Domain domain : serverConfig.getDomains()) { for (Domain domain : serverConfig.getDomains()) {
String name = domain.getName(); String name = domain.getName();
if (!"*".equals(name)) { if (!"*".equals(name)) {
@ -229,20 +228,6 @@ public final class Server implements AutoCloseable {
return executor; return executor;
} }
public void logDiagnostics(Level level) {
logger.log(level, () -> "JDK ciphers: " + SecurityUtil.Defaults.JDK_CIPHERS);
logger.log(level, () -> "OpenSSL ciphers: " + SecurityUtil.Defaults.OPENSSL_CIPHERS);
logger.log(level, () -> "OpenSSL available: " + OpenSsl.isAvailable());
logger.log(level, () -> "Installed ciphers on default server: " +
(serverConfig.getAddress().isSecure() ? serverConfig.getDefaultDomain().getSslContext().cipherSuites() : ""));
logger.log(level, () -> "Local host name: " + NetworkUtils.getLocalHostName("localhost"));
logger.log(level, () -> "Parent event loop group: " + parentEventLoopGroup + " threads=" + serverConfig.getParentThreadCount());
logger.log(level, () -> "Child event loop group: " + childEventLoopGroup + " threads=" +serverConfig.getChildThreadCount());
logger.log(level, () -> "Socket: " + socketChannelClass.getName());
logger.log(level, () -> "Allocator: " + byteBufAllocator.getClass().getName());
logger.log(level, NetworkUtils::displayNetworkInterfaces);
}
public AtomicLong getRequestCounter() { public AtomicLong getRequestCounter() {
return requestCounter; return requestCounter;
} }
@ -306,12 +291,12 @@ public final class Server implements AutoCloseable {
private HttpChannelInitializer findChannelInitializer(int majorVersion, private HttpChannelInitializer findChannelInitializer(int majorVersion,
HttpAddress httpAddress, HttpAddress httpAddress,
DomainNameMapping<SslContext> domainNameMapping) { Mapping<String, SslContext> domainNameMapping) {
for (ProtocolProvider<HttpChannelInitializer, Transport> protocolProvider : protocolProviders) { for (ProtocolProvider<HttpChannelInitializer, Transport> protocolProvider : protocolProviders) {
if (protocolProvider.supportsMajorVersion(majorVersion)) { if (protocolProvider.supportsMajorVersion(majorVersion)) {
try { try {
return protocolProvider.initializerClass() return protocolProvider.initializerClass()
.getConstructor(Server.class, HttpAddress.class, DomainNameMapping.class) .getConstructor(Server.class, HttpAddress.class, Mapping.class)
.newInstance(this, httpAddress, domainNameMapping); .newInstance(this, httpAddress, domainNameMapping);
} catch (InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException e) { } catch (InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
throw new IllegalStateException(); throw new IllegalStateException();

View file

@ -18,7 +18,7 @@ import io.netty.handler.codec.http.HttpVersion;
import io.netty.handler.logging.LogLevel; import io.netty.handler.logging.LogLevel;
import io.netty.handler.ssl.SslContext; import io.netty.handler.ssl.SslContext;
import io.netty.handler.stream.ChunkedWriteHandler; import io.netty.handler.stream.ChunkedWriteHandler;
import io.netty.util.DomainNameMapping; import io.netty.util.Mapping;
import org.xbib.netty.http.common.HttpAddress; import org.xbib.netty.http.common.HttpAddress;
import org.xbib.netty.http.server.Server; import org.xbib.netty.http.server.Server;
import org.xbib.netty.http.server.ServerConfig; import org.xbib.netty.http.server.ServerConfig;
@ -43,11 +43,11 @@ public class Http1ChannelInitializer extends ChannelInitializer<Channel>
private final HttpAddress httpAddress; private final HttpAddress httpAddress;
private final DomainNameMapping<SslContext> domainNameMapping; private final Mapping<String, SslContext> domainNameMapping;
public Http1ChannelInitializer(Server server, public Http1ChannelInitializer(Server server,
HttpAddress httpAddress, HttpAddress httpAddress,
DomainNameMapping<SslContext> domainNameMapping) { Mapping<String, SslContext> domainNameMapping) {
this.server = server; this.server = server;
this.serverConfig = server.getServerConfig(); this.serverConfig = server.getServerConfig();
this.httpAddress = httpAddress; this.httpAddress = httpAddress;

View file

@ -30,7 +30,7 @@ import io.netty.handler.logging.LogLevel;
import io.netty.handler.ssl.SslContext; import io.netty.handler.ssl.SslContext;
import io.netty.handler.stream.ChunkedWriteHandler; import io.netty.handler.stream.ChunkedWriteHandler;
import io.netty.util.AsciiString; import io.netty.util.AsciiString;
import io.netty.util.DomainNameMapping; import io.netty.util.Mapping;
import org.xbib.netty.http.common.HttpAddress; import org.xbib.netty.http.common.HttpAddress;
import org.xbib.netty.http.server.Server; import org.xbib.netty.http.server.Server;
import org.xbib.netty.http.server.ServerConfig; import org.xbib.netty.http.server.ServerConfig;
@ -55,11 +55,11 @@ public class Http2ChannelInitializer extends ChannelInitializer<Channel>
private final HttpAddress httpAddress; private final HttpAddress httpAddress;
private final DomainNameMapping<SslContext> domainNameMapping; private final Mapping<String, SslContext> domainNameMapping;
public Http2ChannelInitializer(Server server, public Http2ChannelInitializer(Server server,
HttpAddress httpAddress, HttpAddress httpAddress,
DomainNameMapping<SslContext> domainNameMapping) { Mapping<String, SslContext> domainNameMapping) {
this.server = server; this.server = server;
this.serverConfig = server.getServerConfig(); this.serverConfig = server.getServerConfig();
this.httpAddress = httpAddress; this.httpAddress = httpAddress;