From 4335339d7b6636707a3d6731293aedf99fe88df7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 16 May 2022 09:28:39 +0000 Subject: [PATCH 1/9] Bump maven-bundle-plugin from 5.1.4 to 5.1.6 Bumps maven-bundle-plugin from 5.1.4 to 5.1.6. --- updated-dependencies: - dependency-name: org.apache.felix:maven-bundle-plugin dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 9825141c67a5..d18d835bba04 100644 --- a/pom.xml +++ b/pom.xml @@ -141,7 +141,7 @@ 4.1 3.1.0 3.3.0 - 5.1.4 + 5.1.6 3.2.0 3.1.2 3.10.1 From 64e67d5f78624017550a553677835803cd60625e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 18 May 2022 09:17:52 +0000 Subject: [PATCH 2/9] Bump plexus-utils from 3.4.1 to 3.4.2 Bumps [plexus-utils](https://github.com/codehaus-plexus/plexus-utils) from 3.4.1 to 3.4.2. - [Release notes](https://github.com/codehaus-plexus/plexus-utils/releases) - [Commits](https://github.com/codehaus-plexus/plexus-utils/compare/plexus-utils-3.4.1...plexus-utils-3.4.2) --- updated-dependencies: - dependency-name: org.codehaus.plexus:plexus-utils dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 4349b20a82c7..80e1a9a009ae 100644 --- a/pom.xml +++ b/pom.xml @@ -116,7 +116,7 @@ 1.2.0 1.2.0 2.1.1 - 3.4.1 + 3.4.2 2.0.0-alpha6 2.1.1.RELEASE 1.2.5 From 546c382255f69cbc3b467e6ae87a8d9ccb8bd036 Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Wed, 18 May 2022 15:12:16 -0500 Subject: [PATCH 3/9] Issue #7858 - GzipHandler request.isHandled support (#8013) * Better conditional logic in GzipHandler * Correct test expectations * Use super.handle() where appropriate Signed-off-by: Joakim Erdfelt --- .../server/handler/gzip/GzipHandler.java | 29 ++-- .../servlet/GzipHandlerIsHandledTest.java | 124 ++++++++++++++++++ 2 files changed, 145 insertions(+), 8 deletions(-) create mode 100644 jetty-servlet/src/test/java/org/eclipse/jetty/servlet/GzipHandlerIsHandledTest.java diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/handler/gzip/GzipHandler.java b/jetty-server/src/main/java/org/eclipse/jetty/server/handler/gzip/GzipHandler.java index 65becfe88bd6..e5ccd17d100d 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/handler/gzip/GzipHandler.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/handler/gzip/GzipHandler.java @@ -664,6 +664,12 @@ public void setInflateBufferSize(int size) @Override public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { + if (baseRequest.isHandled()) + { + super.handle(target, baseRequest, request, response); + return; + } + final ServletContext context = baseRequest.getServletContext(); final String path = baseRequest.getPathInContext(); LOG.debug("{} handle {} in {}", this, baseRequest, context); @@ -671,7 +677,7 @@ public void handle(String target, Request baseRequest, HttpServletRequest reques if (!_dispatchers.contains(baseRequest.getDispatcherType())) { LOG.debug("{} excluded by dispatcherType {}", this, baseRequest.getDispatcherType()); - _handler.handle(target, baseRequest, request, response); + super.handle(target, baseRequest, request, response); return; } @@ -688,6 +694,15 @@ public void handle(String target, Request baseRequest, HttpServletRequest reques baseRequest.getHttpInput().addInterceptor(gzipHttpInputInterceptor); } + // From here on out, the response output gzip determination is made + + // Don't attempt to modify the response output if it's already committed. + if (response.isCommitted()) + { + super.handle(target, baseRequest, request, response); + return; + } + // Are we already being gzipped? HttpOutput out = baseRequest.getResponse().getHttpOutput(); HttpOutput.Interceptor interceptor = out.getInterceptor(); @@ -764,7 +779,7 @@ else if (COMMA_GZIP.matcher(field.getValue()).matches()) if (alreadyGzipped) { LOG.debug("{} already intercepting {}", this, request); - _handler.handle(target, baseRequest, request, response); + super.handle(target, baseRequest, request, response); return; } @@ -772,7 +787,7 @@ else if (COMMA_GZIP.matcher(field.getValue()).matches()) if (!_methods.test(baseRequest.getMethod())) { LOG.debug("{} excluded by method {}", this, request); - _handler.handle(target, baseRequest, request, response); + super.handle(target, baseRequest, request, response); return; } @@ -781,7 +796,7 @@ else if (COMMA_GZIP.matcher(field.getValue()).matches()) if (!isPathGzipable(path)) { LOG.debug("{} excluded by path {}", this, request); - _handler.handle(target, baseRequest, request, response); + super.handle(target, baseRequest, request, response); return; } @@ -794,7 +809,7 @@ else if (COMMA_GZIP.matcher(field.getValue()).matches()) { LOG.debug("{} excluded by path suffix mime type {}", this, request); // handle normally without setting vary header - _handler.handle(target, baseRequest, request, response); + super.handle(target, baseRequest, request, response); return; } } @@ -804,9 +819,7 @@ else if (COMMA_GZIP.matcher(field.getValue()).matches()) { // install interceptor and handle out.setInterceptor(new GzipHttpOutputInterceptor(this, getVaryField(), baseRequest.getHttpChannel(), origInterceptor, isSyncFlush())); - - if (_handler != null) - _handler.handle(target, baseRequest, request, response); + super.handle(target, baseRequest, request, response); } finally { diff --git a/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/GzipHandlerIsHandledTest.java b/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/GzipHandlerIsHandledTest.java new file mode 100644 index 000000000000..8bef4367c23f --- /dev/null +++ b/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/GzipHandlerIsHandledTest.java @@ -0,0 +1,124 @@ +// +// ======================================================================== +// Copyright (c) 1995-2022 Mort Bay Consulting Pty Ltd and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 +// which is available at https://www.apache.org/licenses/LICENSE-2.0. +// +// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 +// ======================================================================== +// + +package org.eclipse.jetty.servlet; + +import java.io.IOException; +import java.util.concurrent.LinkedBlockingQueue; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.eclipse.jetty.client.HttpClient; +import org.eclipse.jetty.client.api.ContentResponse; +import org.eclipse.jetty.server.Handler; +import org.eclipse.jetty.server.Request; +import org.eclipse.jetty.server.Server; +import org.eclipse.jetty.server.ServerConnector; +import org.eclipse.jetty.server.handler.AbstractHandler; +import org.eclipse.jetty.server.handler.DefaultHandler; +import org.eclipse.jetty.server.handler.HandlerCollection; +import org.eclipse.jetty.server.handler.ResourceHandler; +import org.eclipse.jetty.server.handler.gzip.GzipHandler; +import org.eclipse.jetty.toolchain.test.jupiter.WorkDir; +import org.eclipse.jetty.util.component.LifeCycle; +import org.eclipse.jetty.util.resource.PathResource; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Test; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.containsString; +import static org.hamcrest.Matchers.is; + +/** + * Tests of behavior of GzipHandler when Request.isHandled() or Response.isCommitted() is true + */ +public class GzipHandlerIsHandledTest +{ + public WorkDir workDir; + + private Server server; + private HttpClient client; + public LinkedBlockingQueue events = new LinkedBlockingQueue<>(); + + public void startServer(Handler rootHandler) throws Exception + { + server = new Server(); + ServerConnector connector = new ServerConnector(server); + connector.setPort(0); + server.addConnector(connector); + + server.setHandler(rootHandler); + server.start(); + + client = new HttpClient(); + client.start(); + } + + @AfterEach + public void tearDown() + { + LifeCycle.stop(client); + LifeCycle.stop(server); + } + + @Test + public void testRequest() throws Exception + { + HandlerCollection handlers = new HandlerCollection(); + + ResourceHandler resourceHandler = new ResourceHandler(); + resourceHandler.setBaseResource(new PathResource(workDir.getPath())); + resourceHandler.setDirectoriesListed(true); + resourceHandler.setHandler(new EventHandler(events, "ResourceHandler")); + + GzipHandler gzipHandler = new GzipHandler(); + gzipHandler.setMinGzipSize(32); + gzipHandler.setHandler(new EventHandler(events, "GzipHandler-wrapped-handler")); + + handlers.setHandlers(new Handler[]{resourceHandler, gzipHandler, new DefaultHandler()}); + + startServer(handlers); + + ContentResponse response = client.GET(server.getURI().resolve("/")); + assertThat("response.status", response.getStatus(), is(200)); + // we should have received a directory listing from the ResourceHandler + assertThat("response.content", response.getContentAsString(), containsString("Directory: /")); + // resource handler should have handled the request + // the gzip handler and default handlers should have been executed, seeing as this is a HandlerCollection + // but the gzip handler should not have acted on the request, as the response is committed + assertThat("One event should have been recorded", events.size(), is(1)); + // the event handler should see the request.isHandled = true + // and response.isCommitted = true as the gzip handler didn't really do anything due to these + // states and let the wrapped handler (the EventHandler in this case) make the call on what it should do. + assertThat("Event indicating that GzipHandler-wrapped-handler ran", events.remove(), is("GzipHandler-wrapped-handler [request.isHandled=true, response.isCommitted=true]")); + } + + private static class EventHandler extends AbstractHandler + { + private final LinkedBlockingQueue events; + private final String action; + + public EventHandler(LinkedBlockingQueue events, String action) + { + this.events = events; + this.action = action; + } + + @Override + public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException + { + events.offer(String.format("%s [request.isHandled=%b, response.isCommitted=%b]", action, baseRequest.isHandled(), response.isCommitted())); + } + } +} From 7c207e91f444b34a998b9e7638372c42e49fbf75 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 20 May 2022 09:24:02 +0000 Subject: [PATCH 4/9] Bump logback-core from 1.3.0-alpha15 to 1.3.0-alpha16 Bumps [logback-core](https://github.com/qos-ch/logback) from 1.3.0-alpha15 to 1.3.0-alpha16. - [Release notes](https://github.com/qos-ch/logback/releases) - [Commits](https://github.com/qos-ch/logback/compare/v_1.3.0-alpha15...v_1.3.0-alpha16) --- updated-dependencies: - dependency-name: ch.qos.logback:logback-core dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 4349b20a82c7..9571593c75c6 100644 --- a/pom.xml +++ b/pom.xml @@ -103,7 +103,7 @@ 5.8.2 2.0.2 2.17.2 - 1.3.0-alpha15 + 1.3.0-alpha16 3.0.4 10.3.6 0.13.1 From 14c0004c040b68fb9c3cb1f0923be029bb7fff31 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 20 May 2022 09:24:32 +0000 Subject: [PATCH 5/9] Bump spotbugs-maven-plugin from 4.6.0.0 to 4.7.0.0 Bumps [spotbugs-maven-plugin](https://github.com/spotbugs/spotbugs-maven-plugin) from 4.6.0.0 to 4.7.0.0. - [Release notes](https://github.com/spotbugs/spotbugs-maven-plugin/releases) - [Commits](https://github.com/spotbugs/spotbugs-maven-plugin/compare/spotbugs-maven-plugin-4.6.0.0...spotbugs-maven-plugin-4.7.0.0) --- updated-dependencies: - dependency-name: com.github.spotbugs:spotbugs-maven-plugin dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 4349b20a82c7..a159b3dfeb24 100644 --- a/pom.xml +++ b/pom.xml @@ -166,7 +166,7 @@ 3.0.0-M5 3.2.1 3.3.2 - 4.6.0.0 + 4.7.0.0 2.10.0 From 66289a54e89df2f54dfaa47be06953113fb7722a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 20 May 2022 09:24:42 +0000 Subject: [PATCH 6/9] Bump testcontainers-bom from 1.17.1 to 1.17.2 Bumps [testcontainers-bom](https://github.com/testcontainers/testcontainers-java) from 1.17.1 to 1.17.2. - [Release notes](https://github.com/testcontainers/testcontainers-java/releases) - [Changelog](https://github.com/testcontainers/testcontainers-java/blob/master/CHANGELOG.md) - [Commits](https://github.com/testcontainers/testcontainers-java/compare/1.17.1...1.17.2) --- updated-dependencies: - dependency-name: org.testcontainers:testcontainers-bom dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 4349b20a82c7..82579360b185 100644 --- a/pom.xml +++ b/pom.xml @@ -121,7 +121,7 @@ 2.1.1.RELEASE 1.2.5 1.2.5 - 1.17.1 + 1.17.2 3.1.9.Final 1.6.0.Final 1.19.0.Final From 279574a07e55a0e2f512aa04600f8b23ea3e57e0 Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Fri, 20 May 2022 21:55:59 +1000 Subject: [PATCH 7/9] make jetty-p2 depending jetty-home so we sure it's build last even when using -Tx option (#8026) see https://github.com/eclipse/jetty.project/issues/8021 Signed-off-by: Olivier Lamy --- jetty-p2/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jetty-p2/pom.xml b/jetty-p2/pom.xml index 2361427106d0..f8bd0a333712 100644 --- a/jetty-p2/pom.xml +++ b/jetty-p2/pom.xml @@ -43,7 +43,7 @@ artifacts are created --> org.eclipse.jetty - jetty-bom + jetty-home ${project.version} pom From ef9d885a057fbf3216f40970130207e6652593c6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 23 May 2022 09:18:49 +0000 Subject: [PATCH 8/9] Bump versions-maven-plugin from 2.10.0 to 2.11.0 Bumps [versions-maven-plugin](https://github.com/mojohaus/versions-maven-plugin) from 2.10.0 to 2.11.0. - [Release notes](https://github.com/mojohaus/versions-maven-plugin/releases) - [Changelog](https://github.com/mojohaus/versions-maven-plugin/blob/master/ReleaseNotes.md) - [Commits](https://github.com/mojohaus/versions-maven-plugin/compare/versions-maven-plugin-2.10.0...versions-maven-plugin-2.11.0) --- updated-dependencies: - dependency-name: org.codehaus.mojo:versions-maven-plugin dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 36fb28932e41..8164efabfcab 100644 --- a/pom.xml +++ b/pom.xml @@ -167,7 +167,7 @@ 3.2.1 3.3.2 4.7.0.0 - 2.10.0 + 2.11.0 false From 513a2cb2562ff5745b3a7e1e538a4b53759ce7ec Mon Sep 17 00:00:00 2001 From: Simone Bordet Date: Mon, 23 May 2022 16:12:24 +0200 Subject: [PATCH 9/9] Fixes #7935 - Review HTTP/2 error handling (#8048) Fixed HTTP/3 in similar way as HTTP/2. Signed-off-by: Simone Bordet --- .../jetty/http3/server/internal/HttpChannelOverHTTP3.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/jetty-http3/http3-server/src/main/java/org/eclipse/jetty/http3/server/internal/HttpChannelOverHTTP3.java b/jetty-http3/http3-server/src/main/java/org/eclipse/jetty/http3/server/internal/HttpChannelOverHTTP3.java index f8759b7fd452..cad2ff628379 100644 --- a/jetty-http3/http3-server/src/main/java/org/eclipse/jetty/http3/server/internal/HttpChannelOverHTTP3.java +++ b/jetty-http3/http3-server/src/main/java/org/eclipse/jetty/http3/server/internal/HttpChannelOverHTTP3.java @@ -161,13 +161,11 @@ public Runnable onRequest(HeadersFrame frame) { if (LOG.isDebugEnabled()) LOG.debug("onRequest() failure", x); - onBadMessage(x); - return null; + return () -> onBadMessage(x); } catch (Throwable x) { - onBadMessage(new BadMessageException(HttpStatus.INTERNAL_SERVER_ERROR_500, null, x)); - return null; + return () -> onBadMessage(new BadMessageException(HttpStatus.INTERNAL_SERVER_ERROR_500, null, x)); } }