diff --git a/gradle.properties b/gradle.properties index 9435d7a..4131209 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,11 +1,11 @@ group = org.xbib name = netty-http -version = 4.1.50.2 +version = 4.1.50.3 gradle.wrapper.version = 6.4.1 netty.version = 4.1.50.Final -tcnative.version = 2.0.29.Final -tcnative-legacy-macosx.version = 2.0.26.Final +tcnative.version = 2.0.31.Final +tcnative-legacy-macosx.version = 2.0.31.Final xbib.net.version = 2.1.0 bouncycastle.version = 1.64 reactivestreams.version = 1.0.2 diff --git a/netty-http-server/src/main/java/org/xbib/netty/http/server/endpoint/service/ResourceService.java b/netty-http-server/src/main/java/org/xbib/netty/http/server/endpoint/service/ResourceService.java index b5a3b8f..1a33fe1 100644 --- a/netty-http-server/src/main/java/org/xbib/netty/http/server/endpoint/service/ResourceService.java +++ b/netty-http-server/src/main/java/org/xbib/netty/http/server/endpoint/service/ResourceService.java @@ -55,7 +55,9 @@ public abstract class ResourceService implements Filter { protected abstract int getMaxAgeSeconds(); private void handleCachedResource(ServerRequest serverRequest, ServerResponse serverResponse, Resource resource) { - logger.log(Level.FINE, "resource = " + resource); + if (logger.isLoggable(Level.FINER)) { + logger.log(Level.FINER, "resource = " + resource); + } if (resource.isDirectory()) { if (!resource.getResourcePath().isEmpty() && !resource.getResourcePath().endsWith("/")) { // external redirect to diff --git a/netty-http-server/src/main/java/org/xbib/netty/http/server/handler/http/Http1ChannelInitializer.java b/netty-http-server/src/main/java/org/xbib/netty/http/server/handler/http/Http1ChannelInitializer.java index ae1fcc6..9dcfcc1 100644 --- a/netty-http-server/src/main/java/org/xbib/netty/http/server/handler/http/Http1ChannelInitializer.java +++ b/netty-http-server/src/main/java/org/xbib/netty/http/server/handler/http/Http1ChannelInitializer.java @@ -93,8 +93,8 @@ public class Http1ChannelInitializer extends ChannelInitializer pipeline.addLast("http-server-decompressor", new HttpContentDecompressor()); } - HttpObjectAggregator httpObjectAggregator = new HttpObjectAggregator(serverConfig.getMaxContentLength(), - false); + HttpObjectAggregator httpObjectAggregator = + new HttpObjectAggregator(serverConfig.getMaxContentLength()); httpObjectAggregator.setMaxCumulationBufferComponents(serverConfig.getMaxCompositeBufferComponents()); pipeline.addLast("http-server-aggregator", httpObjectAggregator); pipeline.addLast("http-server-pipelining", new HttpPipeliningHandler(serverConfig.getPipeliningCapacity())); @@ -142,7 +142,7 @@ public class Http1ChannelInitializer extends ChannelInitializer @Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) { - logger.log(Level.WARNING, cause.getMessage(), cause); + logger.log(Level.SEVERE, cause.getMessage(), cause); ctx.writeAndFlush(new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.INTERNAL_SERVER_ERROR, Unpooled.copiedBuffer(cause.getMessage().getBytes(StandardCharsets.UTF_8)))); diff --git a/netty-http-server/src/main/java/org/xbib/netty/http/server/transport/BaseTransport.java b/netty-http-server/src/main/java/org/xbib/netty/http/server/transport/BaseTransport.java index 856be73..106a0e2 100644 --- a/netty-http-server/src/main/java/org/xbib/netty/http/server/transport/BaseTransport.java +++ b/netty-http-server/src/main/java/org/xbib/netty/http/server/transport/BaseTransport.java @@ -6,6 +6,7 @@ import io.netty.handler.codec.http.HttpHeaders; import io.netty.handler.codec.http.HttpResponseStatus; import io.netty.handler.codec.http.HttpVersion; import org.xbib.netty.http.server.Server; +import org.xbib.netty.http.server.ServerConfig; import org.xbib.netty.http.server.api.ServerRequest; import org.xbib.netty.http.server.api.ServerResponse; import org.xbib.netty.http.server.api.ServerTransport; @@ -33,12 +34,15 @@ abstract class BaseTransport implements ServerTransport { * and required special header handling, possibly returning an * appropriate response. * - * @param version the HTTP version of the server + * @param serverConfig the server config * @param serverRequest the request * @param serverResponse the response * @return whether further processing should be performed */ - static boolean acceptRequest(HttpVersion version, ServerRequest serverRequest, ServerResponse serverResponse) { + static boolean acceptRequest(ServerConfig serverConfig, + ServerRequest serverRequest, + ServerResponse serverResponse) { + HttpVersion version = serverConfig.getAddress().getVersion(); HttpHeaders reqHeaders = serverRequest.getHeaders(); if (version.majorVersion() == 1 || version.majorVersion() == 2) { if (!reqHeaders.contains(HttpHeaderNames.HOST)) { diff --git a/netty-http-server/src/main/java/org/xbib/netty/http/server/transport/Http1Transport.java b/netty-http-server/src/main/java/org/xbib/netty/http/server/transport/Http1Transport.java index cecad0b..be948fe 100644 --- a/netty-http-server/src/main/java/org/xbib/netty/http/server/transport/Http1Transport.java +++ b/netty-http-server/src/main/java/org/xbib/netty/http/server/transport/Http1Transport.java @@ -25,7 +25,7 @@ public class Http1Transport extends BaseTransport { serverRequest.setSession(sslHandler.engine().getSession()); } HttpServerResponse serverResponse = new HttpServerResponse(server, serverRequest, ctx); - if (acceptRequest(server.getServerConfig().getAddress().getVersion(), serverRequest, serverResponse)) { + if (acceptRequest(server.getServerConfig(), serverRequest, serverResponse)) { serverRequest.handleParameters(); server.handle(serverRequest, serverResponse); } else { diff --git a/netty-http-server/src/main/java/org/xbib/netty/http/server/transport/Http2Transport.java b/netty-http-server/src/main/java/org/xbib/netty/http/server/transport/Http2Transport.java index 2cca480..70c7bae 100644 --- a/netty-http-server/src/main/java/org/xbib/netty/http/server/transport/Http2Transport.java +++ b/netty-http-server/src/main/java/org/xbib/netty/http/server/transport/Http2Transport.java @@ -27,7 +27,7 @@ public class Http2Transport extends BaseTransport { serverRequest.setRequestId(server.getRequestCounter().incrementAndGet()); serverRequest.setStreamId(fullHttpRequest.headers().getInt(HttpConversionUtil.ExtensionHeaderNames.STREAM_ID.text())); ServerResponse serverResponse = new Http2ServerResponse(server, serverRequest, ctx); - if (acceptRequest(server.getServerConfig().getAddress().getVersion(), serverRequest, serverResponse)) { + if (acceptRequest(server.getServerConfig(), serverRequest, serverResponse)) { serverRequest.handleParameters(); server.handle(serverRequest, serverResponse); } else {