Merge remote-tracking branch 'origin/jetty-10.0.x' into jetty-11.0.x

This commit is contained in:
Jan Bartel 2022-02-08 14:32:14 +11:00
commit 937cb5df95
4 changed files with 148 additions and 32 deletions

View File

@ -128,6 +128,34 @@ jetty-10.0.8 - 07 February 2022
+ 7524 Missing package in JmxConfiguration
+ 7529 Upgrade quiche to version 0.11.0
jetty-9.4.45.v20220203 - 03 February 2022
+ 4275 Path Normalization/Traversal - Context Matching
+ 6497 Replace SameFileAliasChecker
+ 6687 Upgrade Infinispan in all active Jetty branches
+ 6965 Expose Spec `ServerContainer.upgrade()` API
+ 6969 Getting 404 failures when trying to enable `logging-log4j` module.
+ 6974 Major websocket memory change in 9.4.36
+ 7031 ResponseWriter.println(char) does not print newline
+ 7059 NPE in AllowedResourceAliasChecker.getPath()
+ 7073 Error in parse parameter in broken UTF-8 encoding
+ 7078 CompressionPools are not shared between multiple contexts for 9.4
WebSocket
+ 7107 Client timeout and async close exceptions when setting max duration on
pool
+ 7124 Add default methods on LifeCycle.Listener interface
+ 7157 Multiplexed connection pools retain CLOSED entries
+ 7243 Reset pooled ByteBuffer endianness
+ 7266 Wrong ALPN jars are selected for newer versions of JDK8
+ 7271 It is necessary to set MAX_CAPACITY to ArrayTernaryTrie/ArrayTrie
+ 7277 Allow override of `ServletRequest.getLocalName()` and `.getLocalPort()`
in post-intermediary scenarios
+ 7297 Deprecate log4j 1.x support
+ 7348 Slow CONNECT request causes NPE
+ 7375 Some environments require Request scoping during session save
+ 7435 Investigate Infinispan transitive dependencies
+ 7440 ContextHandler.getAliasChecks() breaks Spring Boot
+ 7496 Transient 400: Bad Request responses in jetty-9.4.45.v20220128
jetty-11.0.7 - 06 October 2021
+ 3514 Use interpolation of versions from pom in mod files
+ 6043 Reimplement UnixSocket support based on Java 16
@ -246,6 +274,32 @@ jetty-10.0.7 - 06 October 2021
+ 6883 Welcome file redirects do not honor the relativeRedirectAllowed option
+ 6938 module-info.java file do not use the canonical order for the elements
jetty-9.4.44.v20210927 - 27 September 2021
+ 3514 Use interpolation of versions from pom in mod files
+ 6369 Increment default jetty.http2.rateControl.maxEventsPerSecond
+ 6372 Review socket options configuration
+ 6487 Expose ServletHolder getter in ServletHandler$ChainEnd for auditing
libraries to use
+ 6491 onDataAvailable() not called when HttpParser is closed prematurely
+ 6520 Error page has HTML error when writePoweredBy is enabled
+ 6545 image/webp MIME type support
+ 6553 Review usage of Authentication.UNAUTHENTICATED in SecurityHandler
+ 6554 Allow creation of DefaultIdentityService without realmName
+ 6558 Allow to configure return type in JSON array parsing
+ 6562 HttpOutput.write(ByteBuffer buffer)
+ 6603 HTTP/2 max local stream count exceeded
+ 6617 Add basic auth support for OpenId token endpoint (client_secret_basic)
+ 6618 ID token `azp` claim should not be required if `aud` is single value
array
+ 6652 Improve ReservedThreadExecutor dump
+ 6671 Update to apache jsp 8.5.70
+ 6772 Update to asm 9.2
+ 6853 Remove pack200 plugins
+ 6860 Correct IPv6 format
+ 6869 Correct Content-Type within HTML error pages
+ 6870 Encode control characters in URIUtil.encodePath
+ 6883 Welcome file redirects do not honor the relativeRedirectAllowed option
jetty-11.0.6 - 29 June 2021
+ 6375 Always check XML `Set` elements with `property` attribute
+ 6382 HttpClient TimeoutException message reports transient values

View File

@ -293,10 +293,12 @@ public class QoSFilter implements Filter
* for the semaphore to become available before suspending a request.
*
* @param value wait time (in milliseconds)
* @deprecated use init-param waitMs instead
*/
@Deprecated
public void setWaitMs(long value)
{
_waitMs = value;
LOG.warn("Setter ignored: use waitMs init-param for QoSFilter");
}
/**
@ -316,10 +318,12 @@ public class QoSFilter implements Filter
* a request for while waiting for the semaphore to become available.
*
* @param value suspend time (in milliseconds)
* @deprecated use init-param suspendMs instead
*/
@Deprecated
public void setSuspendMs(long value)
{
_suspendMs = value;
LOG.warn("Setter ignored: use suspendMs init-param for QoSFilter");
}
/**
@ -339,11 +343,12 @@ public class QoSFilter implements Filter
* at the same time.
*
* @param value the number of requests
* @deprecated use init-param maxRequests instead
*/
@Deprecated
public void setMaxRequests(int value)
{
_passes = new Semaphore((value - getMaxRequests() + _passes.availablePermits()), true);
_maxRequests = value;
LOG.warn("Setter ignored: use maxRequests init-param for QoSFilter instead");
}
private class QoSAsyncListener implements AsyncListener

View File

@ -231,44 +231,46 @@ class TreeTrie<V> extends AbstractTrie<V>
return getBest(_root, b, offset, len);
}
private V getBest(Node<V> t, byte[] b, int offset, int len)
private V getBest(Node<V> node, byte[] b, int offset, int len)
{
for (int i = 0; i < len; i++)
{
Node<V> next;
byte c = b[offset + i];
int index = c >= 0 && c < 0x7f ? _lookup[c] : -1;
if (index >= 0)
{
if (t._nextIndex[index] == null)
if (node._nextIndex[index] == null)
break;
t = t._nextIndex[index];
next = node._nextIndex[index];
}
else
{
Node<V> n = null;
for (int j = t._nextOther.size(); j-- > 0; )
for (int j = node._nextOther.size(); j-- > 0; )
{
n = t._nextOther.get(j);
n = node._nextOther.get(j);
if (n._c == c)
break;
n = null;
}
if (n == null)
break;
t = n;
next = n;
}
// Is the next Trie is a match
if (t._key != null)
if (node._key != null)
{
// Recurse so we can remember this possibility
V best = getBest(t, b, offset + i + 1, len - i - 1);
V best = getBest(next, b, offset + i + 1, len - i - 1);
if (best != null)
return best;
break;
}
node = next;
}
return t._value;
return node._value;
}
@Override
@ -289,44 +291,47 @@ class TreeTrie<V> extends AbstractTrie<V>
return getBest(_root, s, offset, len);
}
private V getBest(Node<V> t, String s, int offset, int len)
private V getBest(Node<V> node, String s, int offset, int len)
{
for (int i = 0; i < len; i++)
{
Node<V> next;
char c = s.charAt(offset + i);
int index = c < 0x7f ? _lookup[c] : -1;
if (index >= 0)
{
if (t._nextIndex[index] == null)
if (node._nextIndex[index] == null)
break;
t = t._nextIndex[index];
next = node._nextIndex[index];
}
else
{
Node<V> n = null;
for (int j = t._nextOther.size(); j-- > 0; )
for (int j = node._nextOther.size(); j-- > 0; )
{
n = t._nextOther.get(j);
n = node._nextOther.get(j);
if (n._c == c)
break;
n = null;
}
if (n == null)
break;
t = n;
next = n;
}
// Is the next Trie is a match
if (t._key != null)
if (node._key != null)
{
// Recurse so we can remember this possibility
V best = getBest(t, s, offset + i + 1, len - i - 1);
V best = getBest(next, s, offset + i + 1, len - i - 1);
if (best != null)
return best;
break;
}
node = next;
}
return t._value;
return node._value;
}
@Override
@ -337,8 +342,9 @@ class TreeTrie<V> extends AbstractTrie<V>
return getBest(_root, b, offset, len);
}
private V getBest(Node<V> t, ByteBuffer b, int offset, int len)
private V getBest(Node<V> node, ByteBuffer b, int offset, int len)
{
Node<V> next;
int pos = b.position() + offset;
for (int i = 0; i < len; i++)
{
@ -346,36 +352,37 @@ class TreeTrie<V> extends AbstractTrie<V>
int index = c >= 0 && c < 0x7f ? _lookup[c] : -1;
if (index >= 0)
{
if (t._nextIndex[index] == null)
if (node._nextIndex[index] == null)
break;
t = t._nextIndex[index];
next = node._nextIndex[index];
}
else
{
Node<V> n = null;
for (int j = t._nextOther.size(); j-- > 0; )
for (int j = node._nextOther.size(); j-- > 0; )
{
n = t._nextOther.get(j);
n = node._nextOther.get(j);
if (n._c == c)
break;
n = null;
}
if (n == null)
break;
t = n;
next = n;
}
// Is the next Trie is a match
if (t._key != null)
if (node._key != null)
{
// Recurse so we can remember this possibility
V best = getBest(t, b, offset + i + 1, len - i - 1);
V best = getBest(next, b, offset + i + 1, len - i - 1);
if (best != null)
return best;
break;
}
node = next;
}
return t._value;
return node._value;
}
@Override

View File

@ -29,9 +29,10 @@ import org.junit.jupiter.params.provider.MethodSource;
import static org.eclipse.jetty.util.AbstractTrie.requiredCapacity;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.nullValue;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
@ -115,6 +116,20 @@ public class TrieTest
return impls.stream().map(Arguments::of);
}
public static Stream<Arguments> emptyImplementations()
{
List<AbstractTrie<Integer>> impls = new ArrayList<>();
for (boolean caseSensitive : new boolean[] {true, false})
{
impls.add(new ArrayTrie<Integer>(caseSensitive, 128));
impls.add(new ArrayTernaryTrie<Integer>(caseSensitive, 128));
impls.add(new TreeTrie<>(caseSensitive));
}
return impls.stream().map(Arguments::of);
}
@ParameterizedTest
@MethodSource("implementations")
public void testOverflow(AbstractTrie<Integer> trie) throws Exception
@ -432,6 +447,38 @@ public class TrieTest
assertThat(trie.getBest(key + ";xxxx"), is(103));
}
@ParameterizedTest
@MethodSource("emptyImplementations")
public void testHttp(AbstractTrie<Integer> trie)
{
trie.put("Host:", 1);
trie.put("Host: name", 2);
assertThat(trie.getBest("Other: header\r\n"), nullValue());
assertThat(trie.getBest("Host: other\r\n"), is(1));
assertThat(trie.getBest("Host: name\r\n"), is(2));
if (trie.isCaseInsensitive())
assertThat(trie.getBest("HoSt: nAme\r\n"), is(2));
else
assertThat(trie.getBest("HoSt: nAme\r\n"), nullValue());
assertThat(trie.getBest(BufferUtil.toBuffer("Other: header\r\n")), nullValue());
assertThat(trie.getBest(BufferUtil.toBuffer("Host: other\r\n")), is(1));
assertThat(trie.getBest(BufferUtil.toBuffer("Host: name\r\n")), is(2));
if (trie.isCaseInsensitive())
assertThat(trie.getBest(BufferUtil.toBuffer("HoSt: nAme\r\n")), is(2));
else
assertThat(trie.getBest(BufferUtil.toBuffer("HoSt: nAme\r\n")), nullValue());
assertThat(trie.getBest(BufferUtil.toDirectBuffer("Other: header\r\n")), nullValue());
assertThat(trie.getBest(BufferUtil.toDirectBuffer("Host: other\r\n")), is(1));
assertThat(trie.getBest(BufferUtil.toDirectBuffer("Host: name\r\n")), is(2));
if (trie.isCaseInsensitive())
assertThat(trie.getBest(BufferUtil.toDirectBuffer("HoSt: nAme\r\n")), is(2));
else
assertThat(trie.getBest(BufferUtil.toDirectBuffer("HoSt: nAme\r\n")), nullValue());
}
@Test
public void testArrayTrieCapacity()
{
@ -441,5 +488,8 @@ public class TrieTest
assertThat(trie.get(huge), is("wow"));
assertThrows(IllegalArgumentException.class, () -> new ArrayTrie<String>(Character.MAX_VALUE + 1));
assertThat(trie.keySet(), contains(huge));
assertThat(trie.toString(), containsString(huge));
}
}