[Git][java-team/undertow][upstream] New upstream version 2.2.20

Markus Koschany (@apo) gitlab at salsa.debian.org
Thu Oct 13 22:58:17 BST 2022



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


Commits:
d1d653ee by Markus Koschany at 2022-10-13T23:43:46+02:00
New upstream version 2.2.20
- - - - -


21 changed files:

- benchmarks/pom.xml
- core/pom.xml
- core/src/main/java/io/undertow/conduits/ChunkedStreamSinkConduit.java
- core/src/main/java/io/undertow/io/UndertowOutputStream.java
- core/src/main/java/io/undertow/server/SSLSessionInfo.java
- core/src/main/java/io/undertow/server/session/InMemorySessionManager.java
- core/src/test/java/io/undertow/server/handlers/ChunkedResponseTransferCodingTestCase.java
- core/src/test/java/io/undertow/server/handlers/file/FileHandlerTestCase.java
- coverage-report/pom.xml
- 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/ServletOutputStreamImpl.java
- websockets-jsr/pom.xml


Changes:

=====================================
benchmarks/pom.xml
=====================================
@@ -25,11 +25,11 @@
     <parent>
         <groupId>io.undertow</groupId>
         <artifactId>undertow-parent</artifactId>
-        <version>2.2.19.Final</version>
+        <version>2.2.20.Final</version>
     </parent>
 
     <artifactId>undertow-benchmarks</artifactId>
-    <version>2.2.19.Final</version>
+    <version>2.2.20.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.19.Final</version>
+        <version>2.2.20.Final</version>
     </parent>
 
     <groupId>io.undertow</groupId>
     <artifactId>undertow-core</artifactId>
-    <version>2.2.19.Final</version>
+    <version>2.2.20.Final</version>
 
     <name>Undertow Core</name>
 


=====================================
core/src/main/java/io/undertow/conduits/ChunkedStreamSinkConduit.java
=====================================
@@ -214,9 +214,10 @@ public class ChunkedStreamSinkConduit extends AbstractStreamSinkConduit<StreamSi
 
     @Override
     public long write(final ByteBuffer[] srcs, final int offset, final int length) throws IOException {
-        for (int i = offset; i < length; ++i) {
-            if (srcs[i].hasRemaining()) {
-                return write(srcs[i]);
+        for (int i = 0; i < length; i++) {
+            ByteBuffer srcBuffer = srcs[offset + i];
+            if (srcBuffer.hasRemaining()) {
+                return write(srcBuffer);
             }
         }
         return 0;


=====================================
core/src/main/java/io/undertow/io/UndertowOutputStream.java
=====================================
@@ -291,12 +291,8 @@ public class UndertowOutputStream extends OutputStream implements BufferWritable
         buffer.flip();
 
         while (buffer.hasRemaining()) {
-            if(writeFinal) {
-                channel.writeFinal(buffer);
-            } else {
-                channel.write(buffer);
-            }
-            if(buffer.hasRemaining()) {
+            int result = writeFinal ? channel.writeFinal(buffer) : channel.write(buffer);
+            if (result == 0) {
                 channel.awaitWritable();
             }
         }


=====================================
core/src/main/java/io/undertow/server/SSLSessionInfo.java
=====================================
@@ -35,7 +35,10 @@ public interface SSLSessionInfo {
      * cipher key strength. i.e. How much entropy material is in the key material being fed into the
      * encryption routines.
      * <p>
-     * http://www.thesprawl.org/research/tls-and-ssl-cipher-suites/
+     * TLS 1.3 https://wiki.openssl.org/index.php/TLS1.3
+     * </p>
+     * <p>
+     * https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#tls-parameters-4
      * </p>
      *
      * @param cipherSuite String name of the TLS cipher suite.
@@ -45,24 +48,32 @@ public interface SSLSessionInfo {
         // Roughly ordered from most common to least common.
         if (cipherSuite == null) {
             return 0;
-        } else if (cipherSuite.contains("WITH_AES_256_")) {
+        //  TLS 1.3: https://wiki.openssl.org/index.php/TLS1.3
+        } else if(cipherSuite.equals("TLS_AES_256_GCM_SHA384")) {
+                return 256;
+        } else if(cipherSuite.equals("TLS_CHACHA20_POLY1305_SHA256")) {
             return 256;
-        } else if (cipherSuite.contains("WITH_RC4_128_")) {
+        } else if(cipherSuite.startsWith("TLS_AES_128_")) {
             return 128;
+        //  TLS <1.3
         } else if (cipherSuite.contains("WITH_AES_128_")) {
             return 128;
-        } else if (cipherSuite.contains("WITH_RC4_40_")) {
-            return 40;
+        } else if (cipherSuite.contains("WITH_AES_256_")) {
+            return 256;
         } else if (cipherSuite.contains("WITH_3DES_EDE_CBC_")) {
             return 168;
+        } else if (cipherSuite.contains("WITH_RC4_128_")) {
+            return 128;
+        } else if (cipherSuite.contains("WITH_DES_CBC_")) {
+            return 56;
+        } else if (cipherSuite.contains("WITH_DES40_CBC_")) {
+            return 40;
+        } else if (cipherSuite.contains("WITH_RC4_40_")) {
+            return 40;
         } else if (cipherSuite.contains("WITH_IDEA_CBC_")) {
             return 128;
         } else if (cipherSuite.contains("WITH_RC2_CBC_40_")) {
             return 40;
-        } else if (cipherSuite.contains("WITH_DES40_CBC_")) {
-            return 40;
-        } else if (cipherSuite.contains("WITH_DES_CBC_")) {
-            return 56;
         } else {
             return 0;
         }


=====================================
core/src/main/java/io/undertow/server/session/InMemorySessionManager.java
=====================================
@@ -229,6 +229,8 @@ public class InMemorySessionManager implements SessionManager, SessionManagerSta
             if(newSession != null) {
                 return newSession;
             }
+        } else {
+            return null;
         }
         String sessionId = config.findSessionId(serverExchange);
         InMemorySessionManager.SessionImpl session = (SessionImpl) getSession(sessionId);
@@ -640,17 +642,21 @@ public class InMemorySessionManager implements SessionManager, SessionManagerSta
 
         @Override
         public String changeSessionId(final HttpServerExchange exchange, final SessionConfig config) {
-            final String oldId = sessionId;
-            String newId = sessionManager.createAndSaveNewID(this);
-            this.sessionId = newId;
-            if(!invalid) {
-                config.setSessionId(exchange, this.getId());
+            synchronized(SessionImpl.this) {
+                if (invalidationStarted) {
+                    return null;
+                } else {
+                    final String oldId = sessionId;
+                    String newId = sessionManager.createAndSaveNewID(this);
+                    this.sessionId = newId;
+                    config.setSessionId(exchange, this.getId());
+                    sessionManager.sessions.remove(oldId);
+                    sessionManager.sessionListeners.sessionIdChanged(this, oldId);
+                    UndertowLogger.SESSION_LOGGER.debugf("Changing session id %s to %s", oldId, newId);
+
+                    return newId;
+                }
             }
-            sessionManager.sessions.remove(oldId);
-            sessionManager.sessionListeners.sessionIdChanged(this, oldId);
-            UndertowLogger.SESSION_LOGGER.debugf("Changing session id %s to %s", oldId, newId);
-
-            return newId;
         }
 
         private synchronized void destroy() {


=====================================
core/src/test/java/io/undertow/server/handlers/ChunkedResponseTransferCodingTestCase.java
=====================================
@@ -18,6 +18,7 @@
 
 package io.undertow.server.handlers;
 
+import io.undertow.Handlers;
 import io.undertow.server.HttpHandler;
 import io.undertow.server.HttpServerExchange;
 import io.undertow.server.ServerConnection;
@@ -33,9 +34,13 @@ import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.runner.RunWith;
+import org.xnio.channels.Channels;
+import org.xnio.channels.StreamSinkChannel;
 
 import java.io.IOException;
 import java.io.OutputStream;
+import java.nio.ByteBuffer;
+import java.nio.charset.StandardCharsets;
 
 /**
  * @author Stuart Douglas
@@ -58,7 +63,7 @@ public class ChunkedResponseTransferCodingTestCase {
     public static void setup() {
         final BlockingHandler blockingHandler = new BlockingHandler();
         DefaultServer.setRootHandler(blockingHandler);
-        blockingHandler.setRootHandler(new HttpHandler() {
+        blockingHandler.setRootHandler(Handlers.path().addExactPath("/path", new HttpHandler() {
             @Override
             public void handleRequest(final HttpServerExchange exchange) {
                 try {
@@ -75,7 +80,35 @@ public class ChunkedResponseTransferCodingTestCase {
                     throw new RuntimeException(e);
                 }
             }
-        });
+        })
+                .addExactPath("/buffers", new BlockingHandler(new HttpHandler() {
+                    @Override
+                    public void handleRequest(HttpServerExchange exchange) throws Exception {
+                        ByteBuffer[] buffers = new ByteBuffer[] {
+                                ByteBuffer.wrap("prefix".getBytes(StandardCharsets.UTF_8)),
+                                ByteBuffer.wrap("hello, ".getBytes(StandardCharsets.UTF_8)),
+                                ByteBuffer.wrap("world".getBytes(StandardCharsets.UTF_8)),
+                                ByteBuffer.wrap("suffix".getBytes(StandardCharsets.UTF_8))
+                        };
+                        StreamSinkChannel channel = exchange.getResponseChannel();
+                        Channels.writeBlocking(channel, buffers, 1, 2);
+                        channel.shutdownWrites();
+                        Channels.flushBlocking(channel);
+                    }
+                })));
+    }
+
+    @Test
+    public void testMultiBufferWrite() throws IOException {
+        HttpGet get = new HttpGet(DefaultServer.getDefaultServerURL() + "/buffers");
+        TestHttpClient client = new TestHttpClient();
+        try {
+            HttpResponse result = client.execute(get);
+            Assert.assertEquals(StatusCodes.OK, result.getStatusLine().getStatusCode());
+            Assert.assertEquals("hello, world", HttpClientUtils.readResponse(result));
+        } finally {
+            client.getConnectionManager().shutdown();
+        }
     }
 
     @Test
@@ -103,7 +136,6 @@ public class ChunkedResponseTransferCodingTestCase {
         }
     }
 
-
     private static void generateMessage(int repetitions) {
         final StringBuilder builder = new StringBuilder(repetitions * MESSAGE.length());
         for (int i = 0; i < repetitions; ++i) {


=====================================
core/src/test/java/io/undertow/server/handlers/file/FileHandlerTestCase.java
=====================================
@@ -149,7 +149,7 @@ public class FileHandlerTestCase {
         for(int i = 0; i < 100000; ++i) {
             message.append("Hello World");
         }
-        Path large = Files.createTempFile(null, ".txt");
+        Path large = Files.createTempFile(tmp, null, ".txt");
         try {
             Files.copy(new ByteArrayInputStream(message.toString().getBytes(StandardCharsets.UTF_8)), large, StandardCopyOption.REPLACE_EXISTING);
             DefaultServer.setRootHandler(new CanonicalPathHandler()


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


=====================================
dist/pom.xml
=====================================
@@ -25,12 +25,12 @@
     <parent>
         <groupId>io.undertow</groupId>
         <artifactId>undertow-parent</artifactId>
-        <version>2.2.19.Final</version>
+        <version>2.2.20.Final</version>
     </parent>
 
     <groupId>io.undertow</groupId>
     <artifactId>undertow-dist</artifactId>
-    <version>2.2.19.Final</version>
+    <version>2.2.20.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.19.Final</version>
+        <version>2.2.20.Final</version>
     </parent>
 
     <groupId>io.undertow</groupId>
     <artifactId>undertow-examples</artifactId>
-    <version>2.2.19.Final</version>
+    <version>2.2.20.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.19.Final</version>
+        <version>2.2.20.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.19.Final</version>
+        <version>2.2.20.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.19.Final</version>
+        <version>2.2.20.Final</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
     <artifactId>undertow-servlet-jakarta</artifactId>
-    <version>2.2.19.Final</version>
+    <version>2.2.20.Final</version>
     <name>Undertow Servlet - Jakarta Variant</name>
 
     <properties>


=====================================
jakarta/websockets-jsr/pom.xml
=====================================
@@ -24,7 +24,7 @@
     <parent>
         <groupId>io.undertow</groupId>
         <artifactId>undertow-parent-jakarta</artifactId>
-        <version>2.2.19.Final</version>
+        <version>2.2.20.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.19.Final</version>
+        <version>2.2.20.Final</version>
     </parent>
 
     <groupId>io.undertow</groupId>
     <artifactId>karaf</artifactId>
-    <version>2.2.19.Final</version>
+    <version>2.2.20.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.19.Final</version>
+        <version>2.2.20.Final</version>
     </parent>
 
     <groupId>io.undertow</groupId>
     <artifactId>undertow-parser-generator</artifactId>
-    <version>2.2.19.Final</version>
+    <version>2.2.20.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.19.Final</version>
+    <version>2.2.20.Final</version>
 
     <name>Undertow</name>
     <description>Undertow</description>


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


=====================================
servlet/src/main/java/io/undertow/servlet/spec/ServletOutputStreamImpl.java
=====================================
@@ -579,12 +579,8 @@ public class ServletOutputStreamImpl extends ServletOutputStream implements Buff
         }
         buffer.flip();
         while (buffer.hasRemaining()) {
-            if (writeFinal) {
-                channel.writeFinal(buffer);
-            } else {
-                channel.write(buffer);
-            }
-            if (buffer.hasRemaining()) {
+            int result = writeFinal ? channel.writeFinal(buffer) : channel.write(buffer);
+            if (result == 0) {
                 channel.awaitWritable();
             }
         }


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



View it on GitLab: https://salsa.debian.org/java-team/undertow/-/commit/d1d653eed1e98df56354153f66f0cf42091f114e

-- 
View it on GitLab: https://salsa.debian.org/java-team/undertow/-/commit/d1d653eed1e98df56354153f66f0cf42091f114e
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/20221013/faa93a0f/attachment.htm>


More information about the pkg-java-commits mailing list