[Git][java-team/undertow][master] 3 commits: New upstream version 2.2.17

Markus Koschany (@apo) gitlab at salsa.debian.org
Sat Apr 30 22:46:15 BST 2022



Markus Koschany pushed to branch master at Debian Java Maintainers / undertow


Commits:
b329e4d1 by Markus Koschany at 2022-04-30T23:40:20+02:00
New upstream version 2.2.17
- - - - -
44d46762 by Markus Koschany at 2022-04-30T23:40:23+02:00
Update upstream source from tag 'upstream/2.2.17'

Update to upstream version '2.2.17'
with Debian dir ce66e0c991c4097b4fc386d91db45366ea07efcd
- - - - -
9e569a80 by Markus Koschany at 2022-04-30T23:41:09+02:00
Update changelog

- - - - -


27 changed files:

- README.md
- benchmarks/pom.xml
- core/pom.xml
- core/src/main/java/io/undertow/conduits/FixedLengthStreamSourceConduit.java
- core/src/main/java/io/undertow/conduits/ReadTimeoutStreamSourceConduit.java
- core/src/main/java/io/undertow/io/UndertowInputStream.java
- core/src/main/java/io/undertow/server/protocol/ajp/AjpServerResponseConduit.java
- core/src/main/java/io/undertow/util/NetworkUtils.java
- core/src/test/java/io/undertow/client/http/HttpClientTestCase.java
- core/src/test/java/io/undertow/server/ssl/SimpleSSLTestCase.java
- core/src/test/java/io/undertow/testutils/DefaultServer.java
- core/src/test/java/io/undertow/util/NetworkUtilsAddressParsingTestCase.java
- coverage-report/pom.xml
- debian/changelog
- dist/pom.xml
- examples/pom.xml
- jakarta/examples/pom.xml
- jakarta/pom.xml
- jakarta/servlet/pom.xml
- jakarta/websockets-jsr/pom.xml
- karaf/pom.xml
- parser-generator/pom.xml
- pom.xml
- servlet/pom.xml
- servlet/src/main/java/io/undertow/servlet/spec/ServletInputStreamImpl.java
- servlet/src/main/java/io/undertow/servlet/spec/UpgradeServletInputStream.java
- websockets-jsr/pom.xml


Changes:

=====================================
README.md
=====================================
@@ -1,18 +1,59 @@
 Undertow
 ========
-
 Undertow is a Java web server based on non-blocking IO. It consists of a few different parts:
 
-* A core HTTP server that supports both blocking and non-blocking IO
-* A Servlet 4.0 implementation
-* A JSR-356 compliant web socket implementation
+- A core HTTP server that supports both blocking and non-blocking IO
+- A Servlet 4.0/5.0 implementation
+- A JSR-356/Jakarta 2.0 compliant Web Socket implementation
 
 Website: http://undertow.io
 
-Issues: https://issues.jboss.org/browse/UNDERTOW
+Issues: https://issues.redhat.com/projects/UNDERTOW
 
 Project Lead: Flavia Rainone <frainone at redhat.com>
 
-Mailing List: undertow-dev at lists.jboss.org
-http://lists.jboss.org/mailman/listinfo/undertow-dev
+Undertow Dev Group: https://groups.google.com/g/undertow-dev/
+(you can access archived discussions of old undertow-dev mail list [here](http://lists.jboss.org/mailman/listinfo/undertow-dev))
+
+Zulip Chat: https://wildfly.zulipchat.com stream [#undertow](https://wildfly.zulipchat.com/#narrow/stream/174183-undertow)
+
+Contributing to Undertow - PR Review Process
+--------------------------------------------
+
+Bug fixes and documentation improvements are welcome! If you want to contribute and are not sure where to start, I suggest you have a look at our [Jira project](https://issues.redhat.com/projects/UNDERTOW "Undertow Jira") and get in touch with us via [Zulip chat](https://wildfly.zulipchat.com/#narrow/stream/174183-undertow "#undertow").
+
+PRs must be submitted to master branch (soon to be [renamed to main](https://issues.redhat.com/browse/UNDERTOW-2043)) and they should:
+- state clearly what they do
+- point to associated Jira
+- contain a test case, unless existing tests already verify the code added by the PR
+- have a license header in all new files, with current year’s number
+- pass CI (except for known failures, we are working on fixing those, tracked by [UNDERTOW-1523](https://issues.redhat.com/browse/UNDERTOW-1523))
+
+If your PR is incomplete, the reviewer might request you add the missing bits or add them for you if that is simple enough.
+
+PR reviewers will take into account the following aspects when reviewing your PR:
+- correctness: the code must be correct
+- performance impact: if there are negative performance impacts in the code, careful consideration must be taken whereas the impact could be eliminated and, in case it cannot, if the new code should be accepted
+- code style: keep your code style consistent with the classes you are editing, such as variable names, ordering of methods, etc
+- scope of the fix: this is a very important factor. Sometimes, the fix should be applied to a broader range of classes, such as a bug that repeats itself in other parts of the code. Other times, the PR solves a bug only partially, because the bug has a broader impact than initially evaluated.
+- is the proposed fix the best approach for the Jira at hand?
+- backwards compatibility: we must prevent any PR that breaks compatibility with previous versions
+- security impact: it is critical to evaluate if the PR has any sort of security impact, preventing the addition of exploitable flaws.
+
+Your PR will be classified by the reviewer with one or more of the following labels: **bug fix**, **enhancement**, **new feature/API change**, and **dependency upgrade**.
+
+Besides the classifications labels, a series of labels are going to be added to your PR while it is under review. This is the full list of labels and what they mean:
+- **waiting CI check**  PR is ready to be merged, but we are waiting for CI results. The use of this label is optional.
+- **waiting PR update**  reviewer has requested changes to the PR
+- **failed CI**  a new failure was introduced to CI
+- **question** reviewer has asked one or more questions to the contributor, so the PR can be better assessed
+- **under verification**  reviewer will perform some extra verifications before giving their feedback (usually this means running reproducers, reviewing specs, and the like)
+- **waiting peer review** PR has been reviewed but is waiting on a second review before being merged  (as the changes affects core classes or adds a new feature)
+- **next release** PR is in the payload of the next release
+
+Notifying Security Relevant Bugs
+--------------------------------
+
+If you find a bug that has a security impact, please notify us sending an email to Red Hat SecAlert <secalert at redhat.com> with a copy to Flavia Rainone <frainone at redhat.com>. This will ensure the bug is properly handled without causing unnecessary negative impacts for the Undertow's user base.
 
+You can find more information about the security procedures at [this page](https://access.redhat.com/security/team/contact "Security Contacts and Procedures").


=====================================
benchmarks/pom.xml
=====================================
@@ -25,11 +25,11 @@
     <parent>
         <groupId>io.undertow</groupId>
         <artifactId>undertow-parent</artifactId>
-        <version>2.2.16.Final</version>
+        <version>2.2.17.Final</version>
     </parent>
 
     <artifactId>undertow-benchmarks</artifactId>
-    <version>2.2.16.Final</version>
+    <version>2.2.17.Final</version>
 
     <name>Undertow Benchmarks</name>
 


=====================================
core/pom.xml
=====================================
@@ -25,12 +25,12 @@
     <parent>
         <groupId>io.undertow</groupId>
         <artifactId>undertow-parent</artifactId>
-        <version>2.2.16.Final</version>
+        <version>2.2.17.Final</version>
     </parent>
 
     <groupId>io.undertow</groupId>
     <artifactId>undertow-core</artifactId>
-    <version>2.2.16.Final</version>
+    <version>2.2.17.Final</version>
 
     <name>Undertow Core</name>
 


=====================================
core/src/main/java/io/undertow/conduits/FixedLengthStreamSourceConduit.java
=====================================
@@ -277,6 +277,19 @@ public final class FixedLengthStreamSourceConduit extends AbstractStreamSourceCo
         next.wakeupReads();
     }
 
+    @Override
+    public void resumeReads() {
+        long val = state;
+        if (anyAreSet(val, FLAG_CLOSED | FLAG_FINISHED)) {
+            return;
+        }
+        if (allAreClear(val, MASK_COUNT)) {
+            next.wakeupReads();
+        } else {
+            next.resumeReads();
+        }
+    }
+
     @Override
     public void terminateReads() throws IOException {
         long val = enterShutdownReads();


=====================================
core/src/main/java/io/undertow/conduits/ReadTimeoutStreamSourceConduit.java
=====================================
@@ -211,6 +211,18 @@ public final class ReadTimeoutStreamSourceConduit extends AbstractStreamSourceCo
         return timeout;
     }
 
+    @Override
+    public void resumeReads() {
+        super.resumeReads();
+        if (handle == null) {
+            try {
+                handleReadTimeout(1);
+            } catch (IOException e) {
+                // impossible as 1 is passed
+            }
+        }
+    }
+
     @Override
     public void terminateReads() throws IOException {
         checkExpired();


=====================================
core/src/main/java/io/undertow/io/UndertowInputStream.java
=====================================
@@ -20,7 +20,6 @@ package io.undertow.io;
 
 import io.undertow.UndertowMessages;
 import io.undertow.server.HttpServerExchange;
-import org.xnio.Buffers;
 import io.undertow.connector.ByteBufferPool;
 import io.undertow.connector.PooledByteBuffer;
 import org.xnio.channels.Channels;
@@ -94,7 +93,8 @@ public class UndertowInputStream extends InputStream {
             return 0;
         }
         ByteBuffer buffer = pooled.getBuffer();
-        int copied = Buffers.copy(ByteBuffer.wrap(b, off, len), buffer);
+        int copied = Math.min(buffer.remaining(), len);
+        buffer.get(b, off, copied);
         if (!buffer.hasRemaining()) {
             pooled.close();
             pooled = null;


=====================================
core/src/main/java/io/undertow/server/protocol/ajp/AjpServerResponseConduit.java
=====================================
@@ -42,8 +42,10 @@ import java.io.IOException;
 import java.nio.ByteBuffer;
 import java.nio.channels.ClosedChannelException;
 import java.nio.channels.FileChannel;
+import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 import static org.xnio.Bits.allAreClear;
@@ -266,6 +268,40 @@ final class AjpServerResponseConduit extends AbstractFramedStreamSinkConduit {
         queueFrame(null, buffer);
     }
 
+    private void queueRemainingBytes(final ByteBuffer src, final ByteBuffer[] buffers) {
+        List<PooledByteBuffer> pools = new ArrayList<>(4);
+
+        try {
+            PooledByteBuffer newPooledBuffer = pool.allocate();
+            pools.add(newPooledBuffer);
+            while (src.remaining() > newPooledBuffer.getBuffer().remaining()) {
+                ByteBuffer dupSrc = src.duplicate();
+                dupSrc.limit(dupSrc.position() + newPooledBuffer.getBuffer().remaining());
+                newPooledBuffer.getBuffer().put(dupSrc);
+                src.position(dupSrc.position());
+                newPooledBuffer.getBuffer().flip();
+                newPooledBuffer = pool.allocate();
+                pools.add(newPooledBuffer);
+            }
+            newPooledBuffer.getBuffer().put(src);
+            newPooledBuffer.getBuffer().flip();
+
+            ByteBuffer[] savedBuffers = new ByteBuffer[pools.size() + 2];
+            int i = 0;
+            savedBuffers[i++] = buffers[0];
+            for (PooledByteBuffer p : pools) {
+                savedBuffers[i++] = p.getBuffer();
+            }
+            savedBuffers[i] = buffers[2];
+            queueFrame(new PooledBuffersFrameCallback(pools.toArray(new PooledByteBuffer[0])), savedBuffers);
+        } catch (RuntimeException | Error e) {
+            for (PooledByteBuffer p : pools) {
+                p.close();
+            }
+            throw e;
+        }
+    }
+
     public int write(final ByteBuffer src) throws IOException {
         if(queuedDataLength() > 0) {
             //if there is data in the queue we flush and return
@@ -300,18 +336,8 @@ final class AjpServerResponseConduit extends AbstractFramedStreamSinkConduit {
                 if (r == -1) {
                     throw new ClosedChannelException();
                 } else if (r == 0) {
-                    //we need to copy all the remaining bytes
-                    //TODO: this assumes the buffer is big enough
-                    PooledByteBuffer newPooledBuffer = pool.allocate();
-                    while (src.hasRemaining()) {
-                        newPooledBuffer.getBuffer().put(src);
-                    }
-                    newPooledBuffer.getBuffer().flip();
-                    ByteBuffer[] savedBuffers = new ByteBuffer[3];
-                    savedBuffers[0] = buffers[0];
-                    savedBuffers[1] = newPooledBuffer.getBuffer();
-                    savedBuffers[2] = buffers[2];
-                    queueFrame(new PooledBufferFrameCallback(newPooledBuffer), savedBuffers);
+                    // we need to queue all the remaining bytes for writing
+                    queueRemainingBytes(src, buffers);
                     return originalPayloadSize;
                 }
             } while (toWrite > 0);


=====================================
core/src/main/java/io/undertow/util/NetworkUtils.java
=====================================
@@ -116,9 +116,6 @@ public class NetworkUtils {
                     throw UndertowMessages.MESSAGES.invalidIpAddress(addressString);
                 }
                 partOffset = off * 2;
-            } else if (part.length() > 1 && part.charAt(0) == '0') {
-                //leading zeros are not allowed
-                throw UndertowMessages.MESSAGES.invalidIpAddress(addressString);
             } else {
                 int num = Integer.parseInt(part, 16);
                 data[i * 2 + partOffset] = (byte) (num >> 8);


=====================================
core/src/test/java/io/undertow/client/http/HttpClientTestCase.java
=====================================
@@ -60,6 +60,7 @@ import org.xnio.OptionMap;
 import org.xnio.Options;
 import org.xnio.Xnio;
 import org.xnio.XnioWorker;
+import org.xnio.channels.ReadTimeoutException;
 import org.xnio.channels.StreamSinkChannel;
 import org.xnio.ssl.XnioSsl;
 
@@ -76,6 +77,7 @@ public class HttpClientTestCase {
     private static final String message = "Hello World!";
     public static final String MESSAGE = "/message";
     public static final String READTIMEOUT = "/readtimeout";
+    public static final String READTIMEOUT_AT_INIT = "/readtimeout-init";
     public static final String POST = "/post";
     private static XnioWorker worker;
 
@@ -126,19 +128,35 @@ public class HttpClientTestCase {
             public void handleRequest(HttpServerExchange exchange) throws Exception {
                 exchange.setStatusCode(StatusCodes.OK);
                 exchange.getResponseHeaders().put(Headers.CONTENT_LENGTH, 5 + "");
-                StreamSinkChannel responseChannel = exchange.getResponseChannel();
-                responseChannel.write(ByteBuffer.wrap(new byte[]{'a', 'b', 'c'}));
-                responseChannel.flush();
+                try (StreamSinkChannel responseChannel = exchange.getResponseChannel()) {
+                    responseChannel.write(ByteBuffer.wrap(new byte[]{'a', 'b', 'c'}));
+                    responseChannel.flush();
+                    try {
+                        //READ_TIMEOUT set as 600ms on the client side
+                        //On the server side intentionally sleep 2000ms
+                        //to make READ_TIMEOUT happening at client side
+                        Thread.sleep(2000);
+                    } catch (InterruptedException e) {
+                        e.printStackTrace();
+                    }
+                    responseChannel.write(ByteBuffer.wrap(new byte[]{'d', 'e'}));
+                }
+            }
+        })
+        .addExactPath(READTIMEOUT_AT_INIT, new HttpHandler() {
+            @Override
+            public void handleRequest(HttpServerExchange exchange) throws Exception {
                 try {
-                    //READ_TIMEOUT set as 600ms on the client side
-                    //On the server side intentionally sleep 2000ms
-                    //to make READ_TIMEOUT happening at client side
+                    // Do the sleep before sending any data to the client
                     Thread.sleep(2000);
                 } catch (InterruptedException e) {
                     e.printStackTrace();
                 }
-                responseChannel.write(ByteBuffer.wrap(new byte[]{'d', 'e'}));
-                responseChannel.close();
+                exchange.setStatusCode(StatusCodes.OK);
+                exchange.getResponseHeaders().put(Headers.CONTENT_LENGTH, "5");
+                try (StreamSinkChannel responseChannel = exchange.getResponseChannel()) {
+                    responseChannel.write(ByteBuffer.wrap(new byte[]{'a', 'b', 'c', 'd', 'e'}));
+                }
             }
         })
         .addExactPath(POST, new HttpHandler() {
@@ -347,34 +365,44 @@ public class HttpClientTestCase {
         OptionMap.Builder builder = OptionMap.builder();
         builder.set(Options.READ_TIMEOUT, 600);
         final ClientConnection connection = client.connect(ADDRESS, worker, DefaultServer.getBufferPool(), builder.getMap()).get();
-        final ClientRequest request = new ClientRequest().setMethod(Methods.GET).setPath(READTIMEOUT);
-        request.getRequestHeaders().put(Headers.HOST, DefaultServer.getHostAddress());
-        connection.sendRequest(request, createClientCallback(responses, latch, false));
         try {
-            connection.getIoThread().execute(new Runnable() {
-                @Override
-                public void run() {
-                    for (int i = 0; i < 1; i++) {
-                        final ClientRequest request = new ClientRequest().setMethod(Methods.GET).setPath(READTIMEOUT);
-                        request.getRequestHeaders().put(Headers.HOST, DefaultServer.getHostAddress());
-                        connection.sendRequest(request, createClientCallback(responses, latch, false));
-                    }
-                }
-
+            connection.getIoThread().execute(() -> {
+                final ClientRequest request = new ClientRequest().setMethod(Methods.GET).setPath(READTIMEOUT);
+                request.getRequestHeaders().put(Headers.HOST, DefaultServer.getHostAddress());
+                connection.sendRequest(request, createClientCallback(responses, latch));
             });
-            latch.await(10, TimeUnit.SECONDS);
+            Assert.assertTrue(latch.await(10, TimeUnit.SECONDS));
             //exception expected because of read timeout
-            Assert.assertNotNull(exception);
+            Assert.assertTrue(exception instanceof ReadTimeoutException);
         } finally {
-            IoUtils.safeClose(connection);
+            connection.getIoThread().execute(() -> IoUtils.safeClose(connection));
         }
     }
 
-    private ClientCallback<ClientExchange> createClientCallback(final List<ClientResponse> responses, final CountDownLatch latch) {
-        return createClientCallback(responses, latch, true);
+    @Test
+    public void testReadTimeoutAtInit() throws Exception {
+        final UndertowClient client = createClient();
+        exception = null;
+
+        final List<ClientResponse> responses = new CopyOnWriteArrayList<>();
+        final CountDownLatch latch = new CountDownLatch(1);
+        OptionMap.Builder builder = OptionMap.builder().set(Options.READ_TIMEOUT, 600);
+        final ClientConnection connection = client.connect(ADDRESS, worker, DefaultServer.getBufferPool(), builder.getMap()).get();
+        try {
+            connection.getIoThread().execute(() -> {
+                final ClientRequest request = new ClientRequest().setMethod(Methods.GET).setPath(READTIMEOUT_AT_INIT);
+                request.getRequestHeaders().put(Headers.HOST, DefaultServer.getHostAddress());
+                connection.sendRequest(request, createClientCallback(responses, latch));
+            });
+            Assert.assertTrue(latch.await(10, TimeUnit.SECONDS));
+            //exception expected because of read timeout
+            Assert.assertTrue(exception instanceof ReadTimeoutException);
+        } finally {
+            connection.getIoThread().execute(() -> IoUtils.safeClose(connection));
+        }
     }
 
-    private ClientCallback<ClientExchange> createClientCallback(final List<ClientResponse> responses, final CountDownLatch latch, final boolean expectedResponse) {
+    private ClientCallback<ClientExchange> createClientCallback(final List<ClientResponse> responses, final CountDownLatch latch) {
         return new ClientCallback<ClientExchange>() {
             @Override
             public void completed(ClientExchange result) {
@@ -389,8 +417,7 @@ public class HttpClientTestCase {
                                 // add response only if there is a string or error, or else
                                 // we risk adding keep alive messages in timeout tests
                                 responses.add(result.getResponse());
-                                if (expectedResponse)
-                                    latch.countDown();
+                                latch.countDown();
                             }
 
                             @Override


=====================================
core/src/test/java/io/undertow/server/ssl/SimpleSSLTestCase.java
=====================================
@@ -24,6 +24,7 @@ import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicInteger;
 
 import io.undertow.server.HttpHandler;
 import io.undertow.server.HttpServerExchange;
@@ -42,7 +43,6 @@ import org.apache.http.impl.client.CloseableHttpClient;
 import org.apache.http.impl.client.HttpClients;
 import org.apache.http.util.EntityUtils;
 import org.junit.Assert;
-import org.junit.Assume;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
@@ -52,6 +52,10 @@ import org.junit.runner.RunWith;
 @RunWith(DefaultServer.class)
 public class SimpleSSLTestCase {
 
+    // The concurrency is aligned to the #CPUs*8 up to a max of 32 threads
+    private static final int CONCURRENCY = Math.min(32, Runtime.getRuntime().availableProcessors() * 8);
+    private static final int REQUESTS_PER_THREAD = 300;
+
     @Test
     public void simpleSSLTestCase() throws IOException, GeneralSecurityException {
 
@@ -112,9 +116,7 @@ public class SimpleSSLTestCase {
 
     @Test
     public void parallel() throws Exception {
-        // FIXME UNDERTOW-1928
-        Assume.assumeFalse(System.getProperty("os.name").startsWith("Windows") && DefaultServer.isProxy());
-        runTest(32, new HttpHandler() {
+        runTest(CONCURRENCY, new HttpHandler() {
             @Override
             public void handleRequest(final HttpServerExchange exchange) throws Exception {
                 exchange.getResponseHeaders().put(HttpString.tryFromString("scheme"), exchange.getRequestScheme());
@@ -125,9 +127,7 @@ public class SimpleSSLTestCase {
 
     @Test
     public void parallelWithDispatch() throws Exception {
-        // FIXME UNDERTOW-1928
-        Assume.assumeFalse(System.getProperty("os.name").startsWith("Windows"));
-        runTest(32, new HttpHandler() {
+        runTest(CONCURRENCY, new HttpHandler() {
             @Override
             public void handleRequest(final HttpServerExchange exchange) throws Exception {
                 exchange.dispatch(() -> {
@@ -140,9 +140,7 @@ public class SimpleSSLTestCase {
 
     @Test
     public void parallelWithBlockingDispatch() throws Exception {
-        // FIXME UNDERTOW-1928
-        Assume.assumeFalse(System.getProperty("os.name").startsWith("Windows"));
-        runTest(32, new HttpHandler() {
+        runTest(CONCURRENCY, new HttpHandler() {
             @Override
             public void handleRequest(final HttpServerExchange exchange) throws Exception {
                 if (exchange.isInIoThread()) {
@@ -159,13 +157,14 @@ public class SimpleSSLTestCase {
     private void runTest(int concurrency, HttpHandler handler) throws IOException, InterruptedException {
         DefaultServer.setRootHandler(handler);
         DefaultServer.startSSLServer();
+        ExecutorService executorService = Executors.newFixedThreadPool(concurrency);
         try (CloseableHttpClient client = HttpClients.custom().disableConnectionState()
                 .setSSLContext(DefaultServer.getClientSSLContext())
-                .setDefaultSocketConfig(SocketConfig.custom().setSoTimeout(5000).build())
+                .setDefaultSocketConfig(SocketConfig.custom().setSoTimeout(60000).build())
                 .setMaxConnPerRoute(1000)
                 .build()) {
-            ExecutorService executorService = Executors.newFixedThreadPool(concurrency);
             AtomicBoolean failed = new AtomicBoolean();
+            AtomicInteger processed = new AtomicInteger(0);
             Runnable task = new Runnable() {
                 @Override
                 public void run() {
@@ -177,22 +176,34 @@ public class SimpleSSLTestCase {
                         Header[] header = result.getHeaders("scheme");
                         Assert.assertEquals("https", header[0].getValue());
                         EntityUtils.consumeQuietly(result.getEntity());
+                        processed.incrementAndGet();
                     } catch (Throwable t) {
                         if (failed.compareAndSet(false, true)) {
                             t.printStackTrace();
-                            executorService.shutdownNow();
                         }
                     }
                 }
             };
-            for (int i = 0; i < concurrency * 300; i++) {
+            for (int i = 0; i < concurrency * REQUESTS_PER_THREAD; i++) {
                 executorService.submit(task);
             }
             executorService.shutdown();
-            Assert.assertTrue(executorService.awaitTermination(70, TimeUnit.SECONDS));
-            Assert.assertFalse(failed.get());
+            int executedPrevTime = 0;
+            while (!executorService.awaitTermination(10, TimeUnit.SECONDS) && !failed.get()) {
+                int executed = processed.get();
+                if (executedPrevTime == executed) {
+                    failed.set(true);
+                    Assert.fail("Executions hanged at " + executed);
+                }
+                executedPrevTime = executed;
+            }
+            Assert.assertFalse("A task failed! Check the stack-trace in the output file", failed.get());
+            Assert.assertTrue(executorService.isTerminated());
         } finally {
             DefaultServer.stopSSLServer();
+            if (!executorService.isTerminated()) {
+                executorService.shutdownNow();
+            }
         }
     }
 


=====================================
core/src/test/java/io/undertow/testutils/DefaultServer.java
=====================================
@@ -387,22 +387,24 @@ public class DefaultServer extends BlockJUnit4ClassRunner {
 
             @Override
             public void testFinished(Description description) throws Exception {
-
-                if (!DebuggingSlicePool.BUFFERS.isEmpty()) {
+                boolean empty = DebuggingSlicePool.BUFFERS.isEmpty();
+                if (!empty) {
                     try {
-                        Thread.sleep(200);
                         long end = System.currentTimeMillis() + 20000;
-                        while (!DebuggingSlicePool.BUFFERS.isEmpty() && System.currentTimeMillis() < end) {
+                        do {
                             Thread.sleep(200);
-                        }
+                            empty = DebuggingSlicePool.BUFFERS.isEmpty();
+                        } while (!empty && System.currentTimeMillis() < end);
                     } catch (InterruptedException e) {
                         throw new RuntimeException(e);
                     }
-                    for (DebuggingSlicePool.DebuggingBuffer b : DebuggingSlicePool.BUFFERS) {
-                        b.getAllocationPoint().printStackTrace();
-                        notifier.fireTestFailure(new Failure(description, new RuntimeException("Buffer Leak " + b.getLabel(), b.getAllocationPoint())));
+                    if (!empty) {
+                        for (DebuggingSlicePool.DebuggingBuffer b : DebuggingSlicePool.BUFFERS) {
+                            b.getAllocationPoint().printStackTrace();
+                            notifier.fireTestFailure(new Failure(description, new RuntimeException("Buffer Leak " + b.getLabel(), b.getAllocationPoint())));
+                        }
+                        DebuggingSlicePool.BUFFERS.clear();
                     }
-                    DebuggingSlicePool.BUFFERS.clear();
                 }
                 super.testFinished(description);
             }
@@ -576,6 +578,9 @@ public class DefaultServer extends BlockJUnit4ClassRunner {
             if (server != null) {
                 server.close();
             }
+            if (proxyServer != null) {
+                proxyServer.close();
+            }
             stopSSLServer();
             if (worker != null) {
                 stopWorker(worker);


=====================================
core/src/test/java/io/undertow/util/NetworkUtilsAddressParsingTestCase.java
=====================================
@@ -109,6 +109,16 @@ public class NetworkUtilsAddressParsingTestCase {
         }
         Assert.assertEquals("/2001:1db8:100:0:0:ff00:42:8329", res.toString());
 
+        addressString = "2001:1db8:0100:0000:0000:ff00:0042:8329";
+        res = NetworkUtils.parseIpv6Address(addressString);
+        Assert.assertTrue(res instanceof Inet6Address);
+
+        parts = new int[]{0x2001, 0x1db8, 0x100, 0x0, 0x0, 0xff00, 0x42, 0x8329};
+        for(int i = 0 ; i < parts.length; ++i) {
+            Assert.assertEquals(((byte)(parts[i]>>8)), res.getAddress()[i * 2]);
+            Assert.assertEquals(((byte)(parts[i])), res.getAddress()[i * 2 + 1]);
+        }
+        Assert.assertEquals("/2001:1db8:100:0:0:ff00:42:8329", res.toString());
 
         addressString = "::1";
         res = NetworkUtils.parseIpv6Address(addressString);
@@ -122,11 +132,6 @@ public class NetworkUtilsAddressParsingTestCase {
         Assert.assertEquals("/0:0:0:0:0:0:0:1", res.toString());
     }
 
-    @Test(expected = IOException.class)
-    public void testIpV6AddressWithLeadingZero() throws IOException {
-        NetworkUtils.parseIpv6Address("2001:1db8:100:03:6:ff00:42:8329");
-    }
-
     @Test(expected = IOException.class)
     public void testIpV6AddressToSmall() throws IOException {
         NetworkUtils.parseIpv6Address("2001:1db8:3:6:ff00:42:8329");


=====================================
coverage-report/pom.xml
=====================================
@@ -3,7 +3,7 @@
     <parent>
         <groupId>io.undertow</groupId>
         <artifactId>undertow-parent</artifactId>
-        <version>2.2.16.Final</version>
+        <version>2.2.17.Final</version>
     </parent>
     <artifactId>undertow-coverage-report</artifactId>
     <name>Undertow Test Coverage Report</name>


=====================================
debian/changelog
=====================================
@@ -1,3 +1,9 @@
+undertow (2.2.17-1) unstable; urgency=medium
+
+  * New upstream version 2.2.17.
+
+ -- Markus Koschany <apo at debian.org>  Sat, 30 Apr 2022 23:40:58 +0200
+
 undertow (2.2.16-1) unstable; urgency=medium
 
   * New upstream version 2.2.16.


=====================================
dist/pom.xml
=====================================
@@ -25,12 +25,12 @@
     <parent>
         <groupId>io.undertow</groupId>
         <artifactId>undertow-parent</artifactId>
-        <version>2.2.16.Final</version>
+        <version>2.2.17.Final</version>
     </parent>
 
     <groupId>io.undertow</groupId>
     <artifactId>undertow-dist</artifactId>
-    <version>2.2.16.Final</version>
+    <version>2.2.17.Final</version>
 
     <name>Undertow: Distribution</name>
 


=====================================
examples/pom.xml
=====================================
@@ -25,12 +25,12 @@
     <parent>
         <groupId>io.undertow</groupId>
         <artifactId>undertow-parent</artifactId>
-        <version>2.2.16.Final</version>
+        <version>2.2.17.Final</version>
     </parent>
 
     <groupId>io.undertow</groupId>
     <artifactId>undertow-examples</artifactId>
-    <version>2.2.16.Final</version>
+    <version>2.2.17.Final</version>
 
     <name>Undertow Examples</name>
 


=====================================
jakarta/examples/pom.xml
=====================================
@@ -24,7 +24,7 @@
     <parent>
         <groupId>io.undertow</groupId>
         <artifactId>undertow-parent-jakarta</artifactId>
-        <version>2.2.16.Final</version>
+        <version>2.2.17.Final</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 


=====================================
jakarta/pom.xml
=====================================
@@ -24,7 +24,7 @@
     <parent>
         <groupId>io.undertow</groupId>
         <artifactId>undertow-parent</artifactId>
-        <version>2.2.16.Final</version>
+        <version>2.2.17.Final</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 


=====================================
jakarta/servlet/pom.xml
=====================================
@@ -24,12 +24,12 @@
     <parent>
         <groupId>io.undertow</groupId>
         <artifactId>undertow-parent-jakarta</artifactId>
-        <version>2.2.16.Final</version>
+        <version>2.2.17.Final</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
     <artifactId>undertow-servlet-jakarta</artifactId>
-    <version>2.2.16.Final</version>
+    <version>2.2.17.Final</version>
     <name>Undertow Servlet - Jakarta Variant</name>
 
     <properties>
@@ -203,6 +203,24 @@
                 <groupId>org.wildfly.extras.batavia</groupId>
                 <artifactId>transformer-tools-mvn</artifactId>
             </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-antrun-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <phase>generate-resources</phase>
+                        <configuration>
+                            <target>
+                                <move file="target/generated-resources/transformed/META-INF/services/javax.servlet.ServletContainerInitializer"
+                                      tofile="target/generated-resources/transformed/META-INF/services/jakarta.servlet.ServletContainerInitializer"/>
+                            </target>
+                        </configuration>
+                        <goals>
+                            <goal>run</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
         </plugins>
     </build>
 


=====================================
jakarta/websockets-jsr/pom.xml
=====================================
@@ -24,7 +24,7 @@
     <parent>
         <groupId>io.undertow</groupId>
         <artifactId>undertow-parent-jakarta</artifactId>
-        <version>2.2.16.Final</version>
+        <version>2.2.17.Final</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 


=====================================
karaf/pom.xml
=====================================
@@ -23,12 +23,12 @@
     <parent>
         <groupId>io.undertow</groupId>
         <artifactId>undertow-parent</artifactId>
-        <version>2.2.16.Final</version>
+        <version>2.2.17.Final</version>
     </parent>
 
     <groupId>io.undertow</groupId>
     <artifactId>karaf</artifactId>
-    <version>2.2.16.Final</version>
+    <version>2.2.17.Final</version>
 
     <name>Undertow Karaf feature</name>
 


=====================================
parser-generator/pom.xml
=====================================
@@ -25,12 +25,12 @@
     <parent>
         <groupId>io.undertow</groupId>
         <artifactId>undertow-parent</artifactId>
-        <version>2.2.16.Final</version>
+        <version>2.2.17.Final</version>
     </parent>
 
     <groupId>io.undertow</groupId>
     <artifactId>undertow-parser-generator</artifactId>
-    <version>2.2.16.Final</version>
+    <version>2.2.17.Final</version>
 
     <name>Undertow Parser Generator</name>
     <description>An annotation processor that is used to generate the HTTP parser</description>


=====================================
pom.xml
=====================================
@@ -28,7 +28,7 @@
 
     <groupId>io.undertow</groupId>
     <artifactId>undertow-parent</artifactId>
-    <version>2.2.16.Final</version>
+    <version>2.2.17.Final</version>
 
     <name>Undertow</name>
     <description>Undertow</description>
@@ -65,7 +65,7 @@
         <version.jakarta.annotation.jakarta-annotation-api>2.0.0</version.jakarta.annotation.jakarta-annotation-api>
         <version.jakarta.servlet.jakarta-servlet-api>5.0.0</version.jakarta.servlet.jakarta-servlet-api>
         <version.jakarta.websocket.jakarta-websocket-api>2.0.0</version.jakarta.websocket.jakarta-websocket-api>
-        <version.org.wildfly.extras.batavia>1.0.11.Final</version.org.wildfly.extras.batavia>
+        <version.org.wildfly.extras.batavia>1.0.13.Final</version.org.wildfly.extras.batavia>
         <version.junit>4.13</version.junit>
         <version.netty>4.1.50.Final</version.netty>
         <version.org.apache.directory.server>2.0.0-M15</version.org.apache.directory.server>


=====================================
servlet/pom.xml
=====================================
@@ -25,12 +25,12 @@
     <parent>
         <groupId>io.undertow</groupId>
         <artifactId>undertow-parent</artifactId>
-        <version>2.2.16.Final</version>
+        <version>2.2.17.Final</version>
     </parent>
 
     <groupId>io.undertow</groupId>
     <artifactId>undertow-servlet</artifactId>
-    <version>2.2.16.Final</version>
+    <version>2.2.17.Final</version>
 
     <name>Undertow Servlet</name>
 


=====================================
servlet/src/main/java/io/undertow/servlet/spec/ServletInputStreamImpl.java
=====================================
@@ -28,7 +28,6 @@ import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
 import javax.servlet.ReadListener;
 import javax.servlet.ServletInputStream;
 
-import org.xnio.Buffers;
 import org.xnio.ChannelListener;
 import org.xnio.IoUtils;
 import org.xnio.channels.Channels;
@@ -183,7 +182,8 @@ public class ServletInputStreamImpl extends ServletInputStream {
             return 0;
         }
         ByteBuffer buffer = pooled.getBuffer();
-        int copied = Buffers.copy(ByteBuffer.wrap(b, off, len), buffer);
+        int copied = Math.min(buffer.remaining(), len);
+        buffer.get(b, off, copied);
         if (!buffer.hasRemaining()) {
             pooled.close();
             pooled = null;


=====================================
servlet/src/main/java/io/undertow/servlet/spec/UpgradeServletInputStream.java
=====================================
@@ -19,7 +19,6 @@
 package io.undertow.servlet.spec;
 
 import io.undertow.servlet.UndertowServletMessages;
-import org.xnio.Buffers;
 import org.xnio.ChannelListener;
 import org.xnio.IoUtils;
 import io.undertow.connector.ByteBufferPool;
@@ -132,7 +131,8 @@ public class UpgradeServletInputStream extends ServletInputStream {
             return 0;
         }
         ByteBuffer buffer = pooled.getBuffer();
-        int copied = Buffers.copy(ByteBuffer.wrap(b, off, len), buffer);
+        int copied = Math.min(buffer.remaining(), len);
+        buffer.get(b, off, copied);
         if (!buffer.hasRemaining()) {
             pooled.close();
             pooled = null;


=====================================
websockets-jsr/pom.xml
=====================================
@@ -25,12 +25,12 @@
     <parent>
         <groupId>io.undertow</groupId>
         <artifactId>undertow-parent</artifactId>
-        <version>2.2.16.Final</version>
+        <version>2.2.17.Final</version>
     </parent>
 
     <groupId>io.undertow</groupId>
     <artifactId>undertow-websockets-jsr</artifactId>
-    <version>2.2.16.Final</version>
+    <version>2.2.17.Final</version>
 
     <name>Undertow WebSockets JSR356 implementations</name>
 



View it on GitLab: https://salsa.debian.org/java-team/undertow/-/compare/f1b5341d359c59c9dabd265223db95e08dc4bdac...9e569a803b8d5a875fd1e7613e8d37613c81c0ac

-- 
View it on GitLab: https://salsa.debian.org/java-team/undertow/-/compare/f1b5341d359c59c9dabd265223db95e08dc4bdac...9e569a803b8d5a875fd1e7613e8d37613c81c0ac
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-java-commits/attachments/20220430/18b553e0/attachment.htm>


More information about the pkg-java-commits mailing list