From 5d6bd6f888a32c260b5e7a9e4ea7d6927859e63985dd82b8ad1da1809ebb38b0 Mon Sep 17 00:00:00 2001 From: Fridrich Strba Date: Wed, 29 Jan 2020 16:51:19 +0000 Subject: [PATCH] OBS-URL: https://build.opensuse.org/package/show/Java:packages/tomcat?expand=0&rev=188 --- tomcat-9.0.30-java8compat.patch | 855 ++++++++++++++++++-------------- tomcat.changes | 7 + 2 files changed, 499 insertions(+), 363 deletions(-) diff --git a/tomcat-9.0.30-java8compat.patch b/tomcat-9.0.30-java8compat.patch index 5ace0e9..82c627c 100644 --- a/tomcat-9.0.30-java8compat.patch +++ b/tomcat-9.0.30-java8compat.patch @@ -1,6 +1,8 @@ ---- apache-tomcat-9.0.30-src/java/org/apache/catalina/connector/InputBuffer.java 2019-12-07 17:52:30.000000000 +0100 -+++ apache-tomcat-9.0.30-src/java/org/apache/catalina/connector/InputBuffer.java 2020-01-20 14:01:46.983405048 +0100 -@@ -389,10 +389,10 @@ +Index: apache-tomcat-9.0.30-src/java/org/apache/catalina/connector/InputBuffer.java +=================================================================== +--- apache-tomcat-9.0.30-src.orig/java/org/apache/catalina/connector/InputBuffer.java ++++ apache-tomcat-9.0.30-src/java/org/apache/catalina/connector/InputBuffer.java +@@ -389,10 +389,10 @@ public class InputBuffer extends Reader } int n = Math.min(to.remaining(), bb.remaining()); int orgLimit = bb.limit(); @@ -14,7 +16,7 @@ return n; } -@@ -488,11 +488,11 @@ +@@ -488,11 +488,11 @@ public class InputBuffer extends Reader long nRead = 0; while (nRead < n) { if (cb.remaining() >= n) { @@ -28,7 +30,7 @@ int nb = realReadChars(); if (nb < 0) { break; -@@ -533,7 +533,7 @@ +@@ -533,7 +533,7 @@ public class InputBuffer extends Reader } else { if ((cb.capacity() > (2 * size)) && (cb.remaining()) < (cb.position())) { cb.compact(); @@ -37,7 +39,7 @@ } } readLimit = cb.position() + readAheadLimit + size; -@@ -554,7 +554,7 @@ +@@ -554,7 +554,7 @@ public class InputBuffer extends Reader markPos = -1; throw new IOException(); } else { @@ -46,7 +48,7 @@ } } else { clear(bb); -@@ -672,10 +672,10 @@ +@@ -672,10 +672,10 @@ public class InputBuffer extends Reader CharBuffer tmp = CharBuffer.allocate(newSize); int oldPosition = cb.position(); @@ -60,9 +62,11 @@ cb = tmp; tmp = null; } ---- apache-tomcat-9.0.30-src/java/org/apache/catalina/connector/OutputBuffer.java 2019-12-07 17:52:30.000000000 +0100 -+++ apache-tomcat-9.0.30-src/java/org/apache/catalina/connector/OutputBuffer.java 2020-01-20 13:54:26.564972948 +0100 -@@ -761,10 +761,10 @@ +Index: apache-tomcat-9.0.30-src/java/org/apache/catalina/connector/OutputBuffer.java +=================================================================== +--- apache-tomcat-9.0.30-src.orig/java/org/apache/catalina/connector/OutputBuffer.java ++++ apache-tomcat-9.0.30-src/java/org/apache/catalina/connector/OutputBuffer.java +@@ -761,10 +761,10 @@ public class OutputBuffer extends Writer int limit = bb.capacity(); int fromLimit = from.limit(); while (from.remaining() >= limit) { @@ -76,8 +80,10 @@ } if (from.remaining() > 0) { ---- apache-tomcat-9.0.30-src/java/org/apache/catalina/tribes/transport/nio/NioReplicationTask.java 2019-12-07 17:52:42.000000000 +0100 -+++ apache-tomcat-9.0.30-src/java/org/apache/catalina/tribes/transport/nio/NioReplicationTask.java 2020-01-20 14:05:12.048537486 +0100 +Index: apache-tomcat-9.0.30-src/java/org/apache/catalina/tribes/transport/nio/NioReplicationTask.java +=================================================================== +--- apache-tomcat-9.0.30-src.orig/java/org/apache/catalina/tribes/transport/nio/NioReplicationTask.java ++++ apache-tomcat-9.0.30-src/java/org/apache/catalina/tribes/transport/nio/NioReplicationTask.java @@ -18,6 +18,7 @@ package org.apache.catalina.tribes.transport.nio; import java.io.IOException; @@ -86,7 +92,7 @@ import java.nio.ByteBuffer; import java.nio.channels.CancelledKeyException; import java.nio.channels.DatagramChannel; -@@ -80,7 +81,7 @@ +@@ -80,7 +81,7 @@ public class NioReplicationTask extends buffer = ByteBuffer.allocate(size); } } else { @@ -95,7 +101,7 @@ } if (key == null) { return; // just in case -@@ -156,30 +157,30 @@ +@@ -156,30 +157,30 @@ public class NioReplicationTask extends reader.access(); ReadableByteChannel channel = (ReadableByteChannel) key.channel(); int count=-1; @@ -131,9 +137,11 @@ //did we get a package count = reader.hasPackage()?1:-1; } ---- apache-tomcat-9.0.30-src/java/org/apache/catalina/tribes/transport/nio/NioSender.java 2019-12-07 17:52:42.000000000 +0100 -+++ apache-tomcat-9.0.30-src/java/org/apache/catalina/tribes/transport/nio/NioSender.java 2020-01-20 14:08:33.229645500 +0100 -@@ -20,6 +20,7 @@ +Index: apache-tomcat-9.0.30-src/java/org/apache/catalina/tribes/transport/nio/NioSender.java +=================================================================== +--- apache-tomcat-9.0.30-src.orig/java/org/apache/catalina/tribes/transport/nio/NioSender.java ++++ apache-tomcat-9.0.30-src/java/org/apache/catalina/tribes/transport/nio/NioSender.java +@@ -20,6 +20,7 @@ package org.apache.catalina.tribes.trans import java.io.EOFException; import java.io.IOException; import java.net.InetSocketAddress; @@ -141,7 +149,7 @@ import java.nio.ByteBuffer; import java.nio.channels.DatagramChannel; import java.nio.channels.SelectionKey; -@@ -173,9 +174,9 @@ +@@ -173,9 +174,9 @@ public class NioSender extends AbstractS if ( read == -1 ) throw new IOException(sm.getString("nioSender.unable.receive.ack")); //no data read else if ( read == 0 ) return false; @@ -153,7 +161,7 @@ if (ackbuf.doesPackageExist() ) { byte[] ackcmd = ackbuf.extractDataPackage(true).getBytes(); boolean ack = Arrays.equals(ackcmd,org.apache.catalina.tribes.transport.Constants.ACK_DATA); -@@ -225,12 +226,12 @@ +@@ -225,12 +226,12 @@ public class NioSender extends AbstractS if ( readbuf == null ) { readbuf = getReadBuffer(); } else { @@ -168,7 +176,7 @@ } if (isUdpBased()) { -@@ -317,8 +318,8 @@ +@@ -317,8 +318,8 @@ public class NioSender extends AbstractS if ( isConnected() && readbuf == null) { readbuf = getReadBuffer(); } @@ -179,7 +187,7 @@ current = null; ackbuf.clear(); remaining = 0; -@@ -357,7 +358,7 @@ +@@ -357,7 +358,7 @@ public class NioSender extends AbstractS remaining = length; ackbuf.clear(); if (writebuf != null) { @@ -188,7 +196,7 @@ } else { writebuf = getBuffer(length); } -@@ -367,7 +368,7 @@ +@@ -367,7 +368,7 @@ public class NioSender extends AbstractS // TODO use ByteBuffer.wrap to avoid copying the data. writebuf.put(data,offset,length); @@ -197,9 +205,11 @@ if (isConnected()) { if (isUdpBased()) dataChannel.register(getSelector(), SelectionKey.OP_WRITE, this); ---- apache-tomcat-9.0.30-src/java/org/apache/coyote/ajp/AjpProcessor.java 2019-12-07 17:52:46.000000000 +0100 -+++ apache-tomcat-9.0.30-src/java/org/apache/coyote/ajp/AjpProcessor.java 2020-01-20 09:39:10.630366487 +0100 -@@ -21,6 +21,7 @@ +Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/ajp/AjpProcessor.java +=================================================================== +--- apache-tomcat-9.0.30-src.orig/java/org/apache/coyote/ajp/AjpProcessor.java ++++ apache-tomcat-9.0.30-src/java/org/apache/coyote/ajp/AjpProcessor.java +@@ -21,6 +21,7 @@ import java.io.EOFException; import java.io.IOException; import java.io.InterruptedIOException; import java.net.InetAddress; @@ -207,7 +217,7 @@ import java.nio.ByteBuffer; import java.security.NoSuchProviderException; import java.security.cert.CertificateFactory; -@@ -1206,7 +1207,7 @@ +@@ -1206,7 +1207,7 @@ public class AjpProcessor extends Abstra responseMessage.reset(); responseMessage.appendByte(Constants.JK_AJP13_SEND_BODY_CHUNK); @@ -216,8 +226,10 @@ responseMessage.appendBytes(chunk); responseMessage.end(); socketWrapper.write(blocking, responseMessage.getBuffer(), 0, responseMessage.getLen()); ---- apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/filters/BufferedInputFilter.java 2019-12-07 17:52:46.000000000 +0100 -+++ apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/filters/BufferedInputFilter.java 2020-01-20 09:54:18.827537173 +0100 +Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/filters/BufferedInputFilter.java +=================================================================== +--- apache-tomcat-9.0.30-src.orig/java/org/apache/coyote/http11/filters/BufferedInputFilter.java ++++ apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/filters/BufferedInputFilter.java @@ -18,6 +18,7 @@ package org.apache.coyote.http11.filters; @@ -226,7 +238,7 @@ import java.nio.BufferOverflowException; import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; -@@ -68,7 +69,7 @@ +@@ -68,7 +69,7 @@ public class BufferedInputFilter impleme public void setLimit(int limit) { if (buffered == null) { buffered = ByteBuffer.allocate(limit); @@ -235,7 +247,7 @@ } } -@@ -84,9 +85,9 @@ +@@ -84,9 +85,9 @@ public class BufferedInputFilter impleme // save off the Request body try { while (buffer.doRead(this) >= 0) { @@ -247,7 +259,7 @@ tempRead = null; } } catch(IOException | BufferOverflowException ioe) { -@@ -121,7 +122,7 @@ +@@ -121,7 +122,7 @@ public class BufferedInputFilter impleme if (buffered.capacity() > 65536) { buffered = null; } else { @@ -256,9 +268,11 @@ } } hasRead = false; ---- apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/filters/ChunkedInputFilter.java 2019-12-07 17:52:46.000000000 +0100 -+++ apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/filters/ChunkedInputFilter.java 2020-01-20 09:59:45.021458791 +0100 -@@ -18,6 +18,7 @@ +Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/filters/ChunkedInputFilter.java +=================================================================== +--- apache-tomcat-9.0.30-src.orig/java/org/apache/coyote/http11/filters/ChunkedInputFilter.java ++++ apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/filters/ChunkedInputFilter.java +@@ -18,6 +18,7 @@ package org.apache.coyote.http11.filters import java.io.EOFException; import java.io.IOException; @@ -266,7 +280,7 @@ import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.util.Locale; -@@ -184,14 +185,14 @@ +@@ -184,14 +185,14 @@ public class ChunkedInputFilter implemen if (readChunk != handler.getByteBuffer()) { handler.setByteBuffer(readChunk.duplicate()); } @@ -283,7 +297,7 @@ remaining = 0; //we need a CRLF if ((readChunk.position() + 1) >= readChunk.limit()) { -@@ -263,7 +264,7 @@ +@@ -263,7 +264,7 @@ public class ChunkedInputFilter implemen public void recycle() { remaining = 0; if (readChunk != null) { @@ -292,7 +306,7 @@ } endChunk = false; needCRLFParse = false; -@@ -363,7 +364,7 @@ +@@ -363,7 +364,7 @@ public class ChunkedInputFilter implemen // Parsing the CRLF increments pos if (!eol) { @@ -301,7 +315,7 @@ } } -@@ -415,7 +416,7 @@ +@@ -415,7 +416,7 @@ public class ChunkedInputFilter implemen throwIOException(sm.getString("chunkedInputFilter.invalidCrlf")); } @@ -310,7 +324,7 @@ } } -@@ -484,7 +485,7 @@ +@@ -484,7 +485,7 @@ public class ChunkedInputFilter implemen trailingHeaders.append(chr); } @@ -319,7 +333,7 @@ } int colonPos = trailingHeaders.getEnd(); -@@ -513,7 +514,7 @@ +@@ -513,7 +514,7 @@ public class ChunkedInputFilter implemen chr = readChunk.get(readChunk.position()); if ((chr == Constants.SP) || (chr == Constants.HT)) { @@ -328,7 +342,7 @@ // If we swallow whitespace, make sure it counts towards the // limit placed on trailing header size int newlimit = trailingHeaders.getLimit() -1; -@@ -549,7 +550,7 @@ +@@ -549,7 +550,7 @@ public class ChunkedInputFilter implemen } if (!eol) { @@ -337,9 +351,11 @@ } } ---- apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/filters/ChunkedOutputFilter.java 2019-12-07 17:52:46.000000000 +0100 -+++ apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/filters/ChunkedOutputFilter.java 2020-01-20 10:07:29.012140554 +0100 -@@ -18,6 +18,7 @@ +Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/filters/ChunkedOutputFilter.java +=================================================================== +--- apache-tomcat-9.0.30-src.orig/java/org/apache/coyote/http11/filters/ChunkedOutputFilter.java ++++ apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/filters/ChunkedOutputFilter.java +@@ -18,6 +18,7 @@ package org.apache.coyote.http11.filters import java.io.IOException; import java.io.OutputStreamWriter; @@ -347,7 +363,7 @@ import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.util.HashSet; -@@ -106,12 +107,12 @@ +@@ -106,12 +107,12 @@ public class ChunkedOutputFilter impleme int pos = calculateChunkHeader(result); @@ -362,7 +378,7 @@ buffer.doWrite(chunkHeader); return result; -@@ -171,10 +172,10 @@ +@@ -171,10 +172,10 @@ public class ChunkedOutputFilter impleme if (trailerFields == null) { // Write end chunk buffer.doWrite(endChunk); @@ -375,7 +391,7 @@ ByteArrayOutputStream baos = new ByteArrayOutputStream(1024); OutputStreamWriter osw = new OutputStreamWriter(baos, StandardCharsets.ISO_8859_1); -@@ -194,7 +195,7 @@ +@@ -194,7 +195,7 @@ public class ChunkedOutputFilter impleme buffer.doWrite(ByteBuffer.wrap(baos.toByteArray())); buffer.doWrite(crlfChunk); @@ -384,8 +400,10 @@ } buffer.end(); } ---- apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/filters/IdentityInputFilter.java 2019-12-07 17:52:46.000000000 +0100 -+++ apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/filters/IdentityInputFilter.java 2020-01-20 14:21:50.366034773 +0100 +Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/filters/IdentityInputFilter.java +=================================================================== +--- apache-tomcat-9.0.30-src.orig/java/org/apache/coyote/http11/filters/IdentityInputFilter.java ++++ apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/filters/IdentityInputFilter.java @@ -18,6 +18,7 @@ package org.apache.coyote.http11.filters; @@ -394,7 +412,7 @@ import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; -@@ -104,7 +105,7 @@ +@@ -104,7 +105,7 @@ public class IdentityInputFilter impleme // The chunk is longer than the number of bytes remaining // in the body; changing the chunk length to the number // of bytes remaining @@ -403,7 +421,7 @@ result = (int) remaining; } else { result = nRead; -@@ -116,7 +117,7 @@ +@@ -116,7 +117,7 @@ public class IdentityInputFilter impleme // No more bytes left to be read : return -1 and clear the // buffer if (handler.getByteBuffer() != null) { @@ -412,8 +430,10 @@ } result = -1; } ---- apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/filters/IdentityOutputFilter.java 2019-12-07 17:52:46.000000000 +0100 -+++ apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/filters/IdentityOutputFilter.java 2020-01-20 14:22:41.150314386 +0100 +Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/filters/IdentityOutputFilter.java +=================================================================== +--- apache-tomcat-9.0.30-src.orig/java/org/apache/coyote/http11/filters/IdentityOutputFilter.java ++++ apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/filters/IdentityOutputFilter.java @@ -17,6 +17,7 @@ package org.apache.coyote.http11.filters; @@ -422,7 +442,7 @@ import java.nio.ByteBuffer; import org.apache.coyote.Response; -@@ -64,7 +65,7 @@ +@@ -64,7 +65,7 @@ public class IdentityOutputFilter implem // The chunk is longer than the number of bytes remaining // in the body; changing the chunk length to the number // of bytes remaining @@ -431,7 +451,7 @@ result = (int) remaining; remaining = 0; } else { -@@ -74,8 +75,8 @@ +@@ -74,8 +75,8 @@ public class IdentityOutputFilter implem } else { // No more bytes left to be written : return -1 and clear the // buffer @@ -442,8 +462,10 @@ result = -1; } } else { ---- apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/filters/SavedRequestInputFilter.java 2019-12-07 17:52:47.000000000 +0100 -+++ apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/filters/SavedRequestInputFilter.java 2020-01-20 09:56:16.700231571 +0100 +Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/filters/SavedRequestInputFilter.java +=================================================================== +--- apache-tomcat-9.0.30-src.orig/java/org/apache/coyote/http11/filters/SavedRequestInputFilter.java ++++ apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/filters/SavedRequestInputFilter.java @@ -18,6 +18,7 @@ package org.apache.coyote.http11.filters; @@ -452,7 +474,7 @@ import java.nio.ByteBuffer; import org.apache.coyote.InputBuffer; -@@ -51,7 +52,7 @@ +@@ -51,7 +52,7 @@ public class SavedRequestInputFilter imp return -1; ByteBuffer byteBuffer = handler.getByteBuffer(); @@ -461,9 +483,11 @@ input.subtract(byteBuffer); return byteBuffer.remaining(); ---- apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/Http11InputBuffer.java 2019-12-07 17:52:46.000000000 +0100 -+++ apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/Http11InputBuffer.java 2020-01-20 09:49:05.393690611 +0100 -@@ -18,6 +18,7 @@ +Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/Http11InputBuffer.java +=================================================================== +--- apache-tomcat-9.0.30-src.orig/java/org/apache/coyote/http11/Http11InputBuffer.java ++++ apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/Http11InputBuffer.java +@@ -18,6 +18,7 @@ package org.apache.coyote.http11; import java.io.EOFException; import java.io.IOException; @@ -471,7 +495,7 @@ import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.util.Arrays; -@@ -262,7 +263,7 @@ +@@ -262,7 +263,7 @@ public class Http11InputBuffer implement activeFilters[i].recycle(); } @@ -480,7 +504,7 @@ lastActiveFilter = -1; parsingHeader = true; swallowInput = true; -@@ -290,10 +291,10 @@ +@@ -290,10 +291,10 @@ public class Http11InputBuffer implement if (byteBuffer.remaining() > 0) { // Copy leftover bytes to the beginning of the buffer byteBuffer.compact(); @@ -493,7 +517,7 @@ } } -@@ -379,7 +380,7 @@ +@@ -379,7 +380,7 @@ public class Http11InputBuffer implement } chr = byteBuffer.get(); } while ((chr == Constants.CR) || (chr == Constants.LF)); @@ -502,7 +526,7 @@ parsingRequestLineStart = byteBuffer.position(); parsingRequestLinePhase = 2; -@@ -409,7 +410,7 @@ +@@ -409,7 +410,7 @@ public class Http11InputBuffer implement request.method().setBytes(byteBuffer.array(), parsingRequestLineStart, pos - parsingRequestLineStart); } else if (!HttpParser.isToken(chr)) { @@ -511,7 +535,7 @@ // Avoid unknown protocol triggering an additional error request.protocol().setString(Constants.HTTP_11); throw new IllegalArgumentException(sm.getString("iib.invalidmethod")); -@@ -429,7 +430,7 @@ +@@ -429,7 +430,7 @@ public class Http11InputBuffer implement byte chr = byteBuffer.get(); if (!(chr == Constants.SP || chr == Constants.HT)) { space = false; @@ -520,7 +544,7 @@ } } parsingRequestLineStart = byteBuffer.position(); -@@ -498,7 +499,7 @@ +@@ -498,7 +499,7 @@ public class Http11InputBuffer implement byte chr = byteBuffer.get(); if (!(chr == Constants.SP || chr == Constants.HT)) { space = false; @@ -529,7 +553,7 @@ } } parsingRequestLineStart = byteBuffer.position(); -@@ -598,7 +599,7 @@ +@@ -598,7 +599,7 @@ public class Http11InputBuffer implement if (swallowInput && (lastActiveFilter != -1)) { int extraBytes = (int) activeFilters[lastActiveFilter].end(); @@ -538,7 +562,7 @@ } } -@@ -696,7 +697,7 @@ +@@ -696,7 +697,7 @@ public class Http11InputBuffer implement wrapper.getSocketBufferHandler().getReadBuffer().capacity(); if (byteBuffer == null || byteBuffer.capacity() < bufLength) { byteBuffer = ByteBuffer.allocate(bufLength); @@ -547,7 +571,7 @@ } } -@@ -721,14 +722,14 @@ +@@ -721,14 +722,14 @@ public class Http11InputBuffer implement throw new IllegalArgumentException(sm.getString("iib.requestheadertoolarge.error")); } } else { @@ -566,7 +590,7 @@ SocketWrapperBase socketWrapper = this.wrapper; int nRead = -1; if (socketWrapper != null) { -@@ -736,7 +737,7 @@ +@@ -736,7 +737,7 @@ public class Http11InputBuffer implement } else { throw new CloseNowException(sm.getString("iib.eof.error")); } @@ -575,7 +599,7 @@ if (nRead > 0) { return true; } else if (nRead == -1) { -@@ -778,7 +779,7 @@ +@@ -778,7 +779,7 @@ public class Http11InputBuffer implement } else if (chr == Constants.LF) { return HeaderParseStatus.DONE; } else { @@ -584,7 +608,7 @@ break; } -@@ -820,7 +821,7 @@ +@@ -820,7 +821,7 @@ public class Http11InputBuffer implement // Non-token characters are illegal in header names // Parsing continues so the error can be reported in context headerData.lastSignificantChar = pos; @@ -593,7 +617,7 @@ // skipLine() will handle the error return skipLine(); } -@@ -858,7 +859,7 @@ +@@ -858,7 +859,7 @@ public class Http11InputBuffer implement chr = byteBuffer.get(); if (!(chr == Constants.SP || chr == Constants.HT)) { headerParsePos = HeaderParsePosition.HEADER_VALUE; @@ -602,7 +626,7 @@ break; } } -@@ -1073,7 +1074,7 @@ +@@ -1073,7 +1074,7 @@ public class Http11InputBuffer implement int length = byteBuffer.remaining(); handler.setByteBuffer(byteBuffer.duplicate()); @@ -611,7 +635,7 @@ return length; } -@@ -1095,12 +1096,12 @@ +@@ -1095,12 +1096,12 @@ public class Http11InputBuffer implement @Override public void expand(int size) { if (byteBuffer.capacity() >= size) { @@ -626,8 +650,10 @@ temp = null; } } ---- apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/Http11OutputBuffer.java 2019-12-07 17:52:46.000000000 +0100 -+++ apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/Http11OutputBuffer.java 2020-01-20 09:52:00.418721748 +0100 +Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/Http11OutputBuffer.java +=================================================================== +--- apache-tomcat-9.0.30-src.orig/java/org/apache/coyote/http11/Http11OutputBuffer.java ++++ apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/Http11OutputBuffer.java @@ -17,6 +17,7 @@ package org.apache.coyote.http11; @@ -636,7 +662,7 @@ import java.nio.ByteBuffer; import java.util.Arrays; -@@ -242,7 +243,7 @@ +@@ -242,7 +243,7 @@ public class Http11OutputBuffer implemen * headers so the error response can be written. */ void resetHeaderBuffer() { @@ -645,7 +671,7 @@ } -@@ -270,7 +271,7 @@ +@@ -270,7 +271,7 @@ public class Http11OutputBuffer implemen // Recycle response object response.recycle(); // Reset pointers @@ -654,7 +680,7 @@ lastActiveFilter = -1; responseFinished = false; byteCount = 0; -@@ -302,7 +303,7 @@ +@@ -302,7 +303,7 @@ public class Http11OutputBuffer implemen if (headerBuffer.position() > 0) { // Sending the response header buffer @@ -663,7 +689,7 @@ try { SocketWrapperBase socketWrapper = this.socketWrapper; if (socketWrapper != null) { -@@ -311,7 +312,7 @@ +@@ -311,7 +312,7 @@ public class Http11OutputBuffer implemen throw new CloseNowException(sm.getString("iob.failedwrite")); } } finally { @@ -672,8 +698,10 @@ } } } ---- apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/HpackDecoder.java 2019-12-07 17:52:47.000000000 +0100 -+++ apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/HpackDecoder.java 2020-01-20 09:18:03.823384895 +0100 +Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/HpackDecoder.java +=================================================================== +--- apache-tomcat-9.0.30-src.orig/java/org/apache/coyote/http2/HpackDecoder.java ++++ apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/HpackDecoder.java @@ -16,6 +16,7 @@ */ package org.apache.coyote.http2; @@ -682,7 +710,7 @@ import java.nio.ByteBuffer; import org.apache.tomcat.util.res.StringManager; -@@ -99,10 +100,10 @@ +@@ -99,10 +100,10 @@ public class HpackDecoder { byte b = buffer.get(); if ((b & 0b10000000) != 0) { //if the first bit is set it is an indexed header field @@ -695,7 +723,7 @@ return; } else if(index == 0) { throw new HpackException( -@@ -113,12 +114,12 @@ +@@ -113,12 +114,12 @@ public class HpackDecoder { //Literal Header Field with Incremental Indexing String headerName = readHeaderName(buffer, 6); if (headerName == null) { @@ -710,7 +738,7 @@ return; } emitHeader(headerName, headerValue); -@@ -127,12 +128,12 @@ +@@ -127,12 +128,12 @@ public class HpackDecoder { //Literal Header Field without Indexing String headerName = readHeaderName(buffer, 4); if (headerName == null) { @@ -725,7 +753,7 @@ return; } emitHeader(headerName, headerValue); -@@ -140,12 +141,12 @@ +@@ -140,12 +141,12 @@ public class HpackDecoder { //Literal Header Field never indexed String headerName = readHeaderName(buffer, 4); if (headerName == null) { @@ -740,7 +768,7 @@ return; } emitHeader(headerName, headerValue); -@@ -164,10 +165,10 @@ +@@ -164,10 +165,10 @@ public class HpackDecoder { if (headerCount != 0) { throw new HpackException(sm.getString("hpackdecoder.tableSizeUpdateNotAtStart")); } @@ -753,7 +781,7 @@ return false; } if (size > maxMemorySizeHard) { -@@ -197,7 +198,7 @@ +@@ -197,7 +198,7 @@ public class HpackDecoder { } private String readHeaderName(ByteBuffer buffer, int prefixLength) throws HpackException { @@ -762,8 +790,10 @@ int index = Hpack.decodeInteger(buffer, prefixLength); if (index == -1) { return null; ---- apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/HPackHuffman.java 2019-12-07 17:52:47.000000000 +0100 -+++ apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/HPackHuffman.java 2020-01-20 09:29:56.595310474 +0100 +Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/HPackHuffman.java +=================================================================== +--- apache-tomcat-9.0.30-src.orig/java/org/apache/coyote/http2/HPackHuffman.java ++++ apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/HPackHuffman.java @@ -16,6 +16,7 @@ */ package org.apache.coyote.http2; @@ -772,7 +802,7 @@ import java.nio.ByteBuffer; import java.util.Arrays; import java.util.HashSet; -@@ -483,7 +484,7 @@ +@@ -483,7 +484,7 @@ public class HPackHuffman { int rem = code.length; while (rem > 0) { if (!buffer.hasRemaining()) { @@ -781,7 +811,7 @@ return false; } int remainingInByte = 8 - bytePos; -@@ -504,7 +505,7 @@ +@@ -504,7 +505,7 @@ public class HPackHuffman { } if (bytePos == 8) { if (!buffer.hasRemaining()) { @@ -790,7 +820,7 @@ return false; } buffer.put(currentBufferByte); -@@ -514,14 +515,14 @@ +@@ -514,14 +515,14 @@ public class HPackHuffman { if (buffer.position() - start > toEncode.length()) { //the encoded version is longer than the original //just return false @@ -807,8 +837,10 @@ return false; } buffer.put((byte) (currentBufferByte | ((0xFF) >> bytePos))); ---- apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/Hpack.java 2019-12-07 17:52:47.000000000 +0100 -+++ apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/Hpack.java 2020-01-20 09:26:42.590241985 +0100 +Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/Hpack.java +=================================================================== +--- apache-tomcat-9.0.30-src.orig/java/org/apache/coyote/http2/Hpack.java ++++ apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/Hpack.java @@ -16,6 +16,7 @@ */ package org.apache.coyote.http2; @@ -817,7 +849,7 @@ import java.nio.ByteBuffer; import org.apache.tomcat.util.res.StringManager; -@@ -165,7 +166,7 @@ +@@ -165,7 +166,7 @@ final class Hpack { if (source.remaining() == 0) { //we have run out of data //reset @@ -826,8 +858,10 @@ return -1; } b = source.get(); ---- apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/Http2AsyncParser.java 2019-12-07 17:52:47.000000000 +0100 -+++ apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/Http2AsyncParser.java 2020-01-20 09:36:38.985530042 +0100 +Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/Http2AsyncParser.java +=================================================================== +--- apache-tomcat-9.0.30-src.orig/java/org/apache/coyote/http2/Http2AsyncParser.java ++++ apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/Http2AsyncParser.java @@ -17,6 +17,7 @@ package org.apache.coyote.http2; @@ -836,7 +870,7 @@ import java.nio.ByteBuffer; import java.nio.channels.CompletionHandler; import java.util.concurrent.TimeUnit; -@@ -103,7 +104,7 @@ +@@ -103,7 +104,7 @@ class Http2AsyncParser extends Http2Pars public void completed(Long result, Void attachment) { if (streamException || error == null) { ByteBuffer payload = buffers[2]; @@ -845,7 +879,7 @@ try { if (streamException) { swallow(streamId, payloadSize, false, payload); -@@ -232,7 +233,7 @@ +@@ -232,7 +233,7 @@ class Http2AsyncParser extends Http2Pars public void completed(Long result, Void attachment) { if (streamException || error == null) { ByteBuffer payload = buffers[1]; @@ -854,7 +888,7 @@ try { boolean continueParsing; do { -@@ -286,7 +287,7 @@ +@@ -286,7 +287,7 @@ class Http2AsyncParser extends Http2Pars if (payload.remaining() - 9 >= payloadSize) { continueParsing = true; // Now go over frame header @@ -863,8 +897,10 @@ try { validateFrame(null, frameType, streamId, flags, payloadSize); } catch (StreamException e) { ---- apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java 2019-12-07 17:52:47.000000000 +0100 -+++ apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java 2020-01-20 09:05:00.742768450 +0100 +Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java +=================================================================== +--- apache-tomcat-9.0.30-src.orig/java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java ++++ apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java @@ -17,6 +17,7 @@ package org.apache.coyote.http2; @@ -873,7 +909,7 @@ import java.nio.ByteBuffer; import java.nio.channels.CompletionHandler; import java.nio.channels.FileChannel; -@@ -216,11 +217,11 @@ +@@ -216,11 +217,11 @@ public class Http2AsyncUpgradeHandler ex if (writeable) { ByteUtil.set31Bits(header, 5, stream.getIdAsInt()); int orgLimit = data.limit(); @@ -887,8 +923,10 @@ handleAsyncException(); } } ---- apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/Http2Parser.java 2019-12-07 17:52:47.000000000 +0100 -+++ apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/Http2Parser.java 2020-01-20 09:13:22.253834179 +0100 +Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/Http2Parser.java +=================================================================== +--- apache-tomcat-9.0.30-src.orig/java/org/apache/coyote/http2/Http2Parser.java ++++ apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/Http2Parser.java @@ -17,6 +17,7 @@ package org.apache.coyote.http2; @@ -897,7 +935,7 @@ import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; -@@ -192,9 +193,9 @@ +@@ -192,9 +193,9 @@ class Http2Parser { input.fill(true, dest, dataLength); } else { int oldLimit = buffer.limit(); @@ -909,7 +947,7 @@ } // Process padding before sending any notifications in case // padding is invalid. -@@ -475,12 +476,12 @@ +@@ -475,12 +476,12 @@ class Http2Parser { input.fill(true, headerReadBuffer, toRead); } else { int oldLimit = buffer.limit(); @@ -925,7 +963,7 @@ try { hpackDecoder.decode(headerReadBuffer); } catch (HpackException hpe) { -@@ -550,7 +551,7 @@ +@@ -550,7 +551,7 @@ class Http2Parser { return; } if (!mustBeZero && byteBuffer != null) { @@ -934,7 +972,7 @@ } else { int read = 0; byte[] buffer = new byte[1024]; -@@ -710,7 +711,7 @@ +@@ -710,7 +711,7 @@ class Http2Parser { default boolean fill(boolean block, ByteBuffer data, int len) throws IOException { boolean result = fill(block, data.array(), data.arrayOffset() + data.position(), len); if (result) { @@ -943,9 +981,11 @@ } return result; } ---- apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/Http2UpgradeHandler.java 2019-12-07 17:52:47.000000000 +0100 -+++ apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/Http2UpgradeHandler.java 2020-01-20 09:32:07.284031343 +0100 -@@ -18,6 +18,7 @@ +Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/Http2UpgradeHandler.java +=================================================================== +--- apache-tomcat-9.0.30-src.orig/java/org/apache/coyote/http2/Http2UpgradeHandler.java ++++ apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/Http2UpgradeHandler.java +@@ -18,6 +18,7 @@ package org.apache.coyote.http2; import java.io.EOFException; import java.io.IOException; @@ -953,7 +993,7 @@ import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.util.HashSet; -@@ -762,9 +763,9 @@ +@@ -762,9 +763,9 @@ class Http2UpgradeHandler extends Abstra try { socketWrapper.write(true, header, 0, header.length); int orgLimit = data.limit(); @@ -965,7 +1005,7 @@ socketWrapper.flush(true); } catch (IOException ioe) { handleAppInitiatedIOException(ioe); -@@ -1830,7 +1831,7 @@ +@@ -1830,7 +1831,7 @@ class Http2UpgradeHandler extends Abstra } catch (IOException ioe) { handleAppInitiatedIOException(ioe); } @@ -974,8 +1014,10 @@ } @Override ---- apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/Stream.java 2019-12-07 17:52:48.000000000 +0100 -+++ apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/Stream.java 2020-01-20 09:25:24.129809869 +0100 +Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/Stream.java +=================================================================== +--- apache-tomcat-9.0.30-src.orig/java/org/apache/coyote/http2/Stream.java ++++ apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/Stream.java @@ -17,6 +17,7 @@ package org.apache.coyote.http2; @@ -984,7 +1026,7 @@ import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.security.AccessController; -@@ -850,9 +851,9 @@ +@@ -850,9 +851,9 @@ class Stream extends AbstractStream impl int chunkLimit = chunk.limit(); while (chunk.remaining() > 0) { int thisTime = Math.min(buffer.remaining(), chunk.remaining()); @@ -996,7 +1038,7 @@ if (chunk.remaining() > 0 && !buffer.hasRemaining()) { // Only flush if we have more data to write and the buffer // is full -@@ -922,7 +923,7 @@ +@@ -922,7 +923,7 @@ class Stream extends AbstractStream impl // Buffer is empty. Nothing to do. return false; } @@ -1005,7 +1047,7 @@ int left = buffer.remaining(); while (left > 0) { if (streamReservation == 0) { -@@ -953,7 +954,7 @@ +@@ -953,7 +954,7 @@ class Stream extends AbstractStream impl left -= connectionReservation; } } @@ -1014,7 +1056,7 @@ return false; } -@@ -1014,9 +1015,9 @@ +@@ -1014,9 +1015,9 @@ class Stream extends AbstractStream impl int chunkLimit = src.limit(); while (src.remaining() > 0) { int thisTime = Math.min(buffer.remaining(), src.remaining()); @@ -1026,7 +1068,7 @@ if (flush(false, blocking)) { return true; } -@@ -1104,14 +1105,14 @@ +@@ -1104,14 +1105,14 @@ class Stream extends AbstractStream impl if (inBuffer.position() > 0) { // Data is available in the inBuffer. Copy it to the // outBuffer. @@ -1043,9 +1085,11 @@ } else if (!canRead) { return -1; } else { ---- apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/B2CConverter.java 2019-12-07 17:52:57.000000000 +0100 -+++ apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/B2CConverter.java 2020-01-20 13:26:12.359420492 +0100 -@@ -18,6 +18,7 @@ +Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/B2CConverter.java +=================================================================== +--- apache-tomcat-9.0.30-src.orig/java/org/apache/tomcat/util/buf/B2CConverter.java ++++ apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/B2CConverter.java +@@ -18,6 +18,7 @@ package org.apache.tomcat.util.buf; import java.io.IOException; import java.io.UnsupportedEncodingException; @@ -1053,7 +1097,7 @@ import java.nio.ByteBuffer; import java.nio.CharBuffer; import java.nio.charset.Charset; -@@ -107,7 +108,7 @@ +@@ -107,7 +108,7 @@ public class B2CConverter { */ public void recycle() { decoder.reset(); @@ -1062,7 +1106,7 @@ } /** -@@ -126,8 +127,8 @@ +@@ -126,8 +127,8 @@ public class B2CConverter { bb = ByteBuffer.wrap(bc.getBuffer(), bc.getStart(), bc.getLength()); } else { // Initialize the byte buffer @@ -1073,7 +1117,7 @@ } if ((cb == null) || (cb.array() != cc.getBuffer())) { // Create a new char buffer if anything changed -@@ -135,8 +136,8 @@ +@@ -135,8 +136,8 @@ public class B2CConverter { cc.getBuffer().length - cc.getEnd()); } else { // Initialize the char buffer @@ -1084,7 +1128,7 @@ } CoderResult result = null; // Parse leftover if any are present -@@ -145,16 +146,16 @@ +@@ -145,16 +146,16 @@ public class B2CConverter { // Loop until one char is decoded or there is a decoder error do { leftovers.put(bc.subtractB()); @@ -1106,7 +1150,7 @@ } // Do the decoding and get the results into the byte chunk and the char // chunk -@@ -172,8 +173,8 @@ +@@ -172,8 +173,8 @@ public class B2CConverter { cc.setEnd(cb.position()); // Put leftovers in the leftovers byte buffer if (bc.getLength() > 0) { @@ -1117,7 +1161,7 @@ bc.subtract(leftovers.array(), 0, bc.getLength()); } } -@@ -196,16 +197,16 @@ +@@ -196,16 +197,16 @@ public class B2CConverter { bb = ByteBuffer.wrap(bc.array(), bc.arrayOffset() + bc.position(), bc.remaining()); } else { // Initialize the byte buffer @@ -1138,7 +1182,7 @@ } CoderResult result = null; // Parse leftover if any are present -@@ -221,16 +222,16 @@ +@@ -221,16 +222,16 @@ public class B2CConverter { chr = bc.get(); } leftovers.put(chr); @@ -1160,7 +1204,7 @@ } // Do the decoding and get the results into the byte chunk and the char // chunk -@@ -240,16 +241,16 @@ +@@ -240,16 +241,16 @@ public class B2CConverter { } else if (result.isOverflow()) { // Propagate current positions to the byte chunk and char chunk, if // this continues the char buffer will get resized @@ -1183,8 +1227,10 @@ bc.get(leftovers.array(), 0, bc.remaining()); } } ---- apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/ByteBufferHolder.java 2019-12-07 17:52:57.000000000 +0100 -+++ apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/ByteBufferHolder.java 2020-01-20 13:26:55.607675293 +0100 +Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/ByteBufferHolder.java +=================================================================== +--- apache-tomcat-9.0.30-src.orig/java/org/apache/tomcat/util/buf/ByteBufferHolder.java ++++ apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/ByteBufferHolder.java @@ -16,6 +16,7 @@ */ package org.apache.tomcat.util.buf; @@ -1193,7 +1239,7 @@ import java.nio.ByteBuffer; import java.util.concurrent.atomic.AtomicBoolean; -@@ -46,7 +47,7 @@ +@@ -46,7 +47,7 @@ public class ByteBufferHolder { public boolean flip() { if (flipped.compareAndSet(false, true)) { @@ -1202,9 +1248,11 @@ return true; } else { return false; ---- apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/ByteBufferUtils.java 2019-12-07 17:52:57.000000000 +0100 -+++ apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/ByteBufferUtils.java 2020-01-20 13:51:31.568006546 +0100 -@@ -19,6 +19,7 @@ +Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/ByteBufferUtils.java +=================================================================== +--- apache-tomcat-9.0.30-src.orig/java/org/apache/tomcat/util/buf/ByteBufferUtils.java ++++ apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/ByteBufferUtils.java +@@ -19,6 +19,7 @@ package org.apache.tomcat.util.buf; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; @@ -1212,7 +1260,7 @@ import java.nio.ByteBuffer; import org.apache.juli.logging.Log; -@@ -108,7 +109,7 @@ +@@ -108,7 +109,7 @@ public class ByteBufferUtils { } // Copy data @@ -1221,9 +1269,11 @@ out.put(in); if (direct) { ---- apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/ByteChunk.java 2019-12-07 17:52:57.000000000 +0100 -+++ apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/ByteChunk.java 2020-01-20 13:49:28.663327810 +0100 -@@ -19,6 +19,7 @@ +Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/ByteChunk.java +=================================================================== +--- apache-tomcat-9.0.30-src.orig/java/org/apache/tomcat/util/buf/ByteChunk.java ++++ apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/ByteChunk.java +@@ -19,6 +19,7 @@ package org.apache.tomcat.util.buf; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; @@ -1231,7 +1281,7 @@ import java.nio.ByteBuffer; import java.nio.CharBuffer; import java.nio.charset.Charset; -@@ -345,7 +346,7 @@ +@@ -345,7 +346,7 @@ public final class ByteChunk extends Abs // and avoid an extra copy if (len == limit && end == start && out != null) { out.realWriteBytes(from); @@ -1240,7 +1290,7 @@ return; } // if we have limit and we're below -@@ -375,13 +376,13 @@ +@@ -375,13 +376,13 @@ public final class ByteChunk extends Abs int remain = len - avail; avail = limit - end; while (remain >= avail) { @@ -1257,7 +1307,7 @@ from.get(buff, end, remain); end += remain; } -@@ -482,8 +483,8 @@ +@@ -482,8 +483,8 @@ public final class ByteChunk extends Abs } int n = Math.min(to.remaining(), getLength()); to.put(buff, start, n); @@ -1268,8 +1318,10 @@ start += n; return n; } ---- apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/C2BConverter.java 2019-12-07 17:52:57.000000000 +0100 -+++ apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/C2BConverter.java 2020-01-20 14:20:33.341610658 +0100 +Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/C2BConverter.java +=================================================================== +--- apache-tomcat-9.0.30-src.orig/java/org/apache/tomcat/util/buf/C2BConverter.java ++++ apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/C2BConverter.java @@ -17,6 +17,7 @@ package org.apache.tomcat.util.buf; @@ -1278,7 +1330,7 @@ import java.nio.ByteBuffer; import java.nio.CharBuffer; import java.nio.charset.Charset; -@@ -51,7 +52,7 @@ +@@ -51,7 +52,7 @@ public final class C2BConverter { */ public void recycle() { encoder.reset(); @@ -1287,7 +1339,7 @@ } public boolean isUndeflow() { -@@ -71,16 +72,16 @@ +@@ -71,16 +72,16 @@ public final class C2BConverter { bb = ByteBuffer.wrap(bc.getBuffer(), bc.getEnd(), bc.getBuffer().length - bc.getEnd()); } else { // Initialize the byte buffer @@ -1308,7 +1360,7 @@ } CoderResult result = null; // Parse leftover if any are present -@@ -89,16 +90,16 @@ +@@ -89,16 +90,16 @@ public final class C2BConverter { // Loop until one char is encoded or there is a encoder error do { leftovers.put((char) cc.subtract()); @@ -1330,7 +1382,7 @@ } // Do the decoding and get the results into the byte chunk and the char // chunk -@@ -115,8 +116,8 @@ +@@ -115,8 +116,8 @@ public final class C2BConverter { cc.setOffset(cb.position()); // Put leftovers in the leftovers char buffer if (cc.getLength() > 0) { @@ -1341,7 +1393,7 @@ cc.subtract(leftovers.array(), 0, cc.getLength()); } } -@@ -135,16 +136,16 @@ +@@ -135,16 +136,16 @@ public final class C2BConverter { bb = ByteBuffer.wrap(bc.array(), bc.limit(), bc.capacity() - bc.limit()); } else { // Initialize the byte buffer @@ -1362,7 +1414,7 @@ } CoderResult result = null; // Parse leftover if any are present -@@ -153,16 +154,16 @@ +@@ -153,16 +154,16 @@ public final class C2BConverter { // Loop until one char is encoded or there is a encoder error do { leftovers.put(cc.get()); @@ -1384,7 +1436,7 @@ } // Do the decoding and get the results into the byte chunk and the char // chunk -@@ -171,16 +172,16 @@ +@@ -171,16 +172,16 @@ public final class C2BConverter { result.throwException(); } else if (result.isOverflow()) { // Propagate current positions to the byte chunk and char chunk @@ -1407,8 +1459,10 @@ cc.get(leftovers.array(), 0, cc.remaining()); } } ---- apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/Utf8Decoder.java 2019-12-07 17:52:57.000000000 +0100 -+++ apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/Utf8Decoder.java 2020-01-20 13:46:09.246215950 +0100 +Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/Utf8Decoder.java +=================================================================== +--- apache-tomcat-9.0.30-src.orig/java/org/apache/tomcat/util/buf/Utf8Decoder.java ++++ apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/Utf8Decoder.java @@ -16,6 +16,7 @@ */ package org.apache.tomcat.util.buf; @@ -1417,7 +1471,7 @@ import java.nio.ByteBuffer; import java.nio.CharBuffer; import java.nio.charset.CharsetDecoder; -@@ -140,7 +141,7 @@ +@@ -140,7 +141,7 @@ public class Utf8Decoder extends Charset } return CoderResult.UNDERFLOW; } finally { @@ -1426,7 +1480,7 @@ } } -@@ -163,8 +164,8 @@ +@@ -163,8 +164,8 @@ public class Utf8Decoder extends Charset // If first byte is invalid, tail will be set to -1 int tail = remainingBytes[jchar]; if (tail == -1) { @@ -1437,7 +1491,7 @@ return CoderResult.malformedForLength(1); } // Additional checks to detect invalid sequences ASAP -@@ -175,72 +176,72 @@ +@@ -175,72 +176,72 @@ public class Utf8Decoder extends Charset // First byte C2..DF, second byte 80..BF if (jchar > 0x41 && jchar < 0x60 && (bArr[inIndex + 1] & 0xC0) != 0x80) { @@ -1530,7 +1584,7 @@ return CoderResult.malformedForLength(3); } } -@@ -250,8 +251,8 @@ +@@ -250,8 +251,8 @@ public class Utf8Decoder extends Charset for (int i = 0; i < tail; i++) { int nextByte = bArr[inIndex + i + 1] & 0xFF; if ((nextByte & 0xC0) != 0x80) { @@ -1541,7 +1595,7 @@ return CoderResult.malformedForLength(1 + i); } jchar = (jchar << 6) + nextByte; -@@ -259,8 +260,8 @@ +@@ -259,8 +260,8 @@ public class Utf8Decoder extends Charset jchar -= remainingNumbers[tail]; if (jchar < lowerEncodingLimit[tail]) { // Should have been encoded in fewer octets @@ -1552,7 +1606,7 @@ return CoderResult.malformedForLength(1); } inIndex += tail; -@@ -281,8 +282,8 @@ +@@ -281,8 +282,8 @@ public class Utf8Decoder extends Charset // Encoded with 4 bytes. inIndex currently points // to the final byte. Move it back to first byte. inIndex -= 3; @@ -1563,7 +1617,7 @@ return CoderResult.OVERFLOW; } cArr[outIndex++] = (char) ((jchar >> 0xA) + 0xD7C0); -@@ -290,8 +291,8 @@ +@@ -290,8 +291,8 @@ public class Utf8Decoder extends Charset outRemaining -= 2; } } @@ -1574,8 +1628,10 @@ return (outRemaining == 0 && inIndex < inIndexLimit) ? CoderResult.OVERFLOW : CoderResult.UNDERFLOW; ---- apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/Utf8Encoder.java 2019-12-07 17:52:57.000000000 +0100 -+++ apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/Utf8Encoder.java 2020-01-20 13:32:51.861743592 +0100 +Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/Utf8Encoder.java +=================================================================== +--- apache-tomcat-9.0.30-src.orig/java/org/apache/tomcat/util/buf/Utf8Encoder.java ++++ apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/Utf8Encoder.java @@ -16,6 +16,7 @@ */ package org.apache.tomcat.util.buf; @@ -1584,7 +1640,7 @@ import java.nio.ByteBuffer; import java.nio.CharBuffer; import java.nio.charset.CharsetEncoder; -@@ -56,8 +57,8 @@ +@@ -56,8 +57,8 @@ public class Utf8Encoder extends Charset if (jchar <= 0x7F) { if (outRemaining < 1) { @@ -1595,7 +1651,7 @@ return CoderResult.OVERFLOW; } bArr[outPos++] = (byte) (jchar & 0xFF); -@@ -65,8 +66,8 @@ +@@ -65,8 +66,8 @@ public class Utf8Encoder extends Charset } else if (jchar <= 0x7FF) { if (outRemaining < 2) { @@ -1606,7 +1662,7 @@ return CoderResult.OVERFLOW; } bArr[outPos++] = (byte) (0xC0 + ((jchar >> 6) & 0x1F)); -@@ -77,21 +78,21 @@ +@@ -77,21 +78,21 @@ public class Utf8Encoder extends Charset // in has to have one byte more. if (limit <= x + 1) { @@ -1634,7 +1690,7 @@ return CoderResult.malformedForLength(1); } -@@ -99,8 +100,8 @@ +@@ -99,8 +100,8 @@ public class Utf8Encoder extends Charset // The surrogate pair ends with a high-surrogate. if (jchar2 < 0xDC00) { @@ -1645,7 +1701,7 @@ return CoderResult.malformedForLength(1); } -@@ -121,8 +122,8 @@ +@@ -121,8 +122,8 @@ public class Utf8Encoder extends Charset } else { if (outRemaining < 3) { @@ -1656,7 +1712,7 @@ return CoderResult.OVERFLOW; } bArr[outPos++] = (byte) (0xE0 + ((jchar >> 12) & 0x0F)); -@@ -131,8 +132,8 @@ +@@ -131,8 +132,8 @@ public class Utf8Encoder extends Charset outRemaining -= 3; } if (outRemaining == 0) { @@ -1667,7 +1723,7 @@ // If both input and output are exhausted, return UNDERFLOW if (x + 1 == limit) { return CoderResult.UNDERFLOW; -@@ -143,8 +144,8 @@ +@@ -143,8 +144,8 @@ public class Utf8Encoder extends Charset } if (rem != 0) { @@ -1678,7 +1734,7 @@ } return CoderResult.UNDERFLOW; } -@@ -228,7 +229,7 @@ +@@ -228,7 +229,7 @@ public class Utf8Encoder extends Charset pos++; } } finally { @@ -1687,10 +1743,11 @@ } return CoderResult.UNDERFLOW; } -Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat-9.0.30-java8compat.patch ---- apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/AprEndpoint.java 2019-12-07 17:53:02.000000000 +0100 -+++ apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/AprEndpoint.java 2020-01-20 13:09:09.049553953 +0100 -@@ -20,6 +20,7 @@ +Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/AprEndpoint.java +=================================================================== +--- apache-tomcat-9.0.30-src.orig/java/org/apache/tomcat/util/net/AprEndpoint.java ++++ apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/AprEndpoint.java +@@ -20,6 +20,7 @@ import java.io.EOFException; import java.io.IOException; import java.net.InetSocketAddress; import java.net.SocketTimeoutException; @@ -1698,7 +1755,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat import java.nio.ByteBuffer; import java.nio.channels.CompletionHandler; import java.nio.charset.StandardCharsets; -@@ -2040,7 +2041,7 @@ +@@ -2040,7 +2041,7 @@ public class AprEndpoint extends Abstrac // SSL and app buffer size settings with NIO & NIO2. if (endpoint.isSSLEnabled()) { sslOutputBuffer = ByteBuffer.allocateDirect(SSL_OUTPUT_BUFFER_SIZE); @@ -1707,7 +1764,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat } else { sslOutputBuffer = null; } -@@ -2102,7 +2103,7 @@ +@@ -2102,7 +2103,7 @@ public class AprEndpoint extends Abstrac // The socket read buffer capacity is socket.appReadBufSize int limit = socketBufferHandler.getReadBuffer().capacity(); if (to.isDirect() && to.remaining() >= limit) { @@ -1716,7 +1773,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat nRead = fillReadBuffer(block, to); if (log.isDebugEnabled()) { log.debug("Socket: [" + this + "], Read direct from socket: [" + nRead + "]"); -@@ -2181,7 +2182,7 @@ +@@ -2181,7 +2182,7 @@ public class AprEndpoint extends Abstrac } if (result > 0) { @@ -1725,7 +1782,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat return result; } else if (result == 0 || -result == Status.EAGAIN) { return 0; -@@ -2305,9 +2306,9 @@ +@@ -2305,9 +2306,9 @@ public class AprEndpoint extends Abstrac if (getEndpoint().isSSLEnabled()) { if (sslOutputBuffer.remaining() == 0) { // Buffer was fully written last time around @@ -1737,7 +1794,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat } else { // Buffer still has data from previous attempt to write // APR + SSL requires that exactly the same parameters are -@@ -2316,13 +2317,13 @@ +@@ -2316,13 +2317,13 @@ public class AprEndpoint extends Abstrac thisTime = Socket.sendb(getSocket().longValue(), sslOutputBuffer, sslOutputBuffer.position(), sslOutputBuffer.limit()); if (thisTime > 0) { @@ -1753,9 +1810,11 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat } } if (Status.APR_STATUS_IS_EAGAIN(-thisTime)) { ---- apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/Nio2Endpoint.java 2019-12-07 17:53:02.000000000 +0100 -+++ apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/Nio2Endpoint.java 2020-01-20 14:24:28.286904277 +0100 -@@ -22,6 +22,7 @@ +Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/Nio2Endpoint.java +=================================================================== +--- apache-tomcat-9.0.30-src.orig/java/org/apache/tomcat/util/net/Nio2Endpoint.java ++++ apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/Nio2Endpoint.java +@@ -22,6 +22,7 @@ import java.io.IOException; import java.net.InetSocketAddress; import java.net.SocketAddress; import java.net.SocketTimeoutException; @@ -1763,7 +1822,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat import java.nio.ByteBuffer; import java.nio.channels.AsynchronousChannelGroup; import java.nio.channels.AsynchronousCloseException; -@@ -541,7 +542,7 @@ +@@ -541,7 +542,7 @@ public class Nio2Endpoint extends Abstra if (nRead > 0) { getSocket().getBufHandler().configureWriteBufferForRead(); if (attachment.length < buffer.remaining()) { @@ -1772,7 +1831,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat } attachment.length -= nRead; } else { -@@ -895,7 +896,7 @@ +@@ -895,7 +896,7 @@ public class Nio2Endpoint extends Abstra // The socket read buffer capacity is socket.appReadBufSize int limit = socketBufferHandler.getReadBuffer().capacity(); if (block && to.remaining() >= limit) { @@ -1781,9 +1840,11 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat nRead = fillReadBuffer(block, to); if (log.isDebugEnabled()) { log.debug("Socket: [" + this + "], Read direct from socket: [" + nRead + "]"); ---- apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/NioEndpoint.java 2019-12-07 17:53:02.000000000 +0100 -+++ apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/NioEndpoint.java 2020-01-20 13:03:47.719842418 +0100 -@@ -23,6 +23,7 @@ +Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/NioEndpoint.java +=================================================================== +--- apache-tomcat-9.0.30-src.orig/java/org/apache/tomcat/util/net/NioEndpoint.java ++++ apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/NioEndpoint.java +@@ -23,6 +23,7 @@ import java.io.IOException; import java.net.InetAddress; import java.net.InetSocketAddress; import java.net.SocketTimeoutException; @@ -1791,7 +1852,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat import java.nio.ByteBuffer; import java.nio.channels.CancelledKeyException; import java.nio.channels.Channel; -@@ -1139,7 +1140,7 @@ +@@ -1139,7 +1140,7 @@ public class NioEndpoint extends Abstrac // The socket read buffer capacity is socket.appReadBufSize int limit = socketBufferHandler.getReadBuffer().capacity(); if (to.remaining() >= limit) { @@ -1800,8 +1861,10 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat nRead = fillReadBuffer(block, to); if (log.isDebugEnabled()) { log.debug("Socket: [" + this + "], Read direct from socket: [" + nRead + "]"); ---- apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/openssl/OpenSSLEngine.java 2019-12-07 17:53:03.000000000 +0100 -+++ apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/openssl/OpenSSLEngine.java 2020-01-20 11:28:33.194522708 +0100 +Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/openssl/OpenSSLEngine.java +=================================================================== +--- apache-tomcat-9.0.30-src.orig/java/org/apache/tomcat/util/net/openssl/OpenSSLEngine.java ++++ apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/openssl/OpenSSLEngine.java @@ -16,6 +16,7 @@ */ package org.apache.tomcat.util.net.openssl; @@ -1810,7 +1873,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat import java.nio.ByteBuffer; import java.nio.ReadOnlyBufferException; import java.security.Principal; -@@ -40,7 +41,7 @@ +@@ -40,7 +41,7 @@ import javax.net.ssl.SSLSessionContext; import org.apache.juli.logging.Log; import org.apache.juli.logging.LogFactory; @@ -1819,7 +1882,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat import org.apache.tomcat.jni.Pool; import org.apache.tomcat.jni.SSL; import org.apache.tomcat.jni.SSLContext; -@@ -130,7 +131,7 @@ +@@ -130,7 +131,7 @@ public final class OpenSSLEngine extends private static final String INVALID_CIPHER = "SSL_NULL_WITH_NULL_NULL"; @@ -1828,7 +1891,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat // OpenSSL state private long ssl; -@@ -242,10 +243,10 @@ +@@ -242,10 +243,10 @@ public final class OpenSSLEngine extends final int sslWrote; if (src.isDirect()) { @@ -1841,7 +1904,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat return sslWrote; } } else { -@@ -253,17 +254,17 @@ +@@ -253,17 +254,17 @@ public final class OpenSSLEngine extends try { final long addr = memoryAddress(buf); @@ -1863,7 +1926,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat } } finally { buf.clear(); -@@ -282,10 +283,10 @@ +@@ -282,10 +283,10 @@ public final class OpenSSLEngine extends final int pos = src.position(); final int len = src.remaining(); if (src.isDirect()) { @@ -1876,7 +1939,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat return netWrote; } } else { -@@ -297,10 +298,10 @@ +@@ -297,10 +298,10 @@ public final class OpenSSLEngine extends final int netWrote = SSL.writeToBIO(networkBIO, addr, len); if (netWrote >= 0) { @@ -1889,7 +1952,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat } } finally { buf.clear(); -@@ -317,11 +318,11 @@ +@@ -317,11 +318,11 @@ public final class OpenSSLEngine extends private static int readPlaintextData(final long ssl, final ByteBuffer dst) { if (dst.isDirect()) { final int pos = dst.position(); @@ -1903,7 +1966,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat return sslRead; } } else { -@@ -335,9 +336,9 @@ +@@ -335,9 +336,9 @@ public final class OpenSSLEngine extends final int sslRead = SSL.readFromSSL(ssl, addr, len); if (sslRead > 0) { buf.limit(sslRead); @@ -1915,7 +1978,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat return sslRead; } } finally { -@@ -355,10 +356,10 @@ +@@ -355,10 +356,10 @@ public final class OpenSSLEngine extends private static int readEncryptedData(final long networkBIO, final ByteBuffer dst, final int pending) { if (dst.isDirect() && dst.remaining() >= pending) { final int pos = dst.position(); @@ -1928,7 +1991,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat return bioRead; } } else { -@@ -370,9 +371,9 @@ +@@ -370,9 +371,9 @@ public final class OpenSSLEngine extends if (bioRead > 0) { buf.limit(bioRead); int oldLimit = dst.limit(); @@ -1940,7 +2003,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat return bioRead; } } finally { -@@ -963,7 +964,7 @@ +@@ -963,7 +964,7 @@ public final class OpenSSLEngine extends private static long memoryAddress(ByteBuffer buf) { @@ -1949,9 +2012,11 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat } private SSLEngineResult.Status getEngineStatus() { ---- apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/SecureNio2Channel.java 2019-12-07 17:53:02.000000000 +0100 -+++ apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/SecureNio2Channel.java 2020-01-20 13:02:26.163408028 +0100 -@@ -18,6 +18,7 @@ +Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/SecureNio2Channel.java +=================================================================== +--- apache-tomcat-9.0.30-src.orig/java/org/apache/tomcat/util/net/SecureNio2Channel.java ++++ apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/SecureNio2Channel.java +@@ -18,6 +18,7 @@ package org.apache.tomcat.util.net; import java.io.EOFException; import java.io.IOException; @@ -1959,7 +2024,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat import java.nio.ByteBuffer; import java.nio.channels.AsynchronousSocketChannel; import java.nio.channels.CompletionHandler; -@@ -133,7 +134,7 @@ +@@ -133,7 +134,7 @@ public class SecureNio2Channel extends N unwrapBeforeRead = true; closed = false; closing = false; @@ -1968,7 +2033,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat } @Override -@@ -323,7 +324,7 @@ +@@ -323,7 +324,7 @@ public class SecureNio2Channel extends N } else if (handshake.getStatus() == Status.BUFFER_UNDERFLOW) { if (netInBuffer.position() == netInBuffer.limit()) { //clear the buffer if we have emptied it out on data @@ -1977,7 +2042,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat } //read more data if (async) { -@@ -418,9 +419,9 @@ +@@ -418,9 +419,9 @@ public class SecureNio2Channel extends N clientRequestedCiphers = Collections.emptyList(); break; case NON_SECURE: @@ -1989,7 +2054,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat flush(); throw new IOException(sm.getString("channel.nio.ssl.foundHttp")); } -@@ -444,8 +445,8 @@ +@@ -444,8 +445,8 @@ public class SecureNio2Channel extends N netOutBuffer = ByteBufferUtils.expand(netOutBuffer, sslEngine.getSession().getPacketBufferSize()); // Set limit and position to expected values @@ -2000,7 +2065,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat // Initiate handshake sslEngine.beginHandshake(); -@@ -469,10 +470,10 @@ +@@ -469,10 +470,10 @@ public class SecureNio2Channel extends N if (!getBufHandler().isReadBufferEmpty()) throw new IOException(sm.getString("channel.nio.ssl.appInputNotEmpty")); if (!getBufHandler().isWriteBufferEmpty()) throw new IOException(sm.getString("channel.nio.ssl.appOutputNotEmpty")); @@ -2015,7 +2080,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat getBufHandler().reset(); handshakeComplete = false; -@@ -521,12 +522,12 @@ +@@ -521,12 +522,12 @@ public class SecureNio2Channel extends N protected SSLEngineResult handshakeWrap() throws IOException { //this should never be called with a network buffer that contains data //so we can clear it here. @@ -2030,7 +2095,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat //set the status handshakeStatus = result.getHandshakeStatus(); return result; -@@ -543,7 +544,7 @@ +@@ -543,7 +544,7 @@ public class SecureNio2Channel extends N //loop while we can perform pure SSLEngine data do { //prepare the buffer with the incoming data @@ -2039,7 +2104,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat //call unwrap getBufHandler().configureReadBufferForWrite(); result = sslEngine.unwrap(netInBuffer, getBufHandler().getReadBuffer()); -@@ -601,7 +602,7 @@ +@@ -601,7 +602,7 @@ public class SecureNio2Channel extends N throw new IOException(sm.getString("channel.nio.ssl.pendingWriteDuringClose"), e); } //prep the buffer for the close message @@ -2048,7 +2113,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat //perform the close, since we called sslEngine.closeOutbound SSLEngineResult handshake = sslEngine.wrap(getEmptyBuf(), netOutBuffer); //we should be in a close state -@@ -609,7 +610,7 @@ +@@ -609,7 +610,7 @@ public class SecureNio2Channel extends N throw new IOException(sm.getString("channel.nio.ssl.invalidCloseState")); } //prepare the buffer for writing @@ -2057,7 +2122,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat //if there is data to be written try { if (timeout > 0) { -@@ -711,7 +712,7 @@ +@@ -711,7 +712,7 @@ public class SecureNio2Channel extends N SSLEngineResult unwrap; do { //prepare the buffer @@ -2066,7 +2131,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat //unwrap the data try { unwrap = sslEngine.unwrap(netInBuffer, dst); -@@ -854,10 +855,10 @@ +@@ -854,10 +855,10 @@ public class SecureNio2Channel extends N protected void wrap() { try { if (!netOutBuffer.hasRemaining()) { @@ -2079,7 +2144,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat if (result.getStatus() == Status.OK) { if (result.getHandshakeStatus() == HandshakeStatus.NEED_TASK) tasks(); -@@ -909,7 +910,7 @@ +@@ -909,7 +910,7 @@ public class SecureNio2Channel extends N SSLEngineResult unwrap; do { //prepare the buffer @@ -2088,7 +2153,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat //unwrap the data unwrap = sslEngine.unwrap(netInBuffer, dst2); //compact the buffer -@@ -1019,7 +1020,7 @@ +@@ -1019,7 +1020,7 @@ public class SecureNio2Channel extends N } processOverflow = false; //prepare the buffer @@ -2097,7 +2162,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat //unwrap the data unwrap = sslEngine.unwrap(netInBuffer, dsts2, offset, length2); //compact the buffer -@@ -1138,11 +1139,11 @@ +@@ -1138,11 +1139,11 @@ public class SecureNio2Channel extends N } try { // Prepare the output buffer @@ -2111,7 +2176,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat if (result.getStatus() == Status.OK) { if (result.getHandshakeStatus() == HandshakeStatus.NEED_TASK) { tasks(); -@@ -1192,11 +1193,11 @@ +@@ -1192,11 +1193,11 @@ public class SecureNio2Channel extends N } try { // Prepare the output buffer @@ -2125,9 +2190,11 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat if (result.getStatus() == Status.OK) { if (result.getHandshakeStatus() == HandshakeStatus.NEED_TASK) { tasks(); ---- apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/SecureNioChannel.java 2019-12-07 17:53:02.000000000 +0100 -+++ apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/SecureNioChannel.java 2020-01-20 11:12:08.929715874 +0100 -@@ -19,6 +19,7 @@ +Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/SecureNioChannel.java +=================================================================== +--- apache-tomcat-9.0.30-src.orig/java/org/apache/tomcat/util/net/SecureNioChannel.java ++++ apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/SecureNioChannel.java +@@ -19,6 +19,7 @@ package org.apache.tomcat.util.net; import java.io.EOFException; import java.io.IOException; import java.net.SocketTimeoutException; @@ -2135,7 +2202,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat import java.nio.ByteBuffer; import java.nio.channels.SelectionKey; import java.nio.channels.Selector; -@@ -95,7 +96,7 @@ +@@ -95,7 +96,7 @@ public class SecureNioChannel extends Ni handshakeComplete = false; closed = false; closing = false; @@ -2144,7 +2211,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat } @Override -@@ -315,9 +316,9 @@ +@@ -315,9 +316,9 @@ public class SecureNioChannel extends Ni clientRequestedCiphers = Collections.emptyList(); break; case NON_SECURE: @@ -2156,7 +2223,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat flushOutbound(); throw new IOException(sm.getString("channel.nio.ssl.foundHttp")); } -@@ -341,8 +342,8 @@ +@@ -341,8 +342,8 @@ public class SecureNioChannel extends Ni netOutBuffer = ByteBufferUtils.expand(netOutBuffer, sslEngine.getSession().getPacketBufferSize()); // Set limit and position to expected values @@ -2167,7 +2234,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat // Initiate handshake sslEngine.beginHandshake(); -@@ -454,12 +455,12 @@ +@@ -454,12 +455,12 @@ public class SecureNioChannel extends Ni protected SSLEngineResult handshakeWrap(boolean doWrite) throws IOException { //this should never be called with a network buffer that contains data //so we can clear it here. @@ -2182,7 +2249,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat //set the status handshakeStatus = result.getHandshakeStatus(); //optimization, if we do have a writable channel, write it now -@@ -479,7 +480,7 @@ +@@ -479,7 +480,7 @@ public class SecureNioChannel extends Ni if (netInBuffer.position() == netInBuffer.limit()) { //clear the buffer if we have emptied it out on data @@ -2191,7 +2258,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat } if (doread) { //if we have data to read, read it -@@ -493,7 +494,7 @@ +@@ -493,7 +494,7 @@ public class SecureNioChannel extends Ni //loop while we can perform pure SSLEngine data do { //prepare the buffer with the incoming data @@ -2200,7 +2267,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat //call unwrap getBufHandler().configureReadBufferForWrite(); result = sslEngine.unwrap(netInBuffer, getBufHandler().getReadBuffer()); -@@ -537,7 +538,7 @@ +@@ -537,7 +538,7 @@ public class SecureNioChannel extends Ni throw new IOException(sm.getString("channel.nio.ssl.remainingDataDuringClose")); } //prep the buffer for the close message @@ -2209,7 +2276,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat //perform the close, since we called sslEngine.closeOutbound SSLEngineResult handshake = sslEngine.wrap(getEmptyBuf(), netOutBuffer); //we should be in a close state -@@ -545,7 +546,7 @@ +@@ -545,7 +546,7 @@ public class SecureNioChannel extends Ni throw new IOException(sm.getString("channel.nio.ssl.invalidCloseState")); } //prepare the buffer for writing @@ -2218,7 +2285,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat //if there is data to be written flush(netOutBuffer); -@@ -612,7 +613,7 @@ +@@ -612,7 +613,7 @@ public class SecureNioChannel extends Ni SSLEngineResult unwrap; do { //prepare the buffer @@ -2227,7 +2294,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat //unwrap the data unwrap = sslEngine.unwrap(netInBuffer, dst); //compact the buffer -@@ -691,7 +692,7 @@ +@@ -691,7 +692,7 @@ public class SecureNioChannel extends Ni } processOverflow = false; //prepare the buffer @@ -2236,7 +2303,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat //unwrap the data unwrap = sslEngine.unwrap(netInBuffer, dsts, offset, length); //compact the buffer -@@ -798,12 +799,12 @@ +@@ -798,12 +799,12 @@ public class SecureNioChannel extends Ni } // The data buffer is empty, we can reuse the entire buffer. @@ -2251,7 +2318,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat if (result.getStatus() == Status.OK) { if (result.getHandshakeStatus() == HandshakeStatus.NEED_TASK) { -@@ -835,12 +836,12 @@ +@@ -835,12 +836,12 @@ public class SecureNioChannel extends Ni } // The data buffer is empty, we can reuse the entire buffer. @@ -2266,8 +2333,10 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat if (result.getStatus() == Status.OK) { if (result.getHandshakeStatus() == HandshakeStatus.NEED_TASK) tasks(); ---- apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/SocketBufferHandler.java 2019-12-07 17:53:02.000000000 +0100 -+++ apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/SocketBufferHandler.java 2020-01-20 12:54:39.092912909 +0100 +Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/SocketBufferHandler.java +=================================================================== +--- apache-tomcat-9.0.30-src.orig/java/org/apache/tomcat/util/net/SocketBufferHandler.java ++++ apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/SocketBufferHandler.java @@ -16,6 +16,7 @@ */ package org.apache.tomcat.util.net; @@ -2276,7 +2345,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat import java.nio.ByteBuffer; import org.apache.tomcat.util.buf.ByteBufferUtils; -@@ -66,13 +67,13 @@ +@@ -66,13 +67,13 @@ public class SocketBufferHandler { // Switching to write int remaining = readBuffer.remaining(); if (remaining == 0) { @@ -2292,7 +2361,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat } this.readBufferConfiguredForWrite = readBufferConFiguredForWrite; } -@@ -110,15 +111,15 @@ +@@ -110,15 +111,15 @@ public class SocketBufferHandler { // Switching to write int remaining = writeBuffer.remaining(); if (remaining == 0) { @@ -2312,7 +2381,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat } this.writeBufferConfiguredForWrite = writeBufferConfiguredForWrite; } -@@ -149,9 +150,9 @@ +@@ -149,9 +150,9 @@ public class SocketBufferHandler { public void reset() { @@ -2324,9 +2393,11 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat writeBufferConfiguredForWrite = true; } ---- apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/SocketWrapperBase.java 2019-12-07 17:53:02.000000000 +0100 -+++ apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/SocketWrapperBase.java 2020-01-20 11:02:14.534448210 +0100 -@@ -19,6 +19,7 @@ +Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/SocketWrapperBase.java +=================================================================== +--- apache-tomcat-9.0.30-src.orig/java/org/apache/tomcat/util/net/SocketWrapperBase.java ++++ apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/SocketWrapperBase.java +@@ -19,6 +19,7 @@ package org.apache.tomcat.util.net; import java.io.EOFException; import java.io.IOException; import java.net.SocketTimeoutException; @@ -2334,7 +2405,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat import java.nio.ByteBuffer; import java.nio.channels.CompletionHandler; import java.nio.channels.InterruptedByTimeoutException; -@@ -1468,9 +1469,9 @@ +@@ -1468,9 +1469,9 @@ public abstract class SocketWrapperBase< int max = Math.min(from.remaining(), to.remaining()); if (max > 0) { int fromLimit = from.limit(); @@ -2346,8 +2417,10 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat } return max; } ---- apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/TLSClientHelloExtractor.java 2019-12-07 17:53:02.000000000 +0100 -+++ apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/TLSClientHelloExtractor.java 2020-01-20 11:07:24.084149952 +0100 +Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/TLSClientHelloExtractor.java +=================================================================== +--- apache-tomcat-9.0.30-src.orig/java/org/apache/tomcat/util/net/TLSClientHelloExtractor.java ++++ apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/TLSClientHelloExtractor.java @@ -17,6 +17,7 @@ package org.apache.tomcat.util.net; @@ -2356,7 +2429,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat import java.nio.BufferUnderflowException; import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; -@@ -76,7 +77,7 @@ +@@ -76,7 +77,7 @@ public class TLSClientHelloExtractor { String sniValue = null; try { // Switch to read mode. @@ -2365,7 +2438,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat // A complete TLS record header is required before we can figure out // how many bytes there are in the record. -@@ -164,8 +165,8 @@ +@@ -164,8 +165,8 @@ public class TLSClientHelloExtractor { this.clientRequestedApplicationProtocols = clientRequestedApplicationProtocols; this.sniValue = sniValue; // Whatever happens, return the buffer to its original state @@ -2376,7 +2449,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat } } -@@ -215,7 +216,7 @@ +@@ -215,7 +216,7 @@ public class TLSClientHelloExtractor { private static boolean isAvailable(ByteBuffer bb, int size) { if (bb.remaining() < size) { @@ -2385,7 +2458,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat return false; } return true; -@@ -243,7 +244,7 @@ +@@ -243,7 +244,7 @@ public class TLSClientHelloExtractor { // the buffer contains a correctly formatted HTTP request line. // The method, target and protocol are not validated. byte chr = 0; @@ -2394,7 +2467,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat // Skip blank lines do { -@@ -324,7 +325,7 @@ +@@ -324,7 +325,7 @@ public class TLSClientHelloExtractor { private static void skipBytes(ByteBuffer bb, int size) { @@ -2403,8 +2476,10 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat } ---- apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/WriteBuffer.java 2019-12-07 17:53:02.000000000 +0100 -+++ apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/WriteBuffer.java 2020-01-20 14:27:27.007888388 +0100 +Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/WriteBuffer.java +=================================================================== +--- apache-tomcat-9.0.30-src.orig/java/org/apache/tomcat/util/net/WriteBuffer.java ++++ apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/WriteBuffer.java @@ -17,6 +17,7 @@ package org.apache.tomcat.util.net; @@ -2413,9 +2488,11 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.Iterator; ---- apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/AsyncChannelWrapperSecure.java 2019-12-07 17:53:04.000000000 +0100 -+++ apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/AsyncChannelWrapperSecure.java 2020-01-20 10:17:25.199489032 +0100 -@@ -18,6 +18,7 @@ +Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/AsyncChannelWrapperSecure.java +=================================================================== +--- apache-tomcat-9.0.30-src.orig/java/org/apache/tomcat/websocket/AsyncChannelWrapperSecure.java ++++ apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/AsyncChannelWrapperSecure.java +@@ -18,6 +18,7 @@ package org.apache.tomcat.websocket; import java.io.EOFException; import java.io.IOException; @@ -2423,7 +2500,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat import java.nio.ByteBuffer; import java.nio.channels.AsynchronousSocketChannel; import java.nio.channels.CompletionHandler; -@@ -189,7 +190,7 @@ +@@ -189,7 +190,7 @@ public class AsyncChannelWrapperSecure i for (int i = offset; i < offset + length; i++) { ByteBuffer src = srcs[i]; while (src.hasRemaining()) { @@ -2432,7 +2509,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat // Encrypt the data SSLEngineResult r = sslEngine.wrap(src, socketWriteBuffer); -@@ -215,7 +216,7 @@ +@@ -215,7 +216,7 @@ public class AsyncChannelWrapperSecure i } } @@ -2441,7 +2518,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat // Do the write int toWrite = r.bytesProduced(); -@@ -272,7 +273,7 @@ +@@ -272,7 +273,7 @@ public class AsyncChannelWrapperSecure i } } @@ -2450,7 +2527,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat if (socketReadBuffer.hasRemaining()) { // Decrypt the data in the buffer -@@ -358,7 +359,7 @@ +@@ -358,7 +359,7 @@ public class AsyncChannelWrapperSecure i try { sslEngine.beginHandshake(); // So the first compact does the right thing @@ -2459,7 +2536,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat handshakeStatus = sslEngine.getHandshakeStatus(); resultStatus = Status.OK; -@@ -368,11 +369,11 @@ +@@ -368,11 +369,11 @@ public class AsyncChannelWrapperSecure i while(handshaking) { switch (handshakeStatus) { case NEED_WRAP: { @@ -2473,7 +2550,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat Future fWrite = socketChannel.write(socketWriteBuffer); fWrite.get(); -@@ -386,7 +387,7 @@ +@@ -386,7 +387,7 @@ public class AsyncChannelWrapperSecure i socketChannel.read(socketReadBuffer); fRead.get(); } @@ -2482,8 +2559,10 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat SSLEngineResult r = sslEngine.unwrap(socketReadBuffer, DUMMY); checkResult(r, false); ---- apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/PerMessageDeflate.java 2019-12-07 17:53:05.000000000 +0100 -+++ apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/PerMessageDeflate.java 2020-01-20 10:22:12.705103815 +0100 +Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/PerMessageDeflate.java +=================================================================== +--- apache-tomcat-9.0.30-src.orig/java/org/apache/tomcat/websocket/PerMessageDeflate.java ++++ apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/PerMessageDeflate.java @@ -17,6 +17,7 @@ package org.apache.tomcat.websocket; @@ -2492,7 +2571,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.List; -@@ -207,11 +208,11 @@ +@@ -207,11 +208,11 @@ public class PerMessageDeflate implement } catch (NullPointerException e) { throw new IOException(sm.getString("perMessageDeflate.alreadyClosed"), e); } @@ -2506,7 +2585,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat TransformationResult nextResult = next.getMoreData(opCode, fin, (rsv ^ RSV_BITMASK), readBuffer); inflater.setInput( -@@ -355,7 +356,7 @@ +@@ -355,7 +356,7 @@ public class PerMessageDeflate implement int written = deflater.deflate(compressedPayload.array(), compressedPayload.arrayOffset() + compressedPayload.position(), compressedPayload.remaining(), flush); @@ -2515,7 +2594,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat } catch (NullPointerException e) { throw new IOException(sm.getString("perMessageDeflate.alreadyClosed"), e); } -@@ -375,7 +376,7 @@ +@@ -375,7 +376,7 @@ public class PerMessageDeflate implement writeBuffer = ByteBuffer.allocate(Constants.DEFAULT_BUFFER_SIZE); // Flip the compressed payload ready for writing @@ -2524,7 +2603,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat boolean fin = uncompressedPart.isFin(); boolean full = compressedPayload.limit() == compressedPayload.capacity(); -@@ -384,7 +385,7 @@ +@@ -384,7 +385,7 @@ public class PerMessageDeflate implement if (fin && !full && needsInput) { // End of compressed message. Drop EOM bytes and output. @@ -2533,7 +2612,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat compressedPart = new MessagePart(true, getRsv(uncompressedPart), opCode, compressedPayload, uncompressedIntermediateHandler, uncompressedIntermediateHandler, blockingWriteTimeoutExpiry); -@@ -419,7 +420,7 @@ +@@ -419,7 +420,7 @@ public class PerMessageDeflate implement } if (eomBufferWritten < EOM_BUFFER.length) { // EOM has just been completed @@ -2542,8 +2621,10 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat compressedPart = new MessagePart(true, getRsv(uncompressedPart), opCode, compressedPayload, uncompressedIntermediateHandler, uncompressedIntermediateHandler, ---- apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/WsFrameBase.java 2019-12-07 17:53:05.000000000 +0100 -+++ apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/WsFrameBase.java 2020-01-20 10:42:16.535843952 +0100 +Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/WsFrameBase.java +=================================================================== +--- apache-tomcat-9.0.30-src.orig/java/org/apache/tomcat/websocket/WsFrameBase.java ++++ apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/WsFrameBase.java @@ -17,6 +17,7 @@ package org.apache.tomcat.websocket; @@ -2552,7 +2633,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat import java.nio.ByteBuffer; import java.nio.CharBuffer; import java.nio.charset.CharsetDecoder; -@@ -91,7 +92,7 @@ +@@ -91,7 +92,7 @@ public abstract class WsFrameBase { public WsFrameBase(WsSession wsSession, Transformation transformation) { inputBuffer = ByteBuffer.allocate(Constants.DEFAULT_BUFFER_SIZE); @@ -2561,7 +2642,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat messageBufferBinary = ByteBuffer.allocate(wsSession.getMaxBinaryMessageBufferSize()); messageBufferText = CharBuffer.allocate(wsSession.getMaxTextMessageBufferSize()); wsSession.setWsFrame(this); -@@ -257,11 +258,11 @@ +@@ -257,11 +258,11 @@ public abstract class WsFrameBase { if (payloadLength == 126) { payloadLength = byteArrayToLong(inputBuffer.array(), inputBuffer.arrayOffset() + inputBuffer.position(), 2); @@ -2575,7 +2656,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat } if (Util.isControl(opCode)) { if (payloadLength > 125) { -@@ -313,13 +314,13 @@ +@@ -313,13 +314,13 @@ public abstract class WsFrameBase { // Control messages have fixed message size so // TransformationResult.OVERFLOW is not possible here @@ -2591,7 +2672,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat // Payload must be zero or 2+ bytes long throw new WsIOException(new CloseReason( CloseCodes.PROTOCOL_ERROR, -@@ -331,8 +332,8 @@ +@@ -331,8 +332,8 @@ public abstract class WsFrameBase { CoderResult cr = utf8DecoderControl.decode(controlBufferBinary, controlBufferText, true); if (cr.isError()) { @@ -2602,7 +2683,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat throw new WsIOException(new CloseReason( CloseCodes.PROTOCOL_ERROR, sm.getString("wsFrame.invalidUtf8Close"))); -@@ -340,7 +341,7 @@ +@@ -340,7 +341,7 @@ public abstract class WsFrameBase { // There will be no overflow as the output buffer is big // enough. There will be no underflow as all the data is // passed to the decoder in a single call. @@ -2611,7 +2692,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat reason = controlBufferText.toString(); } } -@@ -357,17 +358,17 @@ +@@ -357,17 +358,17 @@ public abstract class WsFrameBase { } catch (Throwable t) { handleThrowableOnSend(t); } finally { @@ -2632,7 +2713,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat newFrame(); return true; } -@@ -397,7 +398,7 @@ +@@ -397,7 +398,7 @@ public abstract class WsFrameBase { } catch (Throwable t) { handleThrowableOnSend(t); } finally { @@ -2641,7 +2722,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat } } -@@ -408,7 +409,7 @@ +@@ -408,7 +409,7 @@ public abstract class WsFrameBase { while (!TransformationResult.END_OF_FRAME.equals(tr)) { // Frame not complete - we ran out of something // Convert bytes to UTF-8 @@ -2650,7 +2731,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat while (true) { CoderResult cr = utf8DecoderMessage.decode(messageBufferBinary, messageBufferText, false); -@@ -419,9 +420,9 @@ +@@ -419,9 +420,9 @@ public abstract class WsFrameBase { } else if (cr.isOverflow()) { // Ran out of space in text buffer - flush it if (usePartial()) { @@ -2662,7 +2743,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat } else { throw new WsIOException(new CloseReason( CloseCodes.TOO_BIG, -@@ -448,7 +449,7 @@ +@@ -448,7 +449,7 @@ public abstract class WsFrameBase { tr = transformation.getMoreData(opCode, fin, rsv, messageBufferBinary); } @@ -2671,7 +2752,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat boolean last = false; // Frame is fully received // Convert bytes to UTF-8 -@@ -462,9 +463,9 @@ +@@ -462,9 +463,9 @@ public abstract class WsFrameBase { } else if (cr.isOverflow()) { // Ran out of space in text buffer - flush it if (usePartial()) { @@ -2683,7 +2764,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat } else { throw new WsIOException(new CloseReason( CloseCodes.TOO_BIG, -@@ -477,9 +478,9 @@ +@@ -477,9 +478,9 @@ public abstract class WsFrameBase { // If partial messages are supported, send what we have // managed to decode if (usePartial()) { @@ -2695,7 +2776,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat } messageBufferBinary.compact(); newFrame(); -@@ -491,7 +492,7 @@ +@@ -491,7 +492,7 @@ public abstract class WsFrameBase { } } else { // End of message @@ -2704,7 +2785,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat sendMessageText(true); newMessage(); -@@ -519,12 +520,12 @@ +@@ -519,12 +520,12 @@ public abstract class WsFrameBase { Long.valueOf(payloadLength))); throw new WsIOException(cr); } @@ -2720,7 +2801,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat // Read more data tr = transformation.getMoreData(opCode, fin, rsv, messageBufferBinary); } -@@ -534,12 +535,12 @@ +@@ -534,12 +535,12 @@ public abstract class WsFrameBase { // - partial messages are supported // - the message is complete if (usePartial() || !continuationExpected) { @@ -2736,7 +2817,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat } if (continuationExpected) { -@@ -588,8 +589,8 @@ +@@ -588,8 +589,8 @@ public abstract class WsFrameBase { private void newMessage() { @@ -2747,7 +2828,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat utf8DecoderMessage.reset(); continuationExpected = false; newFrame(); -@@ -598,7 +599,7 @@ +@@ -598,7 +599,7 @@ public abstract class WsFrameBase { private void newFrame() { if (inputBuffer.remaining() == 0) { @@ -2756,7 +2837,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat } maskIndex = 0; -@@ -631,7 +632,7 @@ +@@ -631,7 +632,7 @@ public abstract class WsFrameBase { private void makeRoom() { inputBuffer.compact(); @@ -2765,7 +2846,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat } -@@ -649,7 +650,7 @@ +@@ -649,7 +650,7 @@ public abstract class WsFrameBase { private boolean swallowInput() { long toSkip = Math.min(payloadLength - payloadWritten, inputBuffer.remaining()); @@ -2774,7 +2855,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat payloadWritten += toSkip; if (payloadWritten == payloadLength) { if (continuationExpected) { -@@ -945,9 +946,9 @@ +@@ -945,9 +946,9 @@ public abstract class WsFrameBase { toWrite = Math.min(toWrite, dest.remaining()); int orgLimit = inputBuffer.limit(); @@ -2786,9 +2867,11 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat payloadWritten += toWrite; if (payloadWritten == payloadLength) { ---- apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/WsFrameClient.java 2019-12-07 17:53:05.000000000 +0100 -+++ apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/WsFrameClient.java 2020-01-20 10:47:43.889650987 +0100 -@@ -18,6 +18,7 @@ +Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/WsFrameClient.java +=================================================================== +--- apache-tomcat-9.0.30-src.orig/java/org/apache/tomcat/websocket/WsFrameClient.java ++++ apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/WsFrameClient.java +@@ -18,6 +18,7 @@ package org.apache.tomcat.websocket; import java.io.EOFException; import java.io.IOException; @@ -2796,7 +2879,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat import java.nio.ByteBuffer; import java.nio.channels.CompletionHandler; -@@ -76,8 +77,8 @@ +@@ -76,8 +77,8 @@ public class WsFrameClient extends WsFra // and then a new socket read will be performed return; } @@ -2807,7 +2890,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat int toCopy = Math.min(response.remaining(), inputBuffer.remaining()); -@@ -85,16 +86,16 @@ +@@ -85,16 +86,16 @@ public class WsFrameClient extends WsFra // frame processing int orgLimit = response.limit(); @@ -2828,7 +2911,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat // Get some more data if (isOpen()) { -@@ -159,7 +160,7 @@ +@@ -159,7 +160,7 @@ public class WsFrameClient extends WsFra // No data to process return; } @@ -2837,7 +2920,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat doResumeProcessing(true); } -@@ -169,7 +170,7 @@ +@@ -169,7 +170,7 @@ public class WsFrameClient extends WsFra // response will be empty if this exception is thrown response = ByteBuffer .allocate(((ReadBufferOverflowException) exc).getMinBufferSize()); @@ -2846,9 +2929,11 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat doResumeProcessing(false); } else { close(exc); ---- apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java 2019-12-07 17:53:05.000000000 +0100 -+++ apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java 2020-01-20 10:28:26.059200755 +0100 -@@ -20,6 +20,7 @@ +Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java +=================================================================== +--- apache-tomcat-9.0.30-src.orig/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java ++++ apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java +@@ -20,6 +20,7 @@ import java.io.IOException; import java.io.OutputStream; import java.io.Writer; import java.net.SocketTimeoutException; @@ -2856,7 +2941,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat import java.nio.ByteBuffer; import java.nio.CharBuffer; import java.nio.charset.CharsetEncoder; -@@ -240,13 +241,13 @@ +@@ -240,13 +241,13 @@ public abstract class WsRemoteEndpointIm long timeoutExpiry = getTimeoutExpiry(); boolean isDone = false; while (!isDone) { @@ -2872,7 +2957,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat sendMessageBlock(Constants.OPCODE_TEXT, encoderBuffer, last && isDone, timeoutExpiry); } stateMachine.complete(last); -@@ -321,7 +322,7 @@ +@@ -321,7 +322,7 @@ public abstract class WsRemoteEndpointIm } if (payload != null) { @@ -2881,7 +2966,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat } endMessage(null, null); -@@ -433,7 +434,7 @@ +@@ -433,7 +434,7 @@ public abstract class WsRemoteEndpointIm if (Constants.INTERNAL_OPCODE_FLUSH == mp.getOpCode()) { nextFragmented = fragmented; nextText = text; @@ -2890,7 +2975,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat SendHandler flushHandler = new OutputBufferFlushSendHandler( outputBuffer, mp.getEndHandler()); doWrite(flushHandler, mp.getBlockingWriteTimeoutExpiry(), outputBuffer); -@@ -482,10 +483,10 @@ +@@ -482,10 +483,10 @@ public abstract class WsRemoteEndpointIm mask = null; } @@ -2903,7 +2988,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat if (getBatchingAllowed() || isMasked()) { // Need to write via output buffer -@@ -798,13 +799,13 @@ +@@ -798,13 +799,13 @@ public abstract class WsRemoteEndpointIm } public void write() { @@ -2919,7 +3004,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat endpoint.startMessage(Constants.OPCODE_TEXT, buffer, isDone && isLast, this); } -@@ -865,7 +866,7 @@ +@@ -865,7 +866,7 @@ public abstract class WsRemoteEndpointIm } if (headerBuffer.hasRemaining()) { // Still more headers to write, need to flush @@ -2928,7 +3013,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat endpoint.doWrite(this, blockingWriteTimeoutExpiry, outputBuffer); return; } -@@ -879,7 +880,7 @@ +@@ -879,7 +880,7 @@ public abstract class WsRemoteEndpointIm if (payloadLeft > outputSpace) { toWrite = outputSpace; // Temporarily reduce the limit @@ -2937,7 +3022,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat } if (mask == null) { -@@ -897,15 +898,15 @@ +@@ -897,15 +898,15 @@ public abstract class WsRemoteEndpointIm if (payloadLeft > outputSpace) { // Restore the original limit @@ -2956,7 +3041,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat if (outputBuffer.remaining() == 0) { handler.onResult(SENDRESULT_OK); } else { -@@ -923,7 +924,7 @@ +@@ -923,7 +924,7 @@ public abstract class WsRemoteEndpointIm if (outputBuffer.hasRemaining()) { endpoint.doWrite(this, blockingWriteTimeoutExpiry, outputBuffer); } else { @@ -2965,7 +3050,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat write(); } } else { -@@ -949,7 +950,7 @@ +@@ -949,7 +950,7 @@ public abstract class WsRemoteEndpointIm @Override public void onResult(SendResult result) { if (result.isOK()) { @@ -2974,7 +3059,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat } handler.onResult(result); } -@@ -1042,11 +1043,11 @@ +@@ -1042,11 +1043,11 @@ public abstract class WsRemoteEndpointIm private void doWrite(boolean last) throws IOException { if (used) { @@ -2988,7 +3073,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat } } -@@ -1121,9 +1122,9 @@ +@@ -1121,9 +1122,9 @@ public abstract class WsRemoteEndpointIm private void doWrite(boolean last) throws IOException { if (used) { @@ -3000,9 +3085,11 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat } else { endpoint.stateMachine.complete(last); } ---- apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/WsSession.java 2019-12-07 17:53:05.000000000 +0100 -+++ apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/WsSession.java 2020-01-20 10:13:22.326124937 +0100 -@@ -18,6 +18,7 @@ +Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/WsSession.java +=================================================================== +--- apache-tomcat-9.0.30-src.orig/java/org/apache/tomcat/websocket/WsSession.java ++++ apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/WsSession.java +@@ -18,6 +18,7 @@ package org.apache.tomcat.websocket; import java.io.IOException; import java.net.URI; @@ -3010,7 +3097,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat import java.nio.ByteBuffer; import java.nio.channels.WritePendingException; import java.nio.charset.StandardCharsets; -@@ -607,7 +608,7 @@ +@@ -607,7 +608,7 @@ public class WsSession implements Sessio if (reason != null && reason.length() > 0) { appendCloseReasonWithTruncation(msg, reason); } @@ -3019,9 +3106,11 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat try { wsRemoteEndpoint.sendMessageBlock(Constants.OPCODE_CLOSE, msg, true); } catch (IOException | WritePendingException e) { ---- apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/WsWebSocketContainer.java 2019-12-07 17:53:05.000000000 +0100 -+++ apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/WsWebSocketContainer.java 2020-01-20 10:52:23.723195710 +0100 -@@ -27,6 +27,7 @@ +Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/WsWebSocketContainer.java +=================================================================== +--- apache-tomcat-9.0.30-src.orig/java/org/apache/tomcat/websocket/WsWebSocketContainer.java ++++ apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/WsWebSocketContainer.java +@@ -27,6 +27,7 @@ import java.net.ProxySelector; import java.net.SocketAddress; import java.net.URI; import java.net.URISyntaxException; @@ -3029,7 +3118,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat import java.nio.ByteBuffer; import java.nio.channels.AsynchronousChannelGroup; import java.nio.channels.AsynchronousSocketChannel; -@@ -742,7 +743,7 @@ +@@ -742,7 +743,7 @@ public class WsWebSocketContainer implem // Terminating CRLF result.put(CRLF); @@ -3038,7 +3127,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat return result; } -@@ -771,7 +772,7 @@ +@@ -771,7 +772,7 @@ public class WsWebSocketContainer implem newSize = input.capacity() * 2; } ByteBuffer expanded = ByteBuffer.allocate(newSize); @@ -3047,7 +3136,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat expanded.put(input); input = expanded; } -@@ -800,14 +801,14 @@ +@@ -800,14 +801,14 @@ public class WsWebSocketContainer implem while (!readHeaders) { // On entering loop buffer will be empty and at the start of a new // loop the buffer will have been fully read. @@ -3064,9 +3153,11 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat while (response.hasRemaining() && !readHeaders) { if (line == null) { line = readLine(response); ---- apache-tomcat-9.0.30-src/test/org/apache/coyote/http11/upgrade/TestUpgradeInternalHandler.java 2019-12-07 17:53:15.000000000 +0100 -+++ apache-tomcat-9.0.30-src/test/org/apache/coyote/http11/upgrade/TestUpgradeInternalHandler.java 2020-01-20 08:48:46.225260991 +0100 -@@ -25,6 +25,7 @@ +Index: apache-tomcat-9.0.30-src/test/org/apache/coyote/http11/upgrade/TestUpgradeInternalHandler.java +=================================================================== +--- apache-tomcat-9.0.30-src.orig/test/org/apache/coyote/http11/upgrade/TestUpgradeInternalHandler.java ++++ apache-tomcat-9.0.30-src/test/org/apache/coyote/http11/upgrade/TestUpgradeInternalHandler.java +@@ -25,6 +25,7 @@ import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.io.Writer; import java.net.Socket; @@ -3074,7 +3165,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat import java.nio.ByteBuffer; import java.nio.channels.CompletionHandler; import java.nio.charset.StandardCharsets; -@@ -215,7 +216,7 @@ +@@ -215,7 +216,7 @@ public class TestUpgradeInternalHandler } private void write(ByteBuffer buffer) { @@ -3083,9 +3174,11 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat CompletionState state = wrapper.write(BlockingMode.BLOCK, 10, TimeUnit.SECONDS, null, SocketWrapperBase.COMPLETE_WRITE, new CompletionHandler() { @Override public void completed(Long result, Void attachment) { ---- apache-tomcat-9.0.30-src/test/org/apache/coyote/http2/Http2TestBase.java 2019-12-07 17:53:15.000000000 +0100 -+++ apache-tomcat-9.0.30-src/test/org/apache/coyote/http2/Http2TestBase.java 2020-01-20 08:30:19.803288844 +0100 -@@ -23,6 +23,7 @@ +Index: apache-tomcat-9.0.30-src/test/org/apache/coyote/http2/Http2TestBase.java +=================================================================== +--- apache-tomcat-9.0.30-src.orig/test/org/apache/coyote/http2/Http2TestBase.java ++++ apache-tomcat-9.0.30-src/test/org/apache/coyote/http2/Http2TestBase.java +@@ -23,6 +23,7 @@ import java.io.InputStream; import java.io.OutputStream; import java.net.Socket; import java.net.SocketException; @@ -3093,7 +3186,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.util.ArrayList; -@@ -217,7 +218,7 @@ +@@ -217,7 +218,7 @@ public abstract class Http2TestBase exte if (padding != null) { headersPayload.put(padding); } @@ -3102,7 +3195,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat ByteUtil.setThreeBytes(frameHeader, 0, headersPayload.limit()); frameHeader[3] = FrameType.HEADERS.getIdByte(); -@@ -250,7 +251,7 @@ +@@ -250,7 +251,7 @@ public abstract class Http2TestBase exte } hpackEncoder.encode(mimeHeaders, headersPayload); @@ -3111,7 +3204,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat ByteUtil.setThreeBytes(frameHeader, 0, headersPayload.limit()); frameHeader[3] = FrameType.HEADERS.getIdByte(); -@@ -278,7 +279,7 @@ +@@ -278,7 +279,7 @@ public abstract class Http2TestBase exte } hpackEncoder.encode(mimeHeaders, headersPayload); @@ -3120,7 +3213,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat ByteUtil.setThreeBytes(frameHeader, 0, headersPayload.limit()); frameHeader[3] = FrameType.CONTINUATION.getIdByte(); -@@ -368,7 +369,7 @@ +@@ -368,7 +369,7 @@ public abstract class Http2TestBase exte } hpackEncoder.encode(headers, headersPayload); @@ -3129,7 +3222,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat ByteUtil.setThreeBytes(headersFrameHeader, 0, headersPayload.limit()); headersFrameHeader[3] = FrameType.HEADERS.getIdByte(); -@@ -380,18 +381,18 @@ +@@ -380,18 +381,18 @@ public abstract class Http2TestBase exte // Data if (padding != null) { dataPayload.put((byte) (padding.length & 0xFF)); @@ -3151,7 +3244,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat // Size ByteUtil.setThreeBytes(dataFrameHeader, 0, dataPayload.limit()); -@@ -413,7 +414,7 @@ +@@ -413,7 +414,7 @@ public abstract class Http2TestBase exte trailerHeaders.addValue(TRAILER_HEADER_NAME).setString(TRAILER_HEADER_VALUE); hpackEncoder.encode(trailerHeaders, trailersPayload); @@ -3160,7 +3253,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat ByteUtil.setThreeBytes(trailersFrameHeader, 0, trailersPayload.limit()); trailersFrameHeader[3] = FrameType.HEADERS.getIdByte(); -@@ -989,7 +990,7 @@ +@@ -989,7 +990,7 @@ public abstract class Http2TestBase exte if (bodyBuffer != null) { if (bodyBuffer.limit() > 0) { trace.append(lastStreamId + "-Body-"); @@ -3169,8 +3262,10 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat while (bodyBuffer.hasRemaining()) { trace.append((char) bodyBuffer.get()); } ---- apache-tomcat-9.0.30-src/test/org/apache/coyote/http2/TestHpack.java 2019-12-07 17:53:15.000000000 +0100 -+++ apache-tomcat-9.0.30-src/test/org/apache/coyote/http2/TestHpack.java 2020-01-20 08:39:21.734214027 +0100 +Index: apache-tomcat-9.0.30-src/test/org/apache/coyote/http2/TestHpack.java +=================================================================== +--- apache-tomcat-9.0.30-src.orig/test/org/apache/coyote/http2/TestHpack.java ++++ apache-tomcat-9.0.30-src/test/org/apache/coyote/http2/TestHpack.java @@ -16,6 +16,7 @@ */ package org.apache.coyote.http2; @@ -3179,7 +3274,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat import java.nio.ByteBuffer; import org.junit.Assert; -@@ -34,13 +35,13 @@ +@@ -34,13 +35,13 @@ public class TestHpack { ByteBuffer output = ByteBuffer.allocate(512); HpackEncoder encoder = new HpackEncoder(); encoder.encode(headers, output); @@ -3196,7 +3291,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat // Size is now 3 after using the table Assert.assertEquals(3, output.remaining()); } -@@ -54,15 +55,15 @@ +@@ -54,15 +55,15 @@ public class TestHpack { ByteBuffer output = ByteBuffer.allocate(512); HpackEncoder encoder = new HpackEncoder(); encoder.encode(headers, output); @@ -3215,7 +3310,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat headers2.recycle(); Assert.assertEquals(3, output.remaining()); // Check that the decoder is using the table right -@@ -120,7 +121,7 @@ +@@ -120,7 +121,7 @@ public class TestHpack { // by another byte output.array()[7] = (byte) -122; output.put((byte) -1); @@ -3224,7 +3319,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat MimeHeaders headers2 = new MimeHeaders(); HpackDecoder decoder = new HpackDecoder(); decoder.setHeaderEmitter(new HeadersListener(headers2)); -@@ -136,7 +137,7 @@ +@@ -136,7 +137,7 @@ public class TestHpack { ByteBuffer output = ByteBuffer.allocate(512); HpackEncoder encoder = new HpackEncoder(); encoder.encode(headers, output); @@ -3233,8 +3328,10 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat MimeHeaders headers2 = new MimeHeaders(); HpackDecoder decoder = new HpackDecoder(); decoder.setHeaderEmitter(new HeadersListener(headers2)); ---- apache-tomcat-9.0.30-src/test/org/apache/coyote/http2/TestHttp2Limits.java 2019-12-07 17:53:15.000000000 +0100 -+++ apache-tomcat-9.0.30-src/test/org/apache/coyote/http2/TestHttp2Limits.java 2020-01-20 08:35:41.669026197 +0100 +Index: apache-tomcat-9.0.30-src/test/org/apache/coyote/http2/TestHttp2Limits.java +=================================================================== +--- apache-tomcat-9.0.30-src.orig/test/org/apache/coyote/http2/TestHttp2Limits.java ++++ apache-tomcat-9.0.30-src/test/org/apache/coyote/http2/TestHttp2Limits.java @@ -17,6 +17,7 @@ package org.apache.coyote.http2; @@ -3243,7 +3340,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.List; -@@ -290,7 +291,7 @@ +@@ -290,7 +291,7 @@ public class TestHttp2Limits extends Htt if (state != State.COMPLETE) { throw new Exception("Unable to build headers"); } @@ -3252,8 +3349,10 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat log.debug("Headers payload generated of size [" + headersPayload.limit() + "]"); } ---- apache-tomcat-9.0.30-src/test/org/apache/coyote/http2/TestHttp2Section_8_1.java 2019-12-07 17:53:16.000000000 +0100 -+++ apache-tomcat-9.0.30-src/test/org/apache/coyote/http2/TestHttp2Section_8_1.java 2020-01-20 08:45:36.024234324 +0100 +Index: apache-tomcat-9.0.30-src/test/org/apache/coyote/http2/TestHttp2Section_8_1.java +=================================================================== +--- apache-tomcat-9.0.30-src.orig/test/org/apache/coyote/http2/TestHttp2Section_8_1.java ++++ apache-tomcat-9.0.30-src/test/org/apache/coyote/http2/TestHttp2Section_8_1.java @@ -16,6 +16,7 @@ */ package org.apache.coyote.http2; @@ -3262,7 +3361,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.List; -@@ -186,7 +187,7 @@ +@@ -186,7 +187,7 @@ public class TestHttp2Section_8_1 extend headers.clear(); headers.add(new Header(":authority", "localhost:" + getPort())); @@ -3271,8 +3370,10 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat buildSimpleGetRequestPart2(headersFrameHeader, headersPayload, headers , 3); ---- apache-tomcat-9.0.30-src/test/org/apache/tomcat/util/buf/TestUtf8.java 2019-12-07 17:53:18.000000000 +0100 -+++ apache-tomcat-9.0.30-src/test/org/apache/tomcat/util/buf/TestUtf8.java 2020-01-20 09:00:05.388933377 +0100 +Index: apache-tomcat-9.0.30-src/test/org/apache/tomcat/util/buf/TestUtf8.java +=================================================================== +--- apache-tomcat-9.0.30-src.orig/test/org/apache/tomcat/util/buf/TestUtf8.java ++++ apache-tomcat-9.0.30-src/test/org/apache/tomcat/util/buf/TestUtf8.java @@ -16,6 +16,7 @@ */ package org.apache.tomcat.util.buf; @@ -3281,7 +3382,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat import java.nio.ByteBuffer; import java.nio.CharBuffer; import java.nio.charset.CharsetDecoder; -@@ -579,7 +580,7 @@ +@@ -579,7 +580,7 @@ public class TestUtf8 { // an invalid sequence has been provided for (int i = 0; i < len; i++) { bb.put((byte) testCase.input[i]); @@ -3290,7 +3391,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat CoderResult cr = decoder.decode(bb, cb, false); if (cr.isError()) { int expected = testCase.invalidIndex; -@@ -604,11 +605,11 @@ +@@ -604,11 +605,11 @@ public class TestUtf8 { decoder.onUnmappableCharacter(CodingErrorAction.REPLACE); // Add each byte one at a time. @@ -3305,7 +3406,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat CoderResult cr = decoder.decode(bb, cb, false); if (cr.isError()) { Assert.fail(testCase.description); -@@ -617,12 +618,12 @@ +@@ -617,12 +618,12 @@ public class TestUtf8 { } // For incomplete sequences at the end of the input need to tell // the decoder the input has ended @@ -3320,9 +3421,11 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat String expected = testCase.outputReplaced; if ((flags & REPLACE_SWALLOWS_TRAILER) != 0) { ---- apache-tomcat-9.0.30-src/test/org/apache/tomcat/websocket/pojo/TestEncodingDecoding.java 2019-12-07 17:53:20.000000000 +0100 -+++ apache-tomcat-9.0.30-src/test/org/apache/tomcat/websocket/pojo/TestEncodingDecoding.java 2020-01-20 08:51:01.857993078 +0100 -@@ -18,6 +18,7 @@ +Index: apache-tomcat-9.0.30-src/test/org/apache/tomcat/websocket/pojo/TestEncodingDecoding.java +=================================================================== +--- apache-tomcat-9.0.30-src.orig/test/org/apache/tomcat/websocket/pojo/TestEncodingDecoding.java ++++ apache-tomcat-9.0.30-src/test/org/apache/tomcat/websocket/pojo/TestEncodingDecoding.java +@@ -18,6 +18,7 @@ package org.apache.tomcat.websocket.pojo import java.io.IOException; import java.net.URI; @@ -3330,7 +3433,7 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.Collections; -@@ -604,7 +605,7 @@ +@@ -604,7 +605,7 @@ public class TestEncodingDecoding extend reply.put((byte) 0x12); reply.put((byte) 0x34); reply.put(data); @@ -3339,3 +3442,29 @@ Only in apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/http/parser: tomcat return reply; } } +Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/server/WsFrameServer.java +=================================================================== +--- apache-tomcat-9.0.30-src.orig/java/org/apache/tomcat/websocket/server/WsFrameServer.java ++++ apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/server/WsFrameServer.java +@@ -19,6 +19,7 @@ package org.apache.tomcat.websocket.serv + import java.io.EOFException; + import java.io.IOException; + import java.nio.ByteBuffer; ++import java.nio.Buffer; + + import org.apache.juli.logging.Log; + import org.apache.juli.logging.LogFactory; +@@ -67,10 +68,10 @@ public class WsFrameServer extends WsFra + + while (isOpen() && !isSuspended()) { + // Fill up the input buffer with as much data as we can +- inputBuffer.mark(); +- inputBuffer.position(inputBuffer.limit()).limit(inputBuffer.capacity()); ++ ((Buffer)inputBuffer).mark(); ++ ((Buffer)inputBuffer).position(inputBuffer.limit()).limit(inputBuffer.capacity()); + int read = socketWrapper.read(false, inputBuffer); +- inputBuffer.limit(inputBuffer.position()).reset(); ++ ((Buffer)inputBuffer).limit(inputBuffer.position()).reset(); + if (read < 0) { + throw new EOFException(); + } else if (read == 0) { diff --git a/tomcat.changes b/tomcat.changes index cc0f352..fa58faf 100644 --- a/tomcat.changes +++ b/tomcat.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Wed Jan 29 16:49:29 UTC 2020 - Matei Albu + +- Modified patch: + * tomcat-9.0.30-java8compat.patch + + add missing casts (bsc#1162081) + ------------------------------------------------------------------- Mon Jan 20 13:36:39 UTC 2020 - Fridrich Strba