Skip to content

Commit 88be613

Browse files
committed
Merge branch 'main' of git@github.com:apache/tomcat.git into main
2 parents 8949618 + a8219bf commit 88be613

51 files changed

Lines changed: 2230 additions & 1749 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/codeql.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ jobs:
5959
queries: security-and-quality
6060
config: |
6161
paths-ignore:
62-
- 'test/**'
62+
- '**/test/**'
6363
# If you wish to specify custom queries, you can do so here or in a config file.
6464
# By default, queries listed here will override any specified in a config file.
6565
# Prefix the list here with "+" to use these queries and those in the config file.

‎TODO.md‎

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -930,16 +930,6 @@ These are bugs, correctness issues, or missing functionality that may affect pro
930930

931931
---
932932

933-
### 88. Annotation Test Type Inconsistency (1 item)
934-
935-
| # | File:Line | Description | Fix Idea | Effort | Difficulty |
936-
|---|-----------|-------------|----------|--------|------------|
937-
| 88.1 | `TestContextConfigAnnotation.java:243` | `servletDef` is Boolean, `FilterDef` is String - inconsistent | Investigate why the types differ. If it's a bug, fix the annotation processing. If intentional, document. | 0.5-1 day | Low |
938-
939-
**Total estimated effort: 0.5-1 day, Low difficulty**
940-
941-
---
942-
943933
### 89. Example WebSocket Drawboard (5 items)
944934

945935
| # | File:Line | Description | Fix Idea | Effort | Difficulty |

‎build.xml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2770,6 +2770,7 @@
27702770
<filename name="work/**" />
27712771
<filename name="modules/jdbc-pool/bin/**" />
27722772
<filename name="modules/jdbc-pool/includes/**" />
2773+
<filename name="modules/jdbc-pool/target/**" />
27732774
<and>
27742775
<!-- exclude all modules except jdbc-pool -->
27752776
<filename name="modules/**" />

‎java/jakarta/el/ELProcessor.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ private static class MethodSignature {
313313
if (paramString.isEmpty()) {
314314
parameterTypeNames = EMPTY_STRING_ARRAY;
315315
} else {
316-
parameterTypeNames = paramString.split(",");
316+
parameterTypeNames = paramString.split(",", -1);
317317
ImportHandler importHandler = context.getImportHandler();
318318
for (int i = 0; i < parameterTypeNames.length; i++) {
319319
String parameterTypeName = parameterTypeNames[i].strip();

‎java/org/apache/catalina/core/ApplicationFilterChain.java‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,9 @@ public void doFilter(ServletRequest request, ServletResponse response) throws IO
104104
ApplicationFilterConfig filterConfig = filters[pos++];
105105
try {
106106
Filter filter = filterConfig.getFilter();
107+
Boolean asyncSupported = filterConfig.getFilterDef().getAsyncSupported();
107108

108-
if (request.isAsyncSupported() && !(filterConfig.getFilterDef().getAsyncSupportedBoolean())) {
109+
if (request.isAsyncSupported() && (asyncSupported == null || !asyncSupported.booleanValue())) {
109110
request.setAttribute(Globals.ASYNC_SUPPORTED_ATTR, Boolean.FALSE);
110111
}
111112
filter.doFilter(request, response, this);
@@ -240,7 +241,8 @@ void setDispatcherWrapsSameObject(boolean dispatcherWrapsSameObject) {
240241
public void findNonAsyncFilters(Set<String> result) {
241242
for (int i = 0; i < n; i++) {
242243
ApplicationFilterConfig filter = filters[i];
243-
if (!(filter.getFilterDef().getAsyncSupportedBoolean())) {
244+
Boolean asyncSupported = filter.getFilterDef().getAsyncSupported();
245+
if (asyncSupported == null || !asyncSupported.booleanValue()) {
244246
result.add(filter.getFilterClass());
245247
}
246248
}

‎java/org/apache/coyote/AbstractProtocol.java‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1676,7 +1676,11 @@ public RecycledProcessors(ConnectionHandler<?> handler) {
16761676
}
16771677

16781678
/**
1679-
* Pushes a processor to the pool.
1679+
* Pushes a processor to the pool. A processor that is not reusable is
1680+
* not added to the pool and is unregistered instead. This may happen,
1681+
* for example, after an asynchronous timeout or error while an
1682+
* application thread was blocked in a write. Reusing such a processor
1683+
* could write stale data to another request.
16801684
*
16811685
* @param processor The processor
16821686
*
@@ -1685,6 +1689,13 @@ public RecycledProcessors(ConnectionHandler<?> handler) {
16851689
@SuppressWarnings("sync-override") // Size may exceed cache size a bit
16861690
@Override
16871691
public boolean push(Processor processor) {
1692+
if (!processor.isReusable()) {
1693+
// Also make sure any waiting-processor registration is
1694+
// removed before the processor is unregistered.
1695+
handler.getProtocol().removeWaitingProcessor(processor);
1696+
handler.unregister(processor);
1697+
return false;
1698+
}
16881699
int cacheSize = handler.getProtocol().getProcessorCache();
16891700
boolean offer = cacheSize == -1 || size.get() < cacheSize;
16901701
// avoid over growing our cache or add after we have stopped

‎java/org/apache/coyote/Processor.java‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,19 @@ public interface Processor {
8989
*/
9090
void recycle();
9191

92+
/**
93+
* Whether this processor may be returned to the shared processor pool
94+
* after {@link #recycle()}. A processor must not be reused if a
95+
* non-container thread may still be using its request, response or
96+
* output state (for example after an asynchronous timeout or error
97+
* while an application thread was blocked in a write).
98+
*
99+
* @return {@code true} if the processor may be pooled for reuse
100+
*/
101+
default boolean isReusable() {
102+
return true;
103+
}
104+
92105
/**
93106
* Set the SSL information for this HTTP connection.
94107
*

‎java/org/apache/coyote/http11/Http11Processor.java‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1468,6 +1468,9 @@ private SendfileState processSendfile(SocketWrapperBase<?> socketWrapper) {
14681468
if (sendfileData != null && !getErrorState().isError()) {
14691469
if (keepAlive) {
14701470
if (available(false) == 0) {
1471+
// If sendfile does not complete inline, the endpoint will register the socket for read once it
1472+
// does, without returning to this processor. Set the keep-alive timeout for the next request now.
1473+
socketWrapper.setReadTimeout(protocol.getKeepAliveTimeout());
14711474
sendfileData.keepAliveState = SendfileKeepAliveState.OPEN;
14721475
} else {
14731476
sendfileData.keepAliveState = SendfileKeepAliveState.PIPELINED;

‎java/org/apache/coyote/http2/Http2Parser.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ protected void readDataFrame(int streamId, int flags, int payloadSize, ByteBuffe
202202
} else {
203203
synchronized (dest) {
204204
if (dest.remaining() < dataLength) {
205-
// Client has sent more data than permitted by Window size
205+
// Client has sent more data than permitted by the stream flow-control window.
206206
swallowPayload(streamId, FrameType.DATA.getId(), dataLength, false, buffer);
207207
if (Flags.hasPadding(flags)) {
208208
swallowPayload(streamId, FrameType.DATA.getId(), padLength, true, buffer);

‎java/org/apache/coyote/http2/Http2UpgradeHandler.java‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1970,9 +1970,11 @@ public void setting(Setting setting, long value) throws ConnectionException {
19701970
try {
19711971
stream.incrementWindowSize(diff);
19721972
} catch (Http2Exception h2e) {
1973-
((Stream) stream).close(new StreamException(
1973+
// Per RFC 9113 section 6.9.2, a change to SETTINGS_INITIAL_WINDOW_SIZE that
1974+
// causes any flow-control window to exceed the maximum size is a connection error.
1975+
throw new ConnectionException(
19741976
sm.getString("upgradeHandler.windowSizeTooBig", connectionId, stream.getIdAsString()),
1975-
h2e.getError(), stream.getIdAsInt()));
1977+
Http2Error.FLOW_CONTROL_ERROR, h2e);
19761978
}
19771979
}
19781980
} else if (setting == Setting.NO_RFC7540_PRIORITIES) {

0 commit comments

Comments
 (0)