Skip to content

Commit 666456c

Browse files
committed
Update minimum Tomcat Native version to 1.3.4/2.0.12
This is in preparation for adding TLS 1.3 config support and expanding the OCSP config support
1 parent 6e7c352 commit 666456c

File tree

3 files changed

+52
-12
lines changed

3 files changed

+52
-12
lines changed

java/org/apache/catalina/core/AprLifecycleListener.java

Lines changed: 43 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,17 @@ public class AprLifecycleListener implements LifecycleListener {
6464

6565
// ---------------------------------------------- Constants
6666

67-
protected static final int TCN_REQUIRED_MAJOR = 1;
68-
protected static final int TCN_REQUIRED_MINOR = 2;
69-
protected static final int TCN_REQUIRED_PATCH = 34;
67+
private static final int TCN_1_REQUIRED_MINOR = 3;
68+
private static final int TCN_1_REQUIRED_PATCH = 4;
69+
private static final int TCN_1_RECOMMENDED_MINOR = 3;
70+
private static final int TCN_1_RECOMMENDED_PATCH = 4;
71+
72+
protected static final int TCN_REQUIRED_MAJOR = 2;
73+
protected static final int TCN_REQUIRED_MINOR = 0;
74+
protected static final int TCN_REQUIRED_PATCH = 12;
7075
protected static final int TCN_RECOMMENDED_MAJOR = 2;
7176
protected static final int TCN_RECOMMENDED_MINOR = 0;
72-
protected static final int TCN_RECOMMENDED_PV = 5;
77+
protected static final int TCN_RECOMMENDED_PV = 12;
7378

7479

7580
// ---------------------------------------------- Properties
@@ -209,9 +214,6 @@ private static void terminateAPR() {
209214
}
210215

211216
private static void init() {
212-
int rqver = TCN_REQUIRED_MAJOR * 1000 + TCN_REQUIRED_MINOR * 100 + TCN_REQUIRED_PATCH;
213-
int rcver = TCN_RECOMMENDED_MAJOR * 1000 + TCN_RECOMMENDED_MINOR * 100 + TCN_RECOMMENDED_PV;
214-
215217
if (org.apache.tomcat.jni.AprStatus.isAprInitialized()) {
216218
return;
217219
}
@@ -249,9 +251,34 @@ private static void init() {
249251
}
250252
return;
251253
}
254+
255+
/*
256+
* With parallel development of 1.x and 2.x there are now minimum and recommended versions for both branches.
257+
*
258+
* The minimum required version is increased when the Tomcat Native API is changed (typically extended) to
259+
* include functionality that Tomcat expects to always be present.
260+
*
261+
* The minimum recommended version is increased when there is a change in Tomcat Native that while not required
262+
* is recommended (such as bug fixes).
263+
*/
264+
int rqver;
265+
int rcver;
266+
if (tcnMajor == 1) {
267+
rqver = 1000 + TCN_1_REQUIRED_MINOR * 100 + TCN_1_REQUIRED_PATCH;
268+
rcver = 1000 + TCN_1_RECOMMENDED_MINOR * 100 + TCN_1_RECOMMENDED_PATCH;
269+
} else {
270+
rqver = TCN_REQUIRED_MAJOR * 1000 + TCN_REQUIRED_MINOR * 100 + TCN_REQUIRED_PATCH;
271+
rcver = TCN_RECOMMENDED_MAJOR * 1000 + TCN_RECOMMENDED_MINOR * 100 + TCN_RECOMMENDED_PV;
272+
}
273+
252274
if (tcnVersion < rqver) {
253-
log.error(sm.getString("aprListener.tcnInvalid", Library.versionString(),
254-
TCN_REQUIRED_MAJOR + "." + TCN_REQUIRED_MINOR + "." + TCN_REQUIRED_PATCH));
275+
if (tcnMajor == 1) {
276+
log.error(sm.getString("aprListener.tcnInvalid.1", Library.versionString(),
277+
"1." + TCN_1_REQUIRED_MINOR + "." + TCN_1_REQUIRED_PATCH));
278+
} else {
279+
log.error(sm.getString("aprListener.tcnInvalid", Library.versionString(),
280+
TCN_REQUIRED_MAJOR + "." + TCN_REQUIRED_MINOR + "." + TCN_REQUIRED_PATCH));
281+
}
255282
try {
256283
// Terminate the APR in case the version
257284
// is below required.
@@ -263,8 +290,13 @@ private static void init() {
263290
return;
264291
}
265292
if (tcnVersion < rcver) {
266-
initInfoLogMessages.add(sm.getString("aprListener.tcnVersion", Library.versionString(),
267-
TCN_RECOMMENDED_MAJOR + "." + TCN_RECOMMENDED_MINOR + "." + TCN_RECOMMENDED_PV));
293+
if (tcnMajor == 1) {
294+
initInfoLogMessages.add(sm.getString("aprListener.tcnVersion.1", Library.versionString(),
295+
"1." + TCN_1_RECOMMENDED_MINOR + "." + TCN_1_RECOMMENDED_PATCH));
296+
} else {
297+
initInfoLogMessages.add(sm.getString("aprListener.tcnVersion", Library.versionString(),
298+
TCN_RECOMMENDED_MAJOR + "." + TCN_RECOMMENDED_MINOR + "." + TCN_RECOMMENDED_PV));
299+
}
268300
}
269301

270302
initInfoLogMessages

java/org/apache/catalina/core/LocalStrings.properties

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,11 @@ aprListener.requireNotInFIPSMode=AprLifecycleListener is configured to require t
8484
aprListener.skipFIPSInitialization=Already in FIPS mode; skipping FIPS initialization.
8585
aprListener.sslInit=Failed to initialize the SSLEngine.
8686
aprListener.sslRequired=[{0}] is not a valid value for SSLEngine when using version [{1}] of the Tomcat Native library since SSL is required for version 2.x onwards.
87-
aprListener.tcnInvalid=An incompatible version [{0}] of the Apache Tomcat Native library is installed, while Tomcat requires version [{1}]
87+
aprListener.tcnInvalid=An incompatible version [{0}] of the Apache Tomcat Native library is installed, while Tomcat requires at least version [{1}]
88+
aprListener.tcnInvalid.1=An incompatible version [{0}] of the Apache Tomcat Native library is installed, while Tomcat requires at least version [{1}] of Tomcat Native 1.x
8889
aprListener.tcnValid=Loaded Apache Tomcat Native library [{0}] using APR version [{1}].
8990
aprListener.tcnVersion=An older version [{0}] of the Apache Tomcat Native library is installed, while Tomcat recommends a minimum version of [{1}]
91+
aprListener.tcnVersion.1=An older version [{0}] of the Apache Tomcat Native library is installed, while Tomcat recommends a minimum version of [{1}] of Tomcat Native 1.x
9092
aprListener.tooLateForFIPSMode=Cannot setFIPSMode: SSL has already been initialized
9193
aprListener.tooLateForSSLEngine=Cannot setSSLEngine: SSL has already been initialized
9294
aprListener.tooLateForSSLRandomSeed=Cannot setSSLRandomSeed: SSL has already been initialized

webapps/docs/changelog.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,12 @@
205205
<bug>69918</bug>: Ensure request parameters are correctly parsed for HTTP/2 requests
206206
when the content-length header is not set. (dsoumis)
207207
</fix>
208+
<update>
209+
Enable minimum and recommended Tomcat Native versions to be set
210+
separately for Tomcat Native 1.x and 2.x. Update the minimum and
211+
recommended versions for Tomcat Native 1.x to 1.3.4. Update the minimum
212+
and recommended versions for Tomcat Native 2.x to 2.0.12. (markt)
213+
</update>
208214
</changelog>
209215
</subsection>
210216
<subsection name="Coyote">

0 commit comments

Comments
 (0)