(tomcat) branch main updated: Disable class path scanning generally for unit tests
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/main by this push: new 3835ab5748 Disable class path scanning generally for unit tests 3835ab5748 is described below commit 3835ab57486d607d36ae8364c3cb6508378db93f Author: Mark Thomas AuthorDate: Mon Dec 4 21:55:45 2023 + Disable class path scanning generally for unit tests --- .../servlet/TestServletRequestParameters.java | 2 +- ...TestServletRequestParametersFormUrlEncoded.java | 2 +- ...stServletRequestParametersMultipartEncoded.java | 2 +- .../TestServletRequestParametersQueryString.java | 2 +- .../servlet/annotation/TestServletSecurity.java| 2 +- .../servlet/http/HttpServletDoHeadBaseTest.java| 2 +- test/jakarta/servlet/http/TestHttpServlet.java | 10 ++-- .../http/TestHttpServletResponseSendError.java | 2 +- .../TestDigestAuthenticatorAlgorithms.java | 2 +- .../catalina/connector/TestClientReadTimeout.java | 2 +- .../catalina/connector/TestCoyoteAdapter.java | 6 +-- .../org/apache/catalina/connector/TestRequest.java | 6 +-- .../apache/catalina/connector/TestResponse.java| 6 +-- .../catalina/core/TestApplicationContext.java | 2 +- .../catalina/core/TestApplicationDispatcher.java | 2 +- .../catalina/core/TestApplicationFilterConfig.java | 2 +- .../catalina/core/TestApplicationHttpRequest.java | 4 +- .../apache/catalina/core/TestAsyncContextImpl.java | 58 ++--- .../core/TestAsyncContextImplDispatch.java | 2 +- .../TestAsyncContextImplListenerOnComplete.java| 2 +- .../core/TestAsyncContextStateChanges.java | 2 +- .../catalina/core/TestNamingContextListener.java | 4 +- .../core/TestPropertiesRoleMappingListener.java| 2 +- .../apache/catalina/core/TestStandardContext.java | 6 +-- .../catalina/core/TestStandardContextAliases.java | 2 +- .../catalina/core/TestStandardContextValve.java| 6 +-- .../catalina/core/TestStandardHostValve.java | 8 +-- .../apache/catalina/core/TestStandardWrapper.java | 6 +-- .../catalina/filters/TestAddCharSetFilter.java | 2 +- .../TestWebappClassLoaderExecutorMemoryLeak.java | 2 +- .../loader/TestWebappClassLoaderMemoryLeak.java| 2 +- ...TestWebappClassLoaderThreadLocalMemoryLeak.java | 4 +- .../catalina/nonblocking/TestNonBlockingAPI.java | 20 .../session/TestPersistentManagerIntegration.java | 6 +-- .../session/TestStandardSessionIntegration.java| 2 +- test/org/apache/catalina/startup/TestListener.java | 4 +- test/org/apache/catalina/startup/TestTomcat.java | 10 ++-- .../catalina/startup/TestTomcatClassLoader.java| 4 +- .../apache/catalina/startup/TomcatBaseTest.java| 10 .../apache/catalina/valves/TestAccessLogValve.java | 2 +- .../catalina/valves/TestErrorReportValve.java | 12 ++--- .../catalina/valves/rewrite/TestRewriteValve.java | 2 +- test/org/apache/coyote/TestResponse.java | 4 +- .../coyote/ajp/TestAbstractAjpProcessor.java | 16 +++--- .../coyote/http11/TestHttp11InputBuffer.java | 2 +- .../coyote/http11/TestHttp11OutputBuffer.java | 4 +- .../apache/coyote/http11/TestHttp11Processor.java | 60 +++--- .../http11/filters/TestChunkedInputFilter.java | 12 ++--- .../apache/coyote/http11/upgrade/TestUpgrade.java | 2 +- .../http11/upgrade/TestUpgradeInternalHandler.java | 2 +- test/org/apache/coyote/http2/Http2TestBase.java| 2 +- test/org/apache/coyote/http2/TestAsync.java| 2 +- test/org/apache/coyote/http2/TestAsyncError.java | 2 +- test/org/apache/coyote/http2/TestAsyncFlush.java | 2 +- test/org/apache/coyote/http2/TestAsyncTimeout.java | 2 +- .../apache/coyote/http2/TestCancelledUpload.java | 2 +- .../coyote/http2/TestHttp2UpgradeHandler.java | 6 +-- test/org/apache/coyote/http2/TestLargeUpload.java | 2 +- test/org/apache/coyote/http2/TestStream.java | 4 +- .../apache/coyote/http2/TestStreamProcessor.java | 6 +-- .../apache/coyote/http2/TestStreamQueryString.java | 2 +- test/org/apache/naming/TestNamingContext.java | 2 +- .../apache/naming/resources/TestNamingContext.java | 10 ++-- .../http/TestCookieProcessorGenerationHttp.java| 2 +- .../tomcat/util/net/TestSSLHostConfigCompat.java | 2 +- test/org/apache/tomcat/util/net/TestSsl.java | 2 +- .../tomcat/websocket/TestConnectionLimit.java | 2 +- .../tomcat/websocket/TestWebSocketFrameClient.java | 4 +- .../websocket/TestWebSocketFrameClientSSL.java | 4 +- .../tomcat/websocket/TestWsPingPongMessages.java | 2 +- .../tomcat/websocket/TestWsRemoteEndpoint.java | 4 +- .../websocket/TestWsSessionSuspendResume.java | 2 +- .../tomcat/websocket/TestWsSubprotocols.java | 2 +-
Buildbot success in on tomcat-11.0.x
Build status: Build succeeded! Worker used: bb_worker2_ubuntu URL: https://ci2.apache.org/#builders/112/builds/779 Blamelist: Mark Thomas Build Text: build successful Status Detected: restored build Build Source Stamp: [branch main] e0665644f519ca7a30993d1e5c8da3719d8ae207 Steps: worker_preparation: 0 git: 0 shell: 0 shell_1: 0 shell_2: 0 shell_3: 0 shell_4: 0 shell_5: 0 shell_6: 0 compile: 1 shell_7: 0 shell_8: 0 shell_9: 0 shell_10: 0 Rsync docs to nightlies.apache.org: 0 shell_11: 0 Rsync RAT to nightlies.apache.org: 0 compile_1: 1 shell_12: 0 Rsync Logs to nightlies.apache.org: 0 -- ASF Buildbot - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
(tomcat) 01/02: Improve test performance
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git commit d81541f4a7f3b19eac7d3196f84c7386979f89a7 Author: Mark Thomas AuthorDate: Mon Dec 4 21:11:37 2023 + Improve test performance --- test/org/apache/catalina/servlets/ServletOptionsBaseTest.java | 4 1 file changed, 4 insertions(+) diff --git a/test/org/apache/catalina/servlets/ServletOptionsBaseTest.java b/test/org/apache/catalina/servlets/ServletOptionsBaseTest.java index f35c42616b..0320270b59 100644 --- a/test/org/apache/catalina/servlets/ServletOptionsBaseTest.java +++ b/test/org/apache/catalina/servlets/ServletOptionsBaseTest.java @@ -33,6 +33,7 @@ import org.apache.catalina.Wrapper; import org.apache.catalina.startup.SimpleHttpClient; import org.apache.catalina.startup.Tomcat; import org.apache.catalina.startup.TomcatBaseTest; +import org.apache.tomcat.util.scan.StandardJarScanner; public abstract class ServletOptionsBaseTest extends TomcatBaseTest { @@ -86,6 +87,9 @@ public abstract class ServletOptionsBaseTest extends TomcatBaseTest { ctx.addServletMappingDecoded("/*", "servlet"); +// Disable class path scanning - it slows the tests down by almost an order of magnitude +((StandardJarScanner) ctx.getJarScanner()).setScanClassPath(false); + tomcat.start(); OptionsHttpClient client = new OptionsHttpClient(); - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
(tomcat) 02/02: Use better context path
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git commit 42bac469571d111389c1338ee9482bff18e73bd3 Author: Mark Thomas AuthorDate: Mon Dec 4 21:12:18 2023 + Use better context path --- test/org/apache/catalina/servlets/ServletOptionsBaseTest.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/org/apache/catalina/servlets/ServletOptionsBaseTest.java b/test/org/apache/catalina/servlets/ServletOptionsBaseTest.java index 0320270b59..d23bbb80ef 100644 --- a/test/org/apache/catalina/servlets/ServletOptionsBaseTest.java +++ b/test/org/apache/catalina/servlets/ServletOptionsBaseTest.java @@ -79,7 +79,7 @@ public abstract class ServletOptionsBaseTest extends TomcatBaseTest { // app dir is relative to server home org.apache.catalina.Context ctx = -tomcat.addWebapp(null, "/servlet", docBase.getAbsolutePath()); +tomcat.addWebapp(null, "/webdav", docBase.getAbsolutePath()); Wrapper w = Tomcat.addServlet(ctx, "servlet", createServlet()); w.addInitParameter("listings", Boolean.toString(listings)); @@ -95,7 +95,7 @@ public abstract class ServletOptionsBaseTest extends TomcatBaseTest { OptionsHttpClient client = new OptionsHttpClient(); client.setPort(getPort()); client.setRequest(new String[] { -"OPTIONS /servlet/" + url + " HTTP/1.1" + CRLF + +"OPTIONS /webdav/" + url + " HTTP/1.1" + CRLF + "Host: localhost:" + getPort() + CRLF + "Connection: close" + CRLF + CRLF }); @@ -110,7 +110,7 @@ public abstract class ServletOptionsBaseTest extends TomcatBaseTest { client.reset(); client.setRequest(new String[] { -method + " /servlet/" + url + " HTTP/1.1" + CRLF + +method + " /webdav/" + url + " HTTP/1.1" + CRLF + "Host: localhost:" + getPort() + CRLF + "Connection: close" + CRLF + CRLF }); - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
(tomcat) branch main updated (1bea43b3a3 -> 42bac46957)
This is an automated email from the ASF dual-hosted git repository. markt pushed a change to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git from 1bea43b3a3 Fix IDE warnings new d81541f4a7 Improve test performance new 42bac46957 Use better context path The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: test/org/apache/catalina/servlets/ServletOptionsBaseTest.java | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
(tomcat) branch main updated: Fix IDE warnings
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/main by this push: new 1bea43b3a3 Fix IDE warnings 1bea43b3a3 is described below commit 1bea43b3a3402e859e859debf4f632f8b220eae9 Author: Mark Thomas AuthorDate: Mon Dec 4 21:01:59 2023 + Fix IDE warnings --- java/org/apache/tomcat/util/net/openssl/panama/OpenSSLLibrary.java | 4 +--- java/org/apache/tomcat/util/openssl/openssl_h.java | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/java/org/apache/tomcat/util/net/openssl/panama/OpenSSLLibrary.java b/java/org/apache/tomcat/util/net/openssl/panama/OpenSSLLibrary.java index 418af902ff..d184189074 100644 --- a/java/org/apache/tomcat/util/net/openssl/panama/OpenSSLLibrary.java +++ b/java/org/apache/tomcat/util/net/openssl/panama/OpenSSLLibrary.java @@ -81,7 +81,6 @@ public class OpenSSLLibrary { if (OpenSSLStatus.isLibraryInitialized()) { return; } -@SuppressWarnings("deprecation") long initParam = (OpenSSL_version_num() >= 0x300fL) ? 0 : OPENSSL_INIT_ENGINE_ALL_BUILTIN(); OPENSSL_init_ssl(initParam, MemorySegment.NULL); OpenSSLStatus.setLibraryInitialized(true); @@ -160,7 +159,6 @@ public class OpenSSLLibrary { } } -@SuppressWarnings("deprecation") public static void init() { synchronized (lock) { @@ -329,7 +327,7 @@ public class OpenSSLLibrary { } } -@SuppressWarnings("deprecation") + public static void destroy() { synchronized (lock) { if (!OpenSSLStatus.isInitialized()) { diff --git a/java/org/apache/tomcat/util/openssl/openssl_h.java b/java/org/apache/tomcat/util/openssl/openssl_h.java index c95387a545..cec6621950 100644 --- a/java/org/apache/tomcat/util/openssl/openssl_h.java +++ b/java/org/apache/tomcat/util/openssl/openssl_h.java @@ -5122,7 +5122,7 @@ public class openssl_h { throw new AssertionError("should not reach here", ex$); } } -private static final MemorySegment OPENSSL_FILE = Arena.ofAuto().allocateFrom("/tmp/jextract$17086606898854816972.h");; +private static final MemorySegment OPENSSL_FILE = Arena.ofAuto().allocateFrom("/tmp/jextract$17086606898854816972.h"); /** * {@snippet lang=c : @@ -5182,7 +5182,7 @@ public class openssl_h { public static int EVP_PKEY_DSA() { return EVP_PKEY_DSA; } -private static final MemorySegment PEM_STRING_ECPARAMETERS = Arena.ofAuto().allocateFrom("EC PARAMETERS");; +private static final MemorySegment PEM_STRING_ECPARAMETERS = Arena.ofAuto().allocateFrom("EC PARAMETERS"); /** * {@snippet lang=c : - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: (tomcat) branch main updated: Update jextract
On Mon, Dec 4, 2023 at 4:51 PM wrote: > > This is an automated email from the ASF dual-hosted git repository. > > remm pushed a commit to branch main > in repository https://gitbox.apache.org/repos/asf/tomcat.git > > > The following commit(s) were added to refs/heads/main by this push: > new e5dd8a9301 Update jextract > e5dd8a9301 is described below > > commit e5dd8a9301f16ec9a90e19823013ff089db121a4 > Author: remm > AuthorDate: Mon Dec 4 16:50:29 2023 +0100 > > Update jextract > > Modernize the compat and macros. Since the API is now "done", they are focusing on improving the tooling. I will track these changes. Rémy - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: (tomcat) branch main updated: Refactor long running tests to improve parallelism
On Mon, Dec 4, 2023 at 9:37 PM Mark Thomas wrote: > > On 04/12/2023 19:06, ma...@apache.org wrote: > > This is an automated email from the ASF dual-hosted git repository. > > > > markt pushed a commit to branch main > > in repository https://gitbox.apache.org/repos/asf/tomcat.git > > > > > > The following commit(s) were added to refs/heads/main by this push: > > new c766eefed9 Refactor long running tests to improve parallelism > > c766eefed9 is described below > > > > commit c766eefed99cb7004f29468d1e5546eef2a5eae8 > > Author: Mark Thomas > > AuthorDate: Mon Dec 4 19:06:26 2023 + > > > > Refactor long running tests to improve parallelism > > This didn't work as I hoped. The tests weren't CPU bound and this change > actually made things worse. > > I've done some work with a profiler and I have a better plan for these > tests. > > I'll be reverting this change and implementing an alternative. Nice try. I thought it would do something for CI since well, lots of slow threads there usually. Rémy - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
(tomcat) branch main updated: Revert "Refactor long running tests to improve parallelism"
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/main by this push: new e0665644f5 Revert "Refactor long running tests to improve parallelism" e0665644f5 is described below commit e0665644f519ca7a30993d1e5c8da3719d8ae207 Author: Mark Thomas AuthorDate: Mon Dec 4 20:37:52 2023 + Revert "Refactor long running tests to improve parallelism" This reverts commit c766eefed99cb7004f29468d1e5546eef2a5eae8. --- ...aseTest.java => TestDefaultServletOptions.java} | 17 +++--- .../servlets/TestDefaultServletOptionsDELETE.java | 34 --- .../servlets/TestDefaultServletOptionsGET.java | 34 --- .../servlets/TestDefaultServletOptionsHEAD.java| 34 --- .../servlets/TestDefaultServletOptionsPOST.java| 34 --- .../servlets/TestDefaultServletOptionsPUT.java | 34 --- .../servlets/TestDefaultServletOptionsTRACE.java | 34 --- ...java => TestWebdavServletOptionCollection.java} | 19 --- .../TestWebdavServletOptionCollectionCOPY.java | 38 -- .../TestWebdavServletOptionCollectionDELETE.java | 38 -- .../TestWebdavServletOptionCollectionGET.java | 38 -- .../TestWebdavServletOptionCollectionHEAD.java | 38 -- .../TestWebdavServletOptionCollectionLOCK.java | 38 -- .../TestWebdavServletOptionCollectionMKCOL.java| 38 -- .../TestWebdavServletOptionCollectionMOVE.java | 38 -- .../TestWebdavServletOptionCollectionPOST.java | 38 -- .../TestWebdavServletOptionCollectionPROPFIND.java | 38 -- ...TestWebdavServletOptionCollectionPROPPATCH.java | 38 -- .../TestWebdavServletOptionCollectionPUT.java | 38 -- .../TestWebdavServletOptionCollectionTRACE.java| 38 -- .../TestWebdavServletOptionCollectionUNLOCK.java | 38 -- ...tion.java => TestWebdavServletOptionsFile.java} | 19 --- .../servlets/TestWebdavServletOptionsFileCOPY.java | 38 -- .../TestWebdavServletOptionsFileDELETE.java| 38 -- .../servlets/TestWebdavServletOptionsFileGET.java | 38 -- .../servlets/TestWebdavServletOptionsFileHEAD.java | 38 -- .../servlets/TestWebdavServletOptionsFileLOCK.java | 38 -- .../TestWebdavServletOptionsFileMKCOL.java | 38 -- .../servlets/TestWebdavServletOptionsFileMOVE.java | 38 -- .../servlets/TestWebdavServletOptionsFilePOST.java | 38 -- .../TestWebdavServletOptionsFilePROPFIND.java | 38 -- .../TestWebdavServletOptionsFilePROPPATCH.java | 38 -- .../servlets/TestWebdavServletOptionsFilePUT.java | 38 -- .../TestWebdavServletOptionsFileTRACE.java | 38 -- .../TestWebdavServletOptionsFileUNLOCK.java| 38 -- ...e.java => TestWebdavServletOptionsUnknown.java} | 19 --- .../TestWebdavServletOptionsUnknownCOPY.java | 38 -- .../TestWebdavServletOptionsUnknownDELETE.java | 38 -- .../TestWebdavServletOptionsUnknownGET.java| 38 -- .../TestWebdavServletOptionsUnknownHEAD.java | 38 -- .../TestWebdavServletOptionsUnknownLOCK.java | 38 -- .../TestWebdavServletOptionsUnknownMKCOL.java | 38 -- .../TestWebdavServletOptionsUnknownMOVE.java | 38 -- .../TestWebdavServletOptionsUnknownPOST.java | 38 -- .../TestWebdavServletOptionsUnknownPROPFIND.java | 38 -- .../TestWebdavServletOptionsUnknownPROPPATCH.java | 38 -- .../TestWebdavServletOptionsUnknownPUT.java| 38 -- .../TestWebdavServletOptionsUnknownTRACE.java | 38 -- .../TestWebdavServletOptionsUnknownUNLOCK.java | 38 -- 49 files changed, 54 insertions(+), 1706 deletions(-) diff --git a/test/org/apache/catalina/servlets/DefaultServletOptionsBaseTest.java b/test/org/apache/catalina/servlets/TestDefaultServletOptions.java similarity index 70% rename from test/org/apache/catalina/servlets/DefaultServletOptionsBaseTest.java rename to test/org/apache/catalina/servlets/TestDefaultServletOptions.java index e5a92d97dc..b5fe61aaa9 100644 --- a/test/org/apache/catalina/servlets/DefaultServletOptionsBaseTest.java +++
Re: (tomcat) branch main updated: Refactor long running tests to improve parallelism
On 04/12/2023 19:06, ma...@apache.org wrote: This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/main by this push: new c766eefed9 Refactor long running tests to improve parallelism c766eefed9 is described below commit c766eefed99cb7004f29468d1e5546eef2a5eae8 Author: Mark Thomas AuthorDate: Mon Dec 4 19:06:26 2023 + Refactor long running tests to improve parallelism This didn't work as I hoped. The tests weren't CPU bound and this change actually made things worse. I've done some work with a profiler and I have a better plan for these tests. I'll be reverting this change and implementing an alternative. Mark - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Buildbot failure in on tomcat-11.0.x
Build status: BUILD FAILED: failed Snapshot deployed to ASF Maven snapshot repository (failure) Worker used: bb_worker2_ubuntu URL: https://ci2.apache.org/#builders/112/builds/778 Blamelist: Mark Thomas Build Text: failed Snapshot deployed to ASF Maven snapshot repository (failure) Status Detected: new failure Build Source Stamp: [branch main] c766eefed99cb7004f29468d1e5546eef2a5eae8 Steps: worker_preparation: 0 git: 0 shell: 0 shell_1: 0 shell_2: 0 shell_3: 0 shell_4: 0 shell_5: 0 shell_6: 0 compile: 1 shell_7: 0 shell_8: 0 shell_9: 2 -- ASF Buildbot - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
(tomcat) branch main updated: Refactor long running tests to improve parallelism
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/main by this push: new c766eefed9 Refactor long running tests to improve parallelism c766eefed9 is described below commit c766eefed99cb7004f29468d1e5546eef2a5eae8 Author: Mark Thomas AuthorDate: Mon Dec 4 19:06:26 2023 + Refactor long running tests to improve parallelism --- ...ons.java => DefaultServletOptionsBaseTest.java} | 17 --- ...s.java => TestDefaultServletOptionsDELETE.java} | 34 +++--- ...ions.java => TestDefaultServletOptionsGET.java} | 34 +++--- ...ons.java => TestDefaultServletOptionsHEAD.java} | 34 +++--- ...ons.java => TestDefaultServletOptionsPOST.java} | 34 +++--- ...ions.java => TestDefaultServletOptionsPUT.java} | 34 +++--- ...ns.java => TestDefaultServletOptionsTRACE.java} | 34 +++--- ... => TestWebdavServletOptionCollectionCOPY.java} | 32 +++- ...> TestWebdavServletOptionCollectionDELETE.java} | 32 +++- ...a => TestWebdavServletOptionCollectionGET.java} | 32 +++- ... => TestWebdavServletOptionCollectionHEAD.java} | 32 +++- ... => TestWebdavServletOptionCollectionLOCK.java} | 32 +++- ...=> TestWebdavServletOptionCollectionMKCOL.java} | 32 +++- ... => TestWebdavServletOptionCollectionMOVE.java} | 32 +++- ... => TestWebdavServletOptionCollectionPOST.java} | 32 +++- ...TestWebdavServletOptionCollectionPROPFIND.java} | 32 +++- ...estWebdavServletOptionCollectionPROPPATCH.java} | 32 +++- ...a => TestWebdavServletOptionCollectionPUT.java} | 32 +++- ...=> TestWebdavServletOptionCollectionTRACE.java} | 32 +++- ...> TestWebdavServletOptionCollectionUNLOCK.java} | 32 +++- java => TestWebdavServletOptionsFileCOPY.java} | 32 +++- ...ava => TestWebdavServletOptionsFileDELETE.java} | 32 +++- ...e.java => TestWebdavServletOptionsFileGET.java} | 32 +++- java => TestWebdavServletOptionsFileHEAD.java} | 32 +++- java => TestWebdavServletOptionsFileLOCK.java} | 32 +++- ...java => TestWebdavServletOptionsFileMKCOL.java} | 32 +++- java => TestWebdavServletOptionsFileMOVE.java} | 32 +++- java => TestWebdavServletOptionsFilePOST.java} | 32 +++- ...a => TestWebdavServletOptionsFilePROPFIND.java} | 32 +++- ... => TestWebdavServletOptionsFilePROPPATCH.java} | 32 +++- ...e.java => TestWebdavServletOptionsFilePUT.java} | 32 +++- ...java => TestWebdavServletOptionsFileTRACE.java} | 32 +++- ...ava => TestWebdavServletOptionsFileUNLOCK.java} | 32 +++- ...va => TestWebdavServletOptionsUnknownCOPY.java} | 32 +++- ... => TestWebdavServletOptionsUnknownDELETE.java} | 32 +++- ...ava => TestWebdavServletOptionsUnknownGET.java} | 32 +++- ...va => TestWebdavServletOptionsUnknownHEAD.java} | 32 +++- ...va => TestWebdavServletOptionsUnknownLOCK.java} | 32 +++- ...a => TestWebdavServletOptionsUnknownMKCOL.java} | 32 +++- ...va => TestWebdavServletOptionsUnknownMOVE.java} | 32 +++- ...va => TestWebdavServletOptionsUnknownPOST.java} | 32 +++- ...> TestWebdavServletOptionsUnknownPROPFIND.java} | 32 +++- ... TestWebdavServletOptionsUnknownPROPPATCH.java} | 32 +++- ...ava => TestWebdavServletOptionsUnknownPUT.java} | 32 +++- ...a => TestWebdavServletOptionsUnknownTRACE.java} | 32 +++- ... => TestWebdavServletOptionsUnknownUNLOCK.java} | 32 +++- ... => WebdavServletOptionBaseTestCollection.java} | 19 java => WebdavServletOptionsBaseTestFile.java} | 19 ...va => WebdavServletOptionsBaseTestUnknown.java} | 19 49 files changed, 200 insertions(+), 1326 deletions(-) diff --git a/test/org/apache/catalina/servlets/TestDefaultServletOptions.java b/test/org/apache/catalina/servlets/DefaultServletOptionsBaseTest.java similarity index 70% copy from test/org/apache/catalina/servlets/TestDefaultServletOptions.java copy to test/org/apache/catalina/servlets/DefaultServletOptionsBaseTest.java index b5fe61aaa9..e5a92d97dc 100644 --- a/test/org/apache/catalina/servlets/TestDefaultServletOptions.java +++ b/test/org/apache/catalina/servlets/DefaultServletOptionsBaseTest.java @@ -22,17 +22,13 @@ import java.util.List; import jakarta.servlet.Servlet; -import org.junit.runner.RunWith; -import
Re: [PR] PDS-4683 upgrade tomcat for security reasons [tomcat-maven-plugin]
glendagonzales closed pull request #42: PDS-4683 upgrade tomcat for security reasons URL: https://github.com/apache/tomcat-maven-plugin/pull/42 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
(tomcat) branch main updated: Split test into three - helps when test machines have many cores
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/main by this push: new 51881d4aff Split test into three - helps when test machines have many cores 51881d4aff is described below commit 51881d4affe71d876f8a68932dbc03eb29ed614e Author: Mark Thomas AuthorDate: Mon Dec 4 15:22:19 2023 + Split test into three - helps when test machines have many cores --- ...henticator.java => TestFormAuthenticatorA.java} | 80 +- ...henticator.java => TestFormAuthenticatorB.java} | 275 + ...henticator.java => TestFormAuthenticatorC.java} | 269 +--- 3 files changed, 5 insertions(+), 619 deletions(-) diff --git a/test/org/apache/catalina/authenticator/TestFormAuthenticator.java b/test/org/apache/catalina/authenticator/TestFormAuthenticatorA.java similarity index 91% copy from test/org/apache/catalina/authenticator/TestFormAuthenticator.java copy to test/org/apache/catalina/authenticator/TestFormAuthenticatorA.java index 8d094a7ed8..2671b3e1cb 100644 --- a/test/org/apache/catalina/authenticator/TestFormAuthenticator.java +++ b/test/org/apache/catalina/authenticator/TestFormAuthenticatorA.java @@ -72,7 +72,7 @@ import org.apache.tomcat.websocket.server.WsContextListener; * but it makes no claims to generality). * */ -public class TestFormAuthenticator extends TomcatBaseTest { +public class TestFormAuthenticatorA extends TomcatBaseTest { // these should really be singletons to be type-safe, // we are in a unit test and don't need to paranoid. @@ -107,31 +107,7 @@ public class TestFormAuthenticator extends TomcatBaseTest { CLIENT_USE_COOKIES, SERVER_USE_COOKIES, SERVER_CHANGE_SESSID); } -@Test -public void testPostNoContinueWithCookies() throws Exception { -doTest("POST", "GET", NO_100_CONTINUE, -CLIENT_USE_COOKIES, SERVER_USE_COOKIES, SERVER_CHANGE_SESSID); -} - -@Test -public void testPostWithContinueAndCookies() throws Exception { -doTest("POST", "GET", USE_100_CONTINUE, - CLIENT_USE_COOKIES, SERVER_USE_COOKIES, SERVER_CHANGE_SESSID); -} -// Bug 49779 -@Test -public void testPostNoContinuePostRedirectWithCookies() throws Exception { -doTest("POST", "POST", NO_100_CONTINUE, -CLIENT_USE_COOKIES, SERVER_USE_COOKIES, SERVER_CHANGE_SESSID); -} - -// Bug 49779 -@Test -public void testPostWithContinuePostRedirectWithCookies() throws Exception { -doTest("POST", "POST", USE_100_CONTINUE, -CLIENT_USE_COOKIES, SERVER_USE_COOKIES, SERVER_CHANGE_SESSID); -} // next, a set of tests where the server Context is configured to never @@ -144,33 +120,7 @@ public class TestFormAuthenticator extends TomcatBaseTest { CLIENT_NO_COOKIES, SERVER_NO_COOKIES, SERVER_CHANGE_SESSID); } -@Test -public void testPostNoContinueNoServerCookies() throws Exception { -doTest("POST", "GET", NO_100_CONTINUE, -CLIENT_USE_COOKIES, SERVER_NO_COOKIES, SERVER_CHANGE_SESSID); -} -@Test -public void testPostWithContinueNoServerCookies() throws Exception { -doTest("POST", "GET", USE_100_CONTINUE, -CLIENT_USE_COOKIES, SERVER_NO_COOKIES, SERVER_CHANGE_SESSID); -} - -// variant of Bug 49779 -@Test -public void testPostNoContinuePostRedirectNoServerCookies() -throws Exception { -doTest("POST", "POST", NO_100_CONTINUE, -CLIENT_USE_COOKIES, SERVER_NO_COOKIES, SERVER_CHANGE_SESSID); -} - -// variant of Bug 49779 -@Test -public void testPostWithContinuePostRedirectNoServerCookies() -throws Exception { -doTest("POST", "POST", USE_100_CONTINUE, -CLIENT_USE_COOKIES, SERVER_NO_COOKIES, SERVER_CHANGE_SESSID); -} // next, a set of tests where the server Context uses cookies, @@ -183,34 +133,6 @@ public class TestFormAuthenticator extends TomcatBaseTest { CLIENT_NO_COOKIES, SERVER_USE_COOKIES, SERVER_CHANGE_SESSID); } -@Test -public void testPostNoContinueNoClientCookies() throws Exception { -doTest("POST", "GET", NO_100_CONTINUE, -CLIENT_NO_COOKIES, SERVER_USE_COOKIES, SERVER_CHANGE_SESSID); -} - -@Test -public void testPostWithContinueNoClientCookies() throws Exception { -doTest("POST", "GET", USE_100_CONTINUE, -CLIENT_NO_COOKIES, SERVER_USE_COOKIES, SERVER_CHANGE_SESSID); -} - -// variant of Bug 49779 -@Test -public void testPostNoContinuePostRedirectNoClientCookies() -throws Exception { -doTest("POST", "POST", NO_100_CONTINUE, -CLIENT_NO_COOKIES, SERVER_USE_COOKIES, SERVER_CHANGE_SESSID); -} - -//
(tomcat) branch main updated: Use standard naming convention for test method
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/main by this push: new a5bcf3d5c8 Use standard naming convention for test method a5bcf3d5c8 is described below commit a5bcf3d5c85ca540f78d683c8fdf647251877021 Author: Mark Thomas AuthorDate: Mon Dec 4 14:26:47 2023 + Use standard naming convention for test method --- test/org/apache/catalina/authenticator/TestFormAuthenticator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/org/apache/catalina/authenticator/TestFormAuthenticator.java b/test/org/apache/catalina/authenticator/TestFormAuthenticator.java index ed2a2fe4c4..8d094a7ed8 100644 --- a/test/org/apache/catalina/authenticator/TestFormAuthenticator.java +++ b/test/org/apache/catalina/authenticator/TestFormAuthenticator.java @@ -259,7 +259,7 @@ public class TestFormAuthenticator extends TomcatBaseTest { @Test -public void doTestSelectedMethods() throws Exception { +public void testSelectedMethods() throws Exception { FormAuthClientSelectedMethods client = new FormAuthClientSelectedMethods(true, true, true, true); - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
(tomcat) 02/02: Split test into three - helps when test machines have many cores
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git commit 22993ae0b6c5395af9ccb2b3768a3fd178d2a3c7 Author: Mark Thomas AuthorDate: Mon Dec 4 14:14:32 2023 + Split test into three - helps when test machines have many cores --- .../TestHostConfigAutomaticDeploymentA.java| 482 .../TestHostConfigAutomaticDeploymentB.java| 687 + ...ava => TestHostConfigAutomaticDeploymentC.java} | 820 + 3 files changed, 1170 insertions(+), 819 deletions(-) diff --git a/test/org/apache/catalina/startup/TestHostConfigAutomaticDeploymentA.java b/test/org/apache/catalina/startup/TestHostConfigAutomaticDeploymentA.java new file mode 100644 index 00..60f9dd78f5 --- /dev/null +++ b/test/org/apache/catalina/startup/TestHostConfigAutomaticDeploymentA.java @@ -0,0 +1,482 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.catalina.startup; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; + +import org.junit.Assert; +import org.junit.Test; + +import org.apache.catalina.Context; +import org.apache.catalina.Host; +import org.apache.catalina.LifecycleState; +import org.apache.catalina.core.StandardContext; +import org.apache.catalina.core.StandardHost; +import org.apache.catalina.util.ContextName; + +/** + * The purpose of this class is to test the automatic deployment features of the + * {@link HostConfig} implementation. + */ +public class TestHostConfigAutomaticDeploymentA extends TomcatBaseTest { + +private static final ContextName APP_NAME = new ContextName("myapp", false); +private static final File XML_SOURCE = +new File("test/deployment/context.xml"); +private static final File WAR_XML_SOURCE = +new File("test/deployment/context.war"); +private static final File DIR_XML_SOURCE = +new File("test/deployment/dirContext"); +private static final File DIR_SOURCE = +new File("test/deployment/dirNoContext"); + +private static final int XML = 1; +private static final int EXT = 2; +private static final int WAR = 3; +private static final int DIR = 4; + +private static final String XML_COOKIE_NAME = "XML_CONTEXT"; +private static final String WAR_COOKIE_NAME = "WAR_CONTEXT"; +private static final String DIR_COOKIE_NAME = "DIR_CONTEXT"; +// private static final String DEFAULT_COOKIE_NAME = "JSESSIONID"; + +private File external; + +@Override +public void setUp() throws Exception { +super.setUp(); + +Tomcat tomcat = getTomcatInstance(); + +external = new File(getTemporaryDirectory(), "external"); +if (!external.exists() && !external.mkdir()) { +Assert.fail("Unable to create external for test"); +} + +// Disable background thread +tomcat.getEngine().setBackgroundProcessorDelay(-1); + +// Enable deployer +tomcat.getHost().addLifecycleListener(new HostConfig()); + +// Disable deployment on start up +tomcat.getHost().setDeployOnStartup(false); + +// Clean-up after test +addDeleteOnTearDown(new File(tomcat.basedir, "/conf")); +addDeleteOnTearDown(external); +} + + +/* + * Expected behaviour for the deletion of files. + * + * Artifacts present Artifact Artifacts remaining + * XML WAR EXT DIRRemoved XML WAR EXT DIRNotes + * NNNY DIR--- N + * NYNN WAR-N- - + * NYNY DIR-Y- R 1 + * NYNY WAR-N- N + * YNNN XMLN-- - + * YNNY DIRN-- N + * YNNY XMLR-- Y 2 + * YNYN EXTY-N - + * YNYN XMLN-Y - + * YNY
(tomcat) branch main updated (4db15071f7 -> 22993ae0b6)
This is an automated email from the ASF dual-hosted git repository. markt pushed a change to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git from 4db15071f7 Refactor and handle NIO2 which doesn't return a response new ec8f903f01 Differences are clear which a much shorter test new 22993ae0b6 Split test into three - helps when test machines have many cores The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../TestHostConfigAutomaticDeploymentA.java| 482 .../TestHostConfigAutomaticDeploymentB.java| 687 + ...ava => TestHostConfigAutomaticDeploymentC.java} | 820 + test/webapp/bug6/bug64872b-timeunit.jsp| 2 +- 4 files changed, 1171 insertions(+), 820 deletions(-) create mode 100644 test/org/apache/catalina/startup/TestHostConfigAutomaticDeploymentA.java create mode 100644 test/org/apache/catalina/startup/TestHostConfigAutomaticDeploymentB.java rename test/org/apache/catalina/startup/{TestHostConfigAutomaticDeployment.java => TestHostConfigAutomaticDeploymentC.java} (59%) - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
(tomcat) 01/02: Differences are clear which a much shorter test
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git commit ec8f903f019b65bfe3a941a78bd39d09e254573f Author: Mark Thomas AuthorDate: Mon Dec 4 14:01:29 2023 + Differences are clear which a much shorter test --- test/webapp/bug6/bug64872b-timeunit.jsp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/webapp/bug6/bug64872b-timeunit.jsp b/test/webapp/bug6/bug64872b-timeunit.jsp index 679925f836..84256713b1 100644 --- a/test/webapp/bug6/bug64872b-timeunit.jsp +++ b/test/webapp/bug6/bug64872b-timeunit.jsp @@ -19,7 +19,7 @@ Bug 64872b TimeUnit test case <% - for (int i=0; i < 10; i++) { + for (int i=0; i < 5000; i++) { %> 01 The value of foo is [] <% - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[Bug 68228] Status code can no longer be set after a read exception occurs in 9.0.83 or later
https://bz.apache.org/bugzilla/show_bug.cgi?id=68228 Mark Thomas changed: What|Removed |Added Resolution|--- |FIXED Status|NEW |RESOLVED --- Comment #2 from Mark Thomas --- Fixed in: - 11.0.x for 11.0.0-M15 onwards - 10.1.x for 10.1.17 onwards - 9.0.x for 9.0.84 onwards - 8.5.x for 8.5.97 onwards You won't have complete control over the status code but a timeout will now result in a 408 response to the client. -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Buildbot success in on tomcat-11.0.x
Build status: Build succeeded! Worker used: bb_worker2_ubuntu URL: https://ci2.apache.org/#builders/112/builds/775 Blamelist: Mark Thomas Build Text: build successful Status Detected: restored build Build Source Stamp: [branch main] 4db15071f7920f1607c048960cf0ac3a1f50fd18 Steps: worker_preparation: 0 git: 0 shell: 0 shell_1: 0 shell_2: 0 shell_3: 0 shell_4: 0 shell_5: 0 shell_6: 0 compile: 1 shell_7: 0 shell_8: 0 shell_9: 0 shell_10: 0 Rsync docs to nightlies.apache.org: 0 shell_11: 0 Rsync RAT to nightlies.apache.org: 0 compile_1: 1 shell_12: 0 Rsync Logs to nightlies.apache.org: 0 -- ASF Buildbot - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
(tomcat) branch 8.5.x updated: Fix 68228 - return a 408 after a read timeout
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 8.5.x in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/8.5.x by this push: new 12ea1041c1 Fix 68228 - return a 408 after a read timeout 12ea1041c1 is described below commit 12ea1041c1438ba688de04885316957f4a353c94 Author: Mark Thomas AuthorDate: Mon Dec 4 11:06:17 2023 + Fix 68228 - return a 408 after a read timeout This isn't a complete fix as it doesn't allow the user to control the status code after an IOException during read. --- .../org/apache/catalina/connector/InputBuffer.java | 8 +- .../catalina/connector/TestClientReadTimeout.java | 123 + webapps/docs/changelog.xml | 5 + 3 files changed, 135 insertions(+), 1 deletion(-) diff --git a/java/org/apache/catalina/connector/InputBuffer.java b/java/org/apache/catalina/connector/InputBuffer.java index 2df4e027f0..074ed29a01 100644 --- a/java/org/apache/catalina/connector/InputBuffer.java +++ b/java/org/apache/catalina/connector/InputBuffer.java @@ -18,6 +18,7 @@ package org.apache.catalina.connector; import java.io.IOException; import java.io.Reader; +import java.net.SocketTimeoutException; import java.nio.Buffer; import java.nio.ByteBuffer; import java.nio.CharBuffer; @@ -30,6 +31,7 @@ import java.util.concurrent.ConcurrentMap; import javax.servlet.ReadListener; import javax.servlet.RequestDispatcher; +import javax.servlet.http.HttpServletResponse; import org.apache.catalina.security.SecurityUtil; import org.apache.coyote.ActionCode; @@ -337,7 +339,11 @@ public class InputBuffer extends Reader implements ByteChunk.ByteInputChannel, A Request request = (Request) coyoteRequest.getNote(CoyoteAdapter.ADAPTER_NOTES); Response response = request.getResponse(); request.setAttribute(RequestDispatcher.ERROR_EXCEPTION, e); -response.sendError(400); +if (e instanceof SocketTimeoutException) { +response.sendError(HttpServletResponse.SC_REQUEST_TIMEOUT); +} else { +response.sendError(HttpServletResponse.SC_BAD_REQUEST); +} } diff --git a/test/org/apache/catalina/connector/TestClientReadTimeout.java b/test/org/apache/catalina/connector/TestClientReadTimeout.java new file mode 100644 index 00..4b90bff6de --- /dev/null +++ b/test/org/apache/catalina/connector/TestClientReadTimeout.java @@ -0,0 +1,123 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.catalina.connector; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.net.Socket; +import java.nio.charset.StandardCharsets; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.junit.Assert; +import org.junit.Test; + +import org.apache.catalina.Context; +import org.apache.catalina.LifecycleException; +import org.apache.catalina.core.StandardHost; +import org.apache.catalina.startup.Tomcat; +import org.apache.catalina.startup.TomcatBaseTest; + + +public class TestClientReadTimeout extends TomcatBaseTest { + +static Tomcat tomcat; + +@Test +public void testTimeoutGets408() throws IOException, LifecycleException { +// Setup Tomcat instance +Tomcat tomcat = getTomcatInstance(); + +// No file system docBase required +Context ctx = tomcat.addContext("", null); + +((StandardHost) tomcat.getHost()).setErrorReportValveClass(null); + +Tomcat.addServlet(ctx, "TestServlet", new SyncServlet()); +ctx.addServletMappingDecoded("/*", "TestServlet"); + +tomcat.start(); + +try (Socket socket = new Socket("localhost", getPort())) { +String request = "GET /async HTTP/1.1\r\nHost: localhost\r\ncontent-length: 101\r\n\r\n"; + +OutputStream os = socket.getOutputStream(); +os.write(request.getBytes(StandardCharsets.UTF_8)); +
[Bug 68228] Status code can no longer be set after a read exception occurs in 9.0.83 or later
https://bz.apache.org/bugzilla/show_bug.cgi?id=68228 Matafagafo changed: What|Removed |Added CC||matafag...@yahoo.com -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
(tomcat) branch 9.0.x updated: Fix 68228 - return a 408 after a read timeout
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/9.0.x by this push: new 2123c65f74 Fix 68228 - return a 408 after a read timeout 2123c65f74 is described below commit 2123c65f7400f56ac12c10ef2b54517b54dac4bf Author: Mark Thomas AuthorDate: Mon Dec 4 11:06:17 2023 + Fix 68228 - return a 408 after a read timeout This isn't a complete fix as it doesn't allow the user to control the status code after an IOException during read. --- .../org/apache/catalina/connector/InputBuffer.java | 8 +- .../catalina/connector/TestClientReadTimeout.java | 123 + webapps/docs/changelog.xml | 5 + 3 files changed, 135 insertions(+), 1 deletion(-) diff --git a/java/org/apache/catalina/connector/InputBuffer.java b/java/org/apache/catalina/connector/InputBuffer.java index 475d67b4b3..b9f67768a9 100644 --- a/java/org/apache/catalina/connector/InputBuffer.java +++ b/java/org/apache/catalina/connector/InputBuffer.java @@ -18,6 +18,7 @@ package org.apache.catalina.connector; import java.io.IOException; import java.io.Reader; +import java.net.SocketTimeoutException; import java.nio.Buffer; import java.nio.ByteBuffer; import java.nio.CharBuffer; @@ -30,6 +31,7 @@ import java.util.concurrent.ConcurrentHashMap; import javax.servlet.ReadListener; import javax.servlet.RequestDispatcher; +import javax.servlet.http.HttpServletResponse; import org.apache.catalina.security.SecurityUtil; import org.apache.coyote.ActionCode; @@ -329,7 +331,11 @@ public class InputBuffer extends Reader implements ByteChunk.ByteInputChannel, A Request request = (Request) coyoteRequest.getNote(CoyoteAdapter.ADAPTER_NOTES); Response response = request.getResponse(); request.setAttribute(RequestDispatcher.ERROR_EXCEPTION, e); -response.sendError(400); +if (e instanceof SocketTimeoutException) { +response.sendError(HttpServletResponse.SC_REQUEST_TIMEOUT); +} else { +response.sendError(HttpServletResponse.SC_BAD_REQUEST); +} } diff --git a/test/org/apache/catalina/connector/TestClientReadTimeout.java b/test/org/apache/catalina/connector/TestClientReadTimeout.java new file mode 100644 index 00..4b90bff6de --- /dev/null +++ b/test/org/apache/catalina/connector/TestClientReadTimeout.java @@ -0,0 +1,123 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.catalina.connector; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.net.Socket; +import java.nio.charset.StandardCharsets; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.junit.Assert; +import org.junit.Test; + +import org.apache.catalina.Context; +import org.apache.catalina.LifecycleException; +import org.apache.catalina.core.StandardHost; +import org.apache.catalina.startup.Tomcat; +import org.apache.catalina.startup.TomcatBaseTest; + + +public class TestClientReadTimeout extends TomcatBaseTest { + +static Tomcat tomcat; + +@Test +public void testTimeoutGets408() throws IOException, LifecycleException { +// Setup Tomcat instance +Tomcat tomcat = getTomcatInstance(); + +// No file system docBase required +Context ctx = tomcat.addContext("", null); + +((StandardHost) tomcat.getHost()).setErrorReportValveClass(null); + +Tomcat.addServlet(ctx, "TestServlet", new SyncServlet()); +ctx.addServletMappingDecoded("/*", "TestServlet"); + +tomcat.start(); + +try (Socket socket = new Socket("localhost", getPort())) { +String request = "GET /async HTTP/1.1\r\nHost: localhost\r\ncontent-length: 101\r\n\r\n"; + +OutputStream os = socket.getOutputStream(); +os.write(request.getBytes(StandardCharsets.UTF_8)); +
(tomcat) branch 10.1.x updated: Fix 68228 - return a 408 after a read timeout
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 10.1.x in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/10.1.x by this push: new e77176c342 Fix 68228 - return a 408 after a read timeout e77176c342 is described below commit e77176c342d358d819c6c62cb3d65b9d358ccd9b Author: Mark Thomas AuthorDate: Mon Dec 4 11:06:17 2023 + Fix 68228 - return a 408 after a read timeout This isn't a complete fix as it doesn't allow the user to control the status code after an IOException during read. --- .../org/apache/catalina/connector/InputBuffer.java | 8 +- .../catalina/connector/TestClientReadTimeout.java | 123 + webapps/docs/changelog.xml | 5 + 3 files changed, 135 insertions(+), 1 deletion(-) diff --git a/java/org/apache/catalina/connector/InputBuffer.java b/java/org/apache/catalina/connector/InputBuffer.java index 70a3e64da6..03c9586630 100644 --- a/java/org/apache/catalina/connector/InputBuffer.java +++ b/java/org/apache/catalina/connector/InputBuffer.java @@ -18,6 +18,7 @@ package org.apache.catalina.connector; import java.io.IOException; import java.io.Reader; +import java.net.SocketTimeoutException; import java.nio.Buffer; import java.nio.ByteBuffer; import java.nio.CharBuffer; @@ -30,6 +31,7 @@ import java.util.concurrent.ConcurrentHashMap; import jakarta.servlet.ReadListener; import jakarta.servlet.RequestDispatcher; +import jakarta.servlet.http.HttpServletResponse; import org.apache.catalina.security.SecurityUtil; import org.apache.coyote.ActionCode; @@ -329,7 +331,11 @@ public class InputBuffer extends Reader implements ByteChunk.ByteInputChannel, A Request request = (Request) coyoteRequest.getNote(CoyoteAdapter.ADAPTER_NOTES); Response response = request.getResponse(); request.setAttribute(RequestDispatcher.ERROR_EXCEPTION, e); -response.sendError(400); +if (e instanceof SocketTimeoutException) { +response.sendError(HttpServletResponse.SC_REQUEST_TIMEOUT); +} else { +response.sendError(HttpServletResponse.SC_BAD_REQUEST); +} } diff --git a/test/org/apache/catalina/connector/TestClientReadTimeout.java b/test/org/apache/catalina/connector/TestClientReadTimeout.java new file mode 100644 index 00..1219ce1fdf --- /dev/null +++ b/test/org/apache/catalina/connector/TestClientReadTimeout.java @@ -0,0 +1,123 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.catalina.connector; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.net.Socket; +import java.nio.charset.StandardCharsets; + +import jakarta.servlet.ServletException; +import jakarta.servlet.http.HttpServlet; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; + +import org.junit.Assert; +import org.junit.Test; + +import org.apache.catalina.Context; +import org.apache.catalina.LifecycleException; +import org.apache.catalina.core.StandardHost; +import org.apache.catalina.startup.Tomcat; +import org.apache.catalina.startup.TomcatBaseTest; + + +public class TestClientReadTimeout extends TomcatBaseTest { + +static Tomcat tomcat; + +@Test +public void testTimeoutGets408() throws IOException, LifecycleException { +// Setup Tomcat instance +Tomcat tomcat = getTomcatInstance(); + +// No file system docBase required +Context ctx = tomcat.addContext("", null); + +((StandardHost) tomcat.getHost()).setErrorReportValveClass(null); + +Tomcat.addServlet(ctx, "TestServlet", new SyncServlet()); +ctx.addServletMappingDecoded("/*", "TestServlet"); + +tomcat.start(); + +try (Socket socket = new Socket("localhost", getPort())) { +String request = "GET /async HTTP/1.1\r\nHost: localhost\r\ncontent-length: 101\r\n\r\n"; + +OutputStream os = socket.getOutputStream(); +
(tomcat) 02/02: Refactor and handle NIO2 which doesn't return a response
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git commit 4db15071f7920f1607c048960cf0ac3a1f50fd18 Author: Mark Thomas AuthorDate: Mon Dec 4 11:58:53 2023 + Refactor and handle NIO2 which doesn't return a response --- .../catalina/connector/TestClientReadTimeout.java | 73 +++--- 1 file changed, 38 insertions(+), 35 deletions(-) diff --git a/test/org/apache/catalina/connector/TestClientReadTimeout.java b/test/org/apache/catalina/connector/TestClientReadTimeout.java index 59beec0bd3..1219ce1fdf 100644 --- a/test/org/apache/catalina/connector/TestClientReadTimeout.java +++ b/test/org/apache/catalina/connector/TestClientReadTimeout.java @@ -58,47 +58,50 @@ public class TestClientReadTimeout extends TomcatBaseTest { tomcat.start(); -try (Socket s = new Socket("localhost", getPort())) { +try (Socket socket = new Socket("localhost", getPort())) { String request = "GET /async HTTP/1.1\r\nHost: localhost\r\ncontent-length: 101\r\n\r\n"; -sendBadRequest(s, request, 408); -} -} - -private static void sendBadRequest(Socket socket, String request, int expectedStatusCode) throws IOException { -OutputStream os = socket.getOutputStream(); -os.write(request.getBytes(StandardCharsets.UTF_8)); -InputStream is = socket.getInputStream(); -BufferedReader reader = new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8)); -String opening = reader.readLine(); -Assert.assertNotNull("Didn't get back a response", opening); -StringBuilder sb = new StringBuilder(opening); - -try { -Assert.assertTrue("expected status code " + expectedStatusCode + " but got " + opening, -opening.startsWith("HTTP/1.1 " + expectedStatusCode)); -boolean connectionClose = false; -while (reader.ready()) { -String line = reader.readLine(); -if (line == null) { -break; -} -sb.append("\n").append(line); -if ("connection: close".equalsIgnoreCase(line)) { -connectionClose = true; +OutputStream os = socket.getOutputStream(); +os.write(request.getBytes(StandardCharsets.UTF_8)); +InputStream is = socket.getInputStream(); +BufferedReader reader = new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8)); +String opening = reader.readLine(); +if (tomcat.getConnector().getProtocolHandlerClassName().contains("Nio2")) { +Assert.assertNull("NIO2 unexpectedly returned a response", opening); +} else { +Assert.assertNotNull("Didn't get back a response", opening); +StringBuilder sb = new StringBuilder(opening); + +try { +Assert.assertTrue( +"expected status code " + HttpServletResponse.SC_REQUEST_TIMEOUT + " but got " + opening, +opening.startsWith("HTTP/1.1 " + HttpServletResponse.SC_REQUEST_TIMEOUT)); +boolean connectionClose = false; +while (reader.ready()) { +String line = reader.readLine(); +if (line == null) { +break; +} + +sb.append("\n").append(line); +if ("connection: close".equalsIgnoreCase(line)) { +connectionClose = true; +} + +Assert.assertFalse(line.contains("Exception Report")); +Assert.assertFalse(line.contains("Status Report")); +} + +Assert.assertTrue("No 'Connection: close' header seen", connectionClose); +} catch (Throwable t) { +Assert.fail("Response:\n" + sb); +t.printStackTrace(); } - -Assert.assertFalse(line.contains("Exception Report")); -Assert.assertFalse(line.contains("Status Report")); } - -Assert.assertTrue("No 'Connection: close' header seen", connectionClose); -} catch (Throwable t) { -Assert.fail("Response:\n" + sb); -t.printStackTrace(); } } + static final class SyncServlet extends HttpServlet { private static final long serialVersionUID = 1L; @@ -112,7 +115,7 @@ public class TestClientReadTimeout extends TomcatBaseTest { resp.setStatus(200); resp.flushBuffer(); } catch (ClientAbortException e) { -//resp.sendError(408); +// resp.sendError(408);
(tomcat) 01/02: Correct test logic
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git commit bc3e313b6d48987cae4dde690f2d7953d41d7984 Author: Mark Thomas AuthorDate: Mon Dec 4 11:39:21 2023 + Correct test logic --- test/org/apache/catalina/connector/TestClientReadTimeout.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/org/apache/catalina/connector/TestClientReadTimeout.java b/test/org/apache/catalina/connector/TestClientReadTimeout.java index ff535a032e..59beec0bd3 100644 --- a/test/org/apache/catalina/connector/TestClientReadTimeout.java +++ b/test/org/apache/catalina/connector/TestClientReadTimeout.java @@ -70,7 +70,7 @@ public class TestClientReadTimeout extends TomcatBaseTest { InputStream is = socket.getInputStream(); BufferedReader reader = new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8)); String opening = reader.readLine(); -Assert.assertNotNull(opening, "Didn't get back a response"); +Assert.assertNotNull("Didn't get back a response", opening); StringBuilder sb = new StringBuilder(opening); try { - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
(tomcat) branch main updated (b0db3c9d84 -> 4db15071f7)
This is an automated email from the ASF dual-hosted git repository. markt pushed a change to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git from b0db3c9d84 Fix IDE warnings. new bc3e313b6d Correct test logic new 4db15071f7 Refactor and handle NIO2 which doesn't return a response The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../catalina/connector/TestClientReadTimeout.java | 73 +++--- 1 file changed, 38 insertions(+), 35 deletions(-) - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Buildbot failure in on tomcat-11.0.x
Build status: BUILD FAILED: failed compile (failure) Worker used: bb_worker2_ubuntu URL: https://ci2.apache.org/#builders/112/builds/773 Blamelist: Mark Thomas Build Text: failed compile (failure) Status Detected: new failure Build Source Stamp: [branch main] 86af4ebf8a5bff5dd51f6c4dff0fbcac9ed93b20 Steps: worker_preparation: 0 git: 0 shell: 0 shell_1: 0 shell_2: 0 shell_3: 0 shell_4: 0 shell_5: 0 shell_6: 0 compile: 1 shell_7: 0 shell_8: 0 shell_9: 0 shell_10: 0 Rsync docs to nightlies.apache.org: 0 shell_11: 0 Rsync RAT to nightlies.apache.org: 0 compile_1: 2 shell_12: 0 Rsync Logs to nightlies.apache.org: 0 -- ASF Buildbot - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
(tomcat) branch main updated: Fix IDE warnings.
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/main by this push: new b0db3c9d84 Fix IDE warnings. b0db3c9d84 is described below commit b0db3c9d84f36e9abdffcd45fe114698f5d449e4 Author: Mark Thomas AuthorDate: Mon Dec 4 11:35:03 2023 + Fix IDE warnings. Mainly because of the Javadoc warnings but I fixed them all --- java/org/apache/tomcat/util/openssl/RuntimeHelper.java| 4 java/org/apache/tomcat/util/openssl/openssl_h.java| 4 ++-- java/org/apache/tomcat/util/openssl/openssl_h_Macros.java | 1 + 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/java/org/apache/tomcat/util/openssl/RuntimeHelper.java b/java/org/apache/tomcat/util/openssl/RuntimeHelper.java index 701027006a..80cea78fbd 100644 --- a/java/org/apache/tomcat/util/openssl/RuntimeHelper.java +++ b/java/org/apache/tomcat/util/openssl/RuntimeHelper.java @@ -40,12 +40,8 @@ import java.lang.invoke.MethodHandles; final class RuntimeHelper { private static final Linker LINKER = Linker.nativeLinker(); -private static final ClassLoader LOADER = RuntimeHelper.class.getClassLoader(); private static final MethodHandles.Lookup MH_LOOKUP = MethodHandles.lookup(); private static final SymbolLookup SYMBOL_LOOKUP; -private static final SegmentAllocator THROWING_ALLOCATOR = (x, y) -> { -throw new AssertionError("should not reach here"); -}; static final AddressLayout POINTER = ValueLayout.ADDRESS .withTargetLayout(MemoryLayout.sequenceLayout(MAX_VALUE, JAVA_BYTE)); diff --git a/java/org/apache/tomcat/util/openssl/openssl_h.java b/java/org/apache/tomcat/util/openssl/openssl_h.java index 75ed768320..bfd036a118 100644 --- a/java/org/apache/tomcat/util/openssl/openssl_h.java +++ b/java/org/apache/tomcat/util/openssl/openssl_h.java @@ -4808,7 +4808,7 @@ public class openssl_h { throw new AssertionError("should not reach here", ex$); } } -private static final MemorySegment OPENSSL_FILE = RuntimeHelper.CONSTANT_ALLOCATOR.allocateFrom("/tmp/jextract$1835734468149172322.h");; +private static final MemorySegment OPENSSL_FILE = RuntimeHelper.CONSTANT_ALLOCATOR.allocateFrom("/tmp/jextract$1835734468149172322.h"); /** * {@snippet lang=c : @@ -4869,7 +4869,7 @@ public class openssl_h { public static int EVP_PKEY_DSA() { return EVP_PKEY_DSA; } -private static final MemorySegment PEM_STRING_ECPARAMETERS = RuntimeHelper.CONSTANT_ALLOCATOR.allocateFrom("EC PARAMETERS");; +private static final MemorySegment PEM_STRING_ECPARAMETERS = RuntimeHelper.CONSTANT_ALLOCATOR.allocateFrom("EC PARAMETERS"); /** * {@snippet lang=c : diff --git a/java/org/apache/tomcat/util/openssl/openssl_h_Macros.java b/java/org/apache/tomcat/util/openssl/openssl_h_Macros.java index 77ab94133d..3b07c23e1d 100644 --- a/java/org/apache/tomcat/util/openssl/openssl_h_Macros.java +++ b/java/org/apache/tomcat/util/openssl/openssl_h_Macros.java @@ -27,6 +27,7 @@ import static org.apache.tomcat.util.openssl.openssl_h.*; /** * Functional macros not handled by jextract. */ +@SuppressWarnings("javadoc") public class openssl_h_Macros { - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
(tomcat) branch main updated: Fix 68228 - return a 408 after a read timeout
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/main by this push: new 86af4ebf8a Fix 68228 - return a 408 after a read timeout 86af4ebf8a is described below commit 86af4ebf8a5bff5dd51f6c4dff0fbcac9ed93b20 Author: Mark Thomas AuthorDate: Mon Dec 4 11:06:17 2023 + Fix 68228 - return a 408 after a read timeout This isn't a complete fix as it doesn't allow the user to control the status code after an IOException during read. --- .../org/apache/catalina/connector/InputBuffer.java | 8 +- .../catalina/connector/TestClientReadTimeout.java | 120 + webapps/docs/changelog.xml | 5 + 3 files changed, 132 insertions(+), 1 deletion(-) diff --git a/java/org/apache/catalina/connector/InputBuffer.java b/java/org/apache/catalina/connector/InputBuffer.java index a674a7183c..3957ec93c2 100644 --- a/java/org/apache/catalina/connector/InputBuffer.java +++ b/java/org/apache/catalina/connector/InputBuffer.java @@ -18,6 +18,7 @@ package org.apache.catalina.connector; import java.io.IOException; import java.io.Reader; +import java.net.SocketTimeoutException; import java.nio.Buffer; import java.nio.ByteBuffer; import java.nio.CharBuffer; @@ -27,6 +28,7 @@ import java.util.concurrent.ConcurrentHashMap; import jakarta.servlet.ReadListener; import jakarta.servlet.RequestDispatcher; +import jakarta.servlet.http.HttpServletResponse; import org.apache.coyote.ActionCode; import org.apache.coyote.BadRequestException; @@ -313,7 +315,11 @@ public class InputBuffer extends Reader implements ByteChunk.ByteInputChannel, A Request request = (Request) coyoteRequest.getNote(CoyoteAdapter.ADAPTER_NOTES); Response response = request.getResponse(); request.setAttribute(RequestDispatcher.ERROR_EXCEPTION, e); -response.sendError(400); +if (e instanceof SocketTimeoutException) { +response.sendError(HttpServletResponse.SC_REQUEST_TIMEOUT); +} else { +response.sendError(HttpServletResponse.SC_BAD_REQUEST); +} } diff --git a/test/org/apache/catalina/connector/TestClientReadTimeout.java b/test/org/apache/catalina/connector/TestClientReadTimeout.java new file mode 100644 index 00..ff535a032e --- /dev/null +++ b/test/org/apache/catalina/connector/TestClientReadTimeout.java @@ -0,0 +1,120 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.catalina.connector; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.net.Socket; +import java.nio.charset.StandardCharsets; + +import jakarta.servlet.ServletException; +import jakarta.servlet.http.HttpServlet; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; + +import org.junit.Assert; +import org.junit.Test; + +import org.apache.catalina.Context; +import org.apache.catalina.LifecycleException; +import org.apache.catalina.core.StandardHost; +import org.apache.catalina.startup.Tomcat; +import org.apache.catalina.startup.TomcatBaseTest; + + +public class TestClientReadTimeout extends TomcatBaseTest { + +static Tomcat tomcat; + +@Test +public void testTimeoutGets408() throws IOException, LifecycleException { +// Setup Tomcat instance +Tomcat tomcat = getTomcatInstance(); + +// No file system docBase required +Context ctx = tomcat.addContext("", null); + +((StandardHost) tomcat.getHost()).setErrorReportValveClass(null); + +Tomcat.addServlet(ctx, "TestServlet", new SyncServlet()); +ctx.addServletMappingDecoded("/*", "TestServlet"); + +tomcat.start(); + +try (Socket s = new Socket("localhost", getPort())) { +String request = "GET /async HTTP/1.1\r\nHost: localhost\r\ncontent-length: 101\r\n\r\n"; +sendBadRequest(s, request, 408); +} +} + +private static void sendBadRequest(Socket socket,