diff --git a/http-server-netty/src/main/java/io/micronaut/http/server/netty/RoutingInBoundHandler.java b/http-server-netty/src/main/java/io/micronaut/http/server/netty/RoutingInBoundHandler.java index d1d021254d..2b0740fce2 100644 --- a/http-server-netty/src/main/java/io/micronaut/http/server/netty/RoutingInBoundHandler.java +++ b/http-server-netty/src/main/java/io/micronaut/http/server/netty/RoutingInBoundHandler.java @@ -47,7 +47,6 @@ import io.micronaut.http.netty.body.NettyBodyWriter; import io.micronaut.http.netty.body.NettyWriteContext; import io.micronaut.http.netty.stream.JsonSubscriber; -import io.micronaut.http.netty.stream.StreamedHttpRequest; import io.micronaut.http.netty.stream.StreamedHttpResponse; import io.micronaut.http.server.RouteExecutor; import io.micronaut.http.server.binding.RequestArgumentSatisfier; @@ -60,11 +59,9 @@ import io.netty.buffer.Unpooled; import io.netty.channel.ChannelHandler.Sharable; import io.netty.channel.ChannelHandlerContext; -import io.netty.handler.codec.http.DefaultFullHttpRequest; import io.netty.handler.codec.http.DefaultFullHttpResponse; import io.netty.handler.codec.http.DefaultHttpContent; import io.netty.handler.codec.http.DefaultHttpHeaders; -import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.FullHttpResponse; import io.netty.handler.codec.http.HttpContent; import io.netty.handler.codec.http.HttpResponseStatus; @@ -189,28 +186,7 @@ public void handleUnboundError(Throwable cause) { @Override public void accept(ChannelHandlerContext ctx, io.netty.handler.codec.http.HttpRequest request, PipeliningServerHandler.OutboundAccess outboundAccess) { - NettyHttpRequest mnRequest; - try { - mnRequest = new NettyHttpRequest<>(request, ctx, conversionService, serverConfiguration); - } catch (IllegalArgumentException e) { - // invalid URI - NettyHttpRequest errorRequest = new NettyHttpRequest<>( - new DefaultFullHttpRequest(request.protocolVersion(), request.method(), "/", Unpooled.EMPTY_BUFFER), - ctx, - conversionService, - serverConfiguration - ); - outboundAccess.attachment(errorRequest); - try (PropagatedContext.Scope ignore = PropagatedContext.getOrEmpty().plus(new ServerHttpRequestContext(errorRequest)).propagate()) { - new NettyRequestLifecycle(this, outboundAccess).handleException(errorRequest, e.getCause() == null ? e : e.getCause()); - } - if (request instanceof StreamedHttpRequest streamed) { - streamed.closeIfNoSubscriber(); - } else { - ((FullHttpRequest) request).release(); - } - return; - } + NettyHttpRequest mnRequest = new NettyHttpRequest<>(request, ctx, conversionService, serverConfiguration); outboundAccess.attachment(mnRequest); try (PropagatedContext.Scope ignore = PropagatedContext.getOrEmpty().plus(new ServerHttpRequestContext(mnRequest)).propagate()) { new NettyRequestLifecycle(this, outboundAccess).handleNormal(mnRequest);