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
commit fd625ae87da5f3228e1056ce4b47def5bd2965b4 Author: Mark Thomas <ma...@apache.org> AuthorDate: Wed Jul 26 14:43:10 2023 +0100 Remove debug logging. We have not seen the error repeat in 2 years. --- .../apache/coyote/http2/TestCancelledUpload.java | 108 ++++++++++----------- 1 file changed, 50 insertions(+), 58 deletions(-) diff --git a/test/org/apache/coyote/http2/TestCancelledUpload.java b/test/org/apache/coyote/http2/TestCancelledUpload.java index dacbb4e320..ed59f6dee1 100644 --- a/test/org/apache/coyote/http2/TestCancelledUpload.java +++ b/test/org/apache/coyote/http2/TestCancelledUpload.java @@ -19,9 +19,6 @@ package org.apache.coyote.http2; import java.io.IOException; import java.io.InputStream; import java.nio.ByteBuffer; -import java.util.logging.Level; -import java.util.logging.LogManager; - import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -39,71 +36,66 @@ public class TestCancelledUpload extends Http2TestBase { public void testCancelledRequest() throws Exception { http2Connect(); - LogManager.getLogManager().getLogger("org.apache.coyote.http2").setLevel(Level.ALL); - try { - http2Protocol.setAllowedTrailerHeaders(TRAILER_HEADER_NAME); - - int bodySize = 8192; - int bodyCount = 20; + http2Protocol.setAllowedTrailerHeaders(TRAILER_HEADER_NAME); - byte[] headersFrameHeader = new byte[9]; - ByteBuffer headersPayload = ByteBuffer.allocate(128); - byte[] dataFrameHeader = new byte[9]; - ByteBuffer dataPayload = ByteBuffer.allocate(bodySize); - byte[] trailerFrameHeader = new byte[9]; - ByteBuffer trailerPayload = ByteBuffer.allocate(256); + int bodySize = 8192; + int bodyCount = 20; - buildPostRequest(headersFrameHeader, headersPayload, false, dataFrameHeader, dataPayload, null, - trailerFrameHeader, trailerPayload, 3); + byte[] headersFrameHeader = new byte[9]; + ByteBuffer headersPayload = ByteBuffer.allocate(128); + byte[] dataFrameHeader = new byte[9]; + ByteBuffer dataPayload = ByteBuffer.allocate(bodySize); + byte[] trailerFrameHeader = new byte[9]; + ByteBuffer trailerPayload = ByteBuffer.allocate(256); - // Write the headers - writeFrame(headersFrameHeader, headersPayload); - // Body - for (int i = 0; i < bodyCount; i++) { - writeFrame(dataFrameHeader, dataPayload); - } + buildPostRequest(headersFrameHeader, headersPayload, false, dataFrameHeader, dataPayload, null, + trailerFrameHeader, trailerPayload, 3); - // Trailers - writeFrame(trailerFrameHeader, trailerPayload); - - // The Server will process the request on a separate thread to the - // incoming frames. - // The request processing thread will: - // - read up to 128 bytes of request body - // (and issue a window update for bytes read) - // - write a 403 response with no response body - // The connection processing thread will: - // - read the request body until the flow control window is exhausted - // - reset the stream if further DATA frames are received - parser.readFrame(); + // Write the headers + writeFrame(headersFrameHeader, headersPayload); + // Body + for (int i = 0; i < bodyCount; i++) { + writeFrame(dataFrameHeader, dataPayload); + } - // Check for reset and exit if found - if (checkReset()) { - return; - } + // Trailers + writeFrame(trailerFrameHeader, trailerPayload); + + // The Server will process the request on a separate thread to the + // incoming frames. + // The request processing thread will: + // - read up to 128 bytes of request body + // (and issue a window update for bytes read) + // - write a 403 response with no response body + // The connection processing thread will: + // - read the request body until the flow control window is exhausted + // - reset the stream if further DATA frames are received + parser.readFrame(); + + // Check for reset and exit if found + if (checkReset()) { + return; + } - // Not window update, not reset, must be the headers - Assert.assertEquals("3-HeadersStart\n" + "3-Header-[:status]-[403]\n" + "3-Header-[content-length]-[0]\n" + - "3-Header-[date]-[Wed, 11 Nov 2015 19:18:42 GMT]\n" + "3-HeadersEnd\n", output.getTrace()); - output.clearTrace(); - parser.readFrame(); + // Not window update, not reset, must be the headers + Assert.assertEquals("3-HeadersStart\n" + "3-Header-[:status]-[403]\n" + "3-Header-[content-length]-[0]\n" + + "3-Header-[date]-[Wed, 11 Nov 2015 19:18:42 GMT]\n" + "3-HeadersEnd\n", output.getTrace()); + output.clearTrace(); + parser.readFrame(); - // Check for reset and exit if found - if (checkReset()) { - return; - } + // Check for reset and exit if found + if (checkReset()) { + return; + } - // Not window update, not reset, must be the response body - Assert.assertEquals("3-Body-0\n" + "3-EndOfStream\n", output.getTrace()); - output.clearTrace(); - parser.readFrame(); + // Not window update, not reset, must be the response body + Assert.assertEquals("3-Body-0\n" + "3-EndOfStream\n", output.getTrace()); + output.clearTrace(); + parser.readFrame(); - Assert.assertTrue(checkReset()); + Assert.assertTrue(checkReset()); - // If there are any more frames after this, ignore them - } finally { - LogManager.getLogManager().getLogger("org.apache.coyote.http2").setLevel(Level.INFO); - } + // If there are any more frames after this, ignore them } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org