Skip to content

Commit d794b7f

Browse files
author
Alessio
authored
Merge branch 'apache:main' into main
2 parents a5a025f + c178a61 commit d794b7f

File tree

145 files changed

+2655
-1807
lines changed

Some content is hidden

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

145 files changed

+2655
-1807
lines changed

.github/dependabot.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
1-
# To get started with Dependabot version updates, you'll need to specify which
2-
# package ecosystems to update and where the package manifests are located.
1+
# Licensed under the Apache License, Version 2.0 (the "License");
2+
# you may not use this file except in compliance with the License.
3+
# You may obtain a copy of the License at
4+
#
5+
# http://www.apache.org/licenses/LICENSE-2.0
6+
#
7+
# Unless required by applicable law or agreed to in writing, software
8+
# distributed under the License is distributed on an "AS IS" BASIS,
9+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
# See the License for the specific language governing permissions and
11+
# limitations under the License.
12+
313
# Please see the documentation for all configuration options:
414
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
515

.github/workflows/ci-macos.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@ jobs:
2727
JDKxx_Matrix:
2828
strategy:
2929
fail-fast: false
30-
name: JDK24 macos-latest
30+
name: JDK25 macos-latest
3131
runs-on: macos-latest
3232
steps:
3333
- name: Git Checkout
3434
uses: actions/checkout@v5
3535
- name: Set up Java
3636
uses: actions/setup-java@v5
3737
with:
38-
java-version: 24
38+
java-version: 25
3939
distribution: zulu
4040
- name: Build
4141
run: |
@@ -47,7 +47,7 @@ jobs:
4747
if: ${{ !cancelled() }}
4848
uses: actions/upload-artifact@v4
4949
with:
50-
name: JDK24-macos-latest-logs
50+
name: JDK25-macos-latest-logs
5151
path: |
5252
hs_err_*.log
5353
output/build/logs/TEST*.txt

.github/workflows/ci.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,21 +33,19 @@ jobs:
3333
matrix:
3434
isMain:
3535
- ${{ contains(github.ref, 'main') }}
36-
java: [ 21, 24, 25-ea ]
36+
java: [ 21, 25, 26-ea ]
3737
os: [ ubuntu-latest, windows-latest, macos-latest ]
3838
exclude:
3939
- os: windows-latest
4040
java: 21
4141
- os: macos-latest
4242
java: 21
43-
- os: ubuntu-latest
44-
java: 24
4543
- os: windows-latest
46-
java: 24
44+
java: 25
4745
- os: macos-latest
48-
java: 24
46+
java: 25
4947
- os: macos-latest
50-
java: 25-ea
48+
java: 26-ea
5149
name: JDK${{ matrix.java }} ${{ matrix.os }}
5250
runs-on: ${{ matrix.os }}
5351
steps:

.github/workflows/coverity.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
# Licensed under the Apache License, Version 2.0 (the "License");
2+
# you may not use this file except in compliance with the License.
3+
# You may obtain a copy of the License at
4+
#
5+
# http://www.apache.org/licenses/LICENSE-2.0
6+
#
7+
# Unless required by applicable law or agreed to in writing, software
8+
# distributed under the License is distributed on an "AS IS" BASIS,
9+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
# See the License for the specific language governing permissions and
11+
# limitations under the License.
12+
113
# Build Tomcat using the Coverity Build Tool and upload the analysis results to scan.covertiy.com
214
name: Coverity Scan
315

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ the issues marked 'Beginner', link below. Please note that the Beginner keyword
4343
is pretty new to the project, so if there aren't any issues in the filter feel
4444
free to ask on the [dev list](https://tomcat.apache.org/lists.html#tomcat-dev).
4545

46-
* [Beginner issues](https://bz.apache.org/bugzilla/buglist.cgi?bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&bug_status=NEEDINFO&keywords=Beginner&keywords_type=allwords&list_id=160824&product=Tomcat%207&product=Tomcat%208.5&product=Tomcat%209&query_format=advanced) -
46+
* [Beginner issues](https://bz.apache.org/bugzilla/buglist.cgi?bug_status=__open__&keywords=Beginner&keywords_type=allwords&product=Tomcat%209&product=Tomcat%2010&product=Tomcat%2011&query_format=advanced) -
4747
issues which should only require a few lines of code, and a test or two to
4848
resolve.
4949

java/org/apache/catalina/Container.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ static Service getService(Container container) {
429429
*
430430
* @param request Request (associated with the response) to log
431431
* @param response Response (associated with the request) to log
432-
* @param time Time taken to process the request/response in milliseconds (use 0 if not known)
432+
* @param time Time taken to process the request/response in nanoseconds (use 0 if not known)
433433
* @param useDefault Flag that indicates that the request/response should be logged in the engine's default access
434434
* log
435435
*/

java/org/apache/catalina/Store.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ public interface Store {
7575
* <p>
7676
* Implementations should expect, and correctly handle, concurrent calls to any method but in particular calls to
7777
* {@code #load(String)}, {@code #save(Session)} and {@code #remove(String)} for the same session.
78+
* <p>
79+
* The session ID is user provided so stores must treat it as untrusted data.
7880
*
7981
* @param id Session identifier of the session to load
8082
*
@@ -92,6 +94,8 @@ public interface Store {
9294
* <p>
9395
* Implementations should expect, and correctly handle, concurrent calls to any method but in particular calls to
9496
* {@code #load(String)}, {@code #save(Session)} and {@code #remove(String)} for the same session.
97+
* <p>
98+
* The session ID is user provided so stores must treat it as untrusted data.
9599
*
96100
* @param id Session identifier of the Session to be removed
97101
*

java/org/apache/catalina/ant/AbstractCatalinaTask.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import java.net.URLConnection;
2929

3030
import org.apache.catalina.util.IOTools;
31+
import org.apache.tomcat.util.http.Method;
3132
import org.apache.tools.ant.BuildException;
3233
import org.apache.tools.ant.Project;
3334

@@ -187,7 +188,7 @@ public void execute(String command, InputStream istream, String contentType, lon
187188
preAuthenticate();
188189

189190
hconn.setDoOutput(true);
190-
hconn.setRequestMethod("PUT");
191+
hconn.setRequestMethod(Method.PUT);
191192
if (contentType != null) {
192193
hconn.setRequestProperty("Content-Type", contentType);
193194
}
@@ -198,7 +199,7 @@ public void execute(String command, InputStream istream, String contentType, lon
198199
}
199200
} else {
200201
hconn.setDoOutput(false);
201-
hconn.setRequestMethod("GET");
202+
hconn.setRequestMethod(Method.GET);
202203
}
203204
hconn.setRequestProperty("User-Agent", "Catalina-Ant-Task/1.0");
204205

@@ -297,7 +298,7 @@ private void preAuthenticate() throws IOException, URISyntaxException {
297298
hconn.setDoInput(true);
298299
hconn.setUseCaches(false);
299300
hconn.setDoOutput(false);
300-
hconn.setRequestMethod("OPTIONS");
301+
hconn.setRequestMethod(Method.OPTIONS);
301302
hconn.setRequestProperty("User-Agent", "Catalina-Ant-Task/1.0");
302303

303304
// Establish the connection with the server

java/org/apache/catalina/authenticator/AuthenticatorBase.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
import org.apache.tomcat.util.descriptor.web.LoginConfig;
7171
import org.apache.tomcat.util.descriptor.web.SecurityConstraint;
7272
import org.apache.tomcat.util.http.FastHttpDateFormat;
73+
import org.apache.tomcat.util.http.Method;
7374
import org.apache.tomcat.util.http.RequestUtil;
7475
import org.apache.tomcat.util.res.StringManager;
7576

@@ -500,7 +501,7 @@ public void invoke(Request request, Response response) throws IOException, Servl
500501

501502
// Make sure that constrained resources are not cached by web proxies
502503
// or browsers as caching can provide a security hole
503-
if (constraints != null && disableProxyCaching && !"POST".equalsIgnoreCase(request.getMethod())) {
504+
if (constraints != null && disableProxyCaching && !Method.POST.equals(request.getMethod())) {
504505
if (securePagesWithPragma) {
505506
// Note: These can cause problems with downloading files with IE
506507
response.setHeader("Pragma", "No-cache");
@@ -623,7 +624,7 @@ protected boolean allowCorsPreflightBypass(Request request) {
623624
if (allowCorsPreflight != AllowCorsPreflight.NEVER) {
624625
// First check to see if this is a CORS Preflight request
625626
// This is a subset of the tests in CorsFilter.checkRequestType
626-
if ("OPTIONS".equals(request.getMethod())) {
627+
if (Method.OPTIONS.equals(request.getMethod())) {
627628
String originHeader = request.getHeader(CorsFilter.REQUEST_HEADER_ORIGIN);
628629
if (originHeader != null && !originHeader.isEmpty() && RequestUtil.isValidOrigin(originHeader) &&
629630
!RequestUtil.isSameOrigin(request, originHeader)) {

java/org/apache/catalina/authenticator/FormAuthenticator.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
import org.apache.tomcat.util.buf.ByteChunk;
4141
import org.apache.tomcat.util.buf.MessageBytes;
4242
import org.apache.tomcat.util.descriptor.web.LoginConfig;
43+
import org.apache.tomcat.util.http.Method;
4344
import org.apache.tomcat.util.http.MimeHeaders;
4445

4546
/**
@@ -301,7 +302,7 @@ protected boolean doAuthenticate(Request request, HttpServletResponse response)
301302
// the landing page
302303
String uri = request.getContextPath() + landingPage;
303304
SavedRequest saved = new SavedRequest();
304-
saved.setMethod("GET");
305+
saved.setMethod(Method.GET);
305306
saved.setRequestURI(uri);
306307
saved.setDecodedRequestURI(uri);
307308
request.getSessionInternal(true).setNote(Constants.FORM_REQUEST_NOTE, saved);
@@ -326,7 +327,7 @@ protected boolean doAuthenticate(Request request, HttpServletResponse response)
326327
// the landing page
327328
String uri = request.getContextPath() + landingPage;
328329
SavedRequest saved = new SavedRequest();
329-
saved.setMethod("GET");
330+
saved.setMethod(Method.GET);
330331
saved.setRequestURI(uri);
331332
saved.setDecodedRequestURI(uri);
332333
session.setNote(Constants.FORM_REQUEST_NOTE, saved);
@@ -443,7 +444,7 @@ protected void forwardToLoginPage(Request request, HttpServletResponse response,
443444

444445
// Always use GET for the login page, regardless of the method used
445446
String oldMethod = request.getMethod();
446-
request.getCoyoteRequest().method().setString("GET");
447+
request.getCoyoteRequest().setMethod(Method.GET);
447448

448449
RequestDispatcher disp = context.getServletContext().getRequestDispatcher(loginPage);
449450
try {
@@ -459,7 +460,7 @@ protected void forwardToLoginPage(Request request, HttpServletResponse response,
459460
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, msg);
460461
} finally {
461462
// Restore original method so that it is written into access log
462-
request.getCoyoteRequest().method().setString(oldMethod);
463+
request.getCoyoteRequest().setMethod(oldMethod);
463464
}
464465
}
465466

@@ -585,7 +586,7 @@ protected boolean restoreRequest(Request request, Session session) throws IOExce
585586
String method = saved.getMethod();
586587
MimeHeaders rmh = request.getCoyoteRequest().getMimeHeaders();
587588
rmh.recycle();
588-
boolean cacheable = "GET".equalsIgnoreCase(method) || "HEAD".equalsIgnoreCase(method);
589+
boolean cacheable = Method.GET.equals(method) || Method.HEAD.equals(method);
589590
Iterator<String> names = saved.getHeaderNames();
590591
while (names.hasNext()) {
591592
String name = names.next();
@@ -619,15 +620,15 @@ protected boolean restoreRequest(Request request, Session session) throws IOExce
619620

620621
// If no content type specified, use default for POST
621622
String savedContentType = saved.getContentType();
622-
if (savedContentType == null && "POST".equalsIgnoreCase(method)) {
623+
if (savedContentType == null && Method.POST.equals(method)) {
623624
savedContentType = Globals.CONTENT_TYPE_FORM_URL_ENCODING;
624625
}
625626

626627
contentType.setString(savedContentType);
627628
request.getCoyoteRequest().setContentType(contentType);
628629
}
629630

630-
request.getCoyoteRequest().method().setString(method);
631+
request.getCoyoteRequest().setMethod(method);
631632
// The method, URI, queryString and protocol are normally stored as
632633
// bytes in the HttpInputBuffer and converted lazily to String. At this
633634
// point, the method has already been set as String in the line above

0 commit comments

Comments
 (0)