[tomcat] branch main updated: Fix BZ 66548 - Add validation of Sec-Websocket-Key header
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/main by this push: new 57ca5301a9 Fix BZ 66548 - Add validation of Sec-Websocket-Key header 57ca5301a9 is described below commit 57ca5301a995c07b4b18cbcff3cf4a663c81af3e Author: Mark Thomas AuthorDate: Tue Apr 11 08:18:43 2023 +0100 Fix BZ 66548 - Add validation of Sec-Websocket-Key header Note that the validation isn't perfect. It aims to be good enough. https://bz.apache.org/bugzilla/show_bug.cgi?id=66548 --- .../apache/tomcat/util/codec/binary/Base64.java| 9 +++ .../tomcat/websocket/server/UpgradeUtil.java | 39 +- .../tomcat/websocket/server/TestKeyHeader.java | 87 ++ .../tomcat/websocket/server/TesterWsClient.java| 18 - webapps/docs/changelog.xml | 7 ++ 5 files changed, 155 insertions(+), 5 deletions(-) diff --git a/java/org/apache/tomcat/util/codec/binary/Base64.java b/java/org/apache/tomcat/util/codec/binary/Base64.java index dc11167a16..9129650bfd 100644 --- a/java/org/apache/tomcat/util/codec/binary/Base64.java +++ b/java/org/apache/tomcat/util/codec/binary/Base64.java @@ -279,6 +279,15 @@ public class Base64 extends BaseNCodec { } +public static boolean isInAlphabet(char c) { +// Fast for valid data. May be slow for invalid data. +try { +return STANDARD_DECODE_TABLE[c] != -1; +} catch (ArrayIndexOutOfBoundsException ex) { +return false; +} +} + /** * Encode table to use: either STANDARD or URL_SAFE. Note: the DECODE_TABLE above remains static because it is able * to decode both STANDARD and URL_SAFE streams, but the encodeTable must be a member variable so we can switch diff --git a/java/org/apache/tomcat/websocket/server/UpgradeUtil.java b/java/org/apache/tomcat/websocket/server/UpgradeUtil.java index ac4021fd00..814587390f 100644 --- a/java/org/apache/tomcat/websocket/server/UpgradeUtil.java +++ b/java/org/apache/tomcat/websocket/server/UpgradeUtil.java @@ -95,7 +95,7 @@ public class UpgradeUtil { return; } key = req.getHeader(Constants.WS_KEY_HEADER_NAME); -if (key == null) { +if (!validateKey(key)) { resp.sendError(HttpServletResponse.SC_BAD_REQUEST); return; } @@ -224,6 +224,43 @@ public class UpgradeUtil { } +/* + * Validate the key. It should be the base64 encoding of a random 16-byte value. 16-bytes are encoded in 24 base64 + * characters, the last two of which must be ==. + * + * The validation isn't perfect: + * + * - it doesn't check the final non-'=' character is valid in the context of the number of bits it is meant to be + * encoding. + * + * - it doesn't check that the value is random and changes for each connection. + * + * Given that this header is for the benefit of the client, not the server, this should be good enough. + */ +private static boolean validateKey(String key) { +if (key == null) { +return false; +} + +if (key.length() != 24) { +return false; +} + +char[] keyChars = key.toCharArray(); +if (keyChars[22] != '=' || keyChars[23] != '=') { +return false; +} + +for (int i = 0; i < 22; i++) { +if (!Base64.isInAlphabet(keyChars[i])) { +return false; +} +} + +return true; +} + + private static List createTransformations(List negotiatedExtensions) { TransformationFactory factory = TransformationFactory.getInstance(); diff --git a/test/org/apache/tomcat/websocket/server/TestKeyHeader.java b/test/org/apache/tomcat/websocket/server/TestKeyHeader.java new file mode 100644 index 00..8db0bd2cc8 --- /dev/null +++ b/test/org/apache/tomcat/websocket/server/TestKeyHeader.java @@ -0,0 +1,87 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tomcat.websocket.s
[Bug 66548] Tomcat does not validate value of Sec-Websocket-Key header
https://bz.apache.org/bugzilla/show_bug.cgi?id=66548 --- Comment #7 from Mark Thomas --- Fixed in: - 11.0.x for 11.0.0-M5 onwards - 10.1.x for 10.1.8 onwards As per schultz's suggestion, I am going to wait at least one release cycle before back-porting this to 9.0.x and 8.5.x in case there are clients out there that do not provide a valid value for this header. -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch 10.1.x updated: Fix BZ 66548 - Add validation of Sec-Websocket-Key header
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 10.1.x in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/10.1.x by this push: new 791295e74f Fix BZ 66548 - Add validation of Sec-Websocket-Key header 791295e74f is described below commit 791295e74f1a94311b6d850fc6f60fc0b0a33b0f Author: Mark Thomas AuthorDate: Tue Apr 11 08:18:43 2023 +0100 Fix BZ 66548 - Add validation of Sec-Websocket-Key header Note that the validation isn't perfect. It aims to be good enough. https://bz.apache.org/bugzilla/show_bug.cgi?id=66548 --- .../apache/tomcat/util/codec/binary/Base64.java| 9 +++ .../tomcat/websocket/server/UpgradeUtil.java | 39 +- .../tomcat/websocket/server/TestKeyHeader.java | 87 ++ .../tomcat/websocket/server/TesterWsClient.java| 18 - webapps/docs/changelog.xml | 7 ++ 5 files changed, 155 insertions(+), 5 deletions(-) diff --git a/java/org/apache/tomcat/util/codec/binary/Base64.java b/java/org/apache/tomcat/util/codec/binary/Base64.java index dc11167a16..9129650bfd 100644 --- a/java/org/apache/tomcat/util/codec/binary/Base64.java +++ b/java/org/apache/tomcat/util/codec/binary/Base64.java @@ -279,6 +279,15 @@ public class Base64 extends BaseNCodec { } +public static boolean isInAlphabet(char c) { +// Fast for valid data. May be slow for invalid data. +try { +return STANDARD_DECODE_TABLE[c] != -1; +} catch (ArrayIndexOutOfBoundsException ex) { +return false; +} +} + /** * Encode table to use: either STANDARD or URL_SAFE. Note: the DECODE_TABLE above remains static because it is able * to decode both STANDARD and URL_SAFE streams, but the encodeTable must be a member variable so we can switch diff --git a/java/org/apache/tomcat/websocket/server/UpgradeUtil.java b/java/org/apache/tomcat/websocket/server/UpgradeUtil.java index 6f8d8a5ae2..4c388fea84 100644 --- a/java/org/apache/tomcat/websocket/server/UpgradeUtil.java +++ b/java/org/apache/tomcat/websocket/server/UpgradeUtil.java @@ -95,7 +95,7 @@ public class UpgradeUtil { return; } key = req.getHeader(Constants.WS_KEY_HEADER_NAME); -if (key == null) { +if (!validateKey(key)) { resp.sendError(HttpServletResponse.SC_BAD_REQUEST); return; } @@ -224,6 +224,43 @@ public class UpgradeUtil { } +/* + * Validate the key. It should be the base64 encoding of a random 16-byte value. 16-bytes are encoded in 24 base64 + * characters, the last two of which must be ==. + * + * The validation isn't perfect: + * + * - it doesn't check the final non-'=' character is valid in the context of the number of bits it is meant to be + * encoding. + * + * - it doesn't check that the value is random and changes for each connection. + * + * Given that this header is for the benefit of the client, not the server, this should be good enough. + */ +private static boolean validateKey(String key) { +if (key == null) { +return false; +} + +if (key.length() != 24) { +return false; +} + +char[] keyChars = key.toCharArray(); +if (keyChars[22] != '=' || keyChars[23] != '=') { +return false; +} + +for (int i = 0; i < 22; i++) { +if (!Base64.isInAlphabet(keyChars[i])) { +return false; +} +} + +return true; +} + + private static List createTransformations(List negotiatedExtensions) { TransformationFactory factory = TransformationFactory.getInstance(); diff --git a/test/org/apache/tomcat/websocket/server/TestKeyHeader.java b/test/org/apache/tomcat/websocket/server/TestKeyHeader.java new file mode 100644 index 00..8db0bd2cc8 --- /dev/null +++ b/test/org/apache/tomcat/websocket/server/TestKeyHeader.java @@ -0,0 +1,87 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tomcat.websock
[Bug 66548] Tomcat does not validate value of Sec-Websocket-Key header
https://bz.apache.org/bugzilla/show_bug.cgi?id=66548 Mark Thomas changed: What|Removed |Added Status|NEW |NEEDINFO --- Comment #8 from Mark Thomas --- Waiting for (lack of) feedback from 11.0.x and 10.1.x users. -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch main updated (57ca5301a9 -> 4de1e9e216)
This is an automated email from the ASF dual-hosted git repository. remm pushed a change to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git from 57ca5301a9 Fix BZ 66548 - Add validation of Sec-Websocket-Key header add 4de1e9e216 Expose utility executor to webapps No new revisions were added by this update. Summary of changes: java/org/apache/catalina/core/StandardContext.java | 5 + webapps/docs/changelog.xml | 5 + 2 files changed, 10 insertions(+) - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[GitHub] [tomcat] rmaucher commented on a diff in pull request #607: Added RateLimitFilter
rmaucher commented on code in PR #607: URL: https://github.com/apache/tomcat/pull/607#discussion_r1162435391 ## java/org/apache/catalina/util/TimeBucketCounter.java: ## @@ -0,0 +1,217 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.catalina.util; + +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.atomic.AtomicInteger; + +/** + * this class maintains a thread safe hash map that has timestamp-based buckets + * followed by a string for a key, and a counter for a value. each time the + * increment() method is called it adds the key if it does not exist, increments + * its value and returns it. + * + * a maintenance thread cleans up keys that are prefixed by previous timestamp + * buckets. + */ +public class TimeBucketCounter { + +/** + * Map to hold the buckets + */ +private final ConcurrentHashMap map = new ConcurrentHashMap<>(); + +/** + * Milliseconds bucket size as a Power of 2 for bit shift math, e.g. + * 16 for 65_536ms which is about 1:05 minute + */ +private final int numBits; + +/** + * ratio of actual duration to config duration + */ +private final double ratio; + +/** + * flag for the maintenance thread + */ +volatile boolean isRunning = false; + +/** + * + * @param bucketDuration duration in seconds, e.g. for 1 minute pass 60 + */ +public TimeBucketCounter(int bucketDuration) { + +int durationMillis = bucketDuration * 1000; + +int bits = 0; +int pof2 = nextPowerOf2(durationMillis); +int bitCheck = pof2; +while (bitCheck > 1) { +bitCheck = pof2 >> ++bits; +} + +this.numBits = bits; + +this.ratio = ratioToPowerOf2(durationMillis); + +int cleanupsPerBucketDuration = (durationMillis >= 60_000) ? 6 : 3; +Thread mt = new MaintenanceThread(durationMillis / cleanupsPerBucketDuration); Review Comment: Exposing Tomcat's utility executor is only doable when the security manager is not enabled. This is now done with a new Servlet context attribute in Tomcat trunk (11) since no security manager at all. In all other cases, the filter should use a thread as it is doing right now, so there's nothing to fix in the PR in that area. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[GitHub] [tomcat] rmannibucau commented on a diff in pull request #607: Added RateLimitFilter
rmannibucau commented on code in PR #607: URL: https://github.com/apache/tomcat/pull/607#discussion_r1162439073 ## java/org/apache/catalina/util/TimeBucketCounter.java: ## @@ -0,0 +1,217 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.catalina.util; + +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.atomic.AtomicInteger; + +/** + * this class maintains a thread safe hash map that has timestamp-based buckets + * followed by a string for a key, and a counter for a value. each time the + * increment() method is called it adds the key if it does not exist, increments + * its value and returns it. + * + * a maintenance thread cleans up keys that are prefixed by previous timestamp + * buckets. + */ +public class TimeBucketCounter { + +/** + * Map to hold the buckets + */ +private final ConcurrentHashMap map = new ConcurrentHashMap<>(); + +/** + * Milliseconds bucket size as a Power of 2 for bit shift math, e.g. + * 16 for 65_536ms which is about 1:05 minute + */ +private final int numBits; + +/** + * ratio of actual duration to config duration + */ +private final double ratio; + +/** + * flag for the maintenance thread + */ +volatile boolean isRunning = false; + +/** + * + * @param bucketDuration duration in seconds, e.g. for 1 minute pass 60 + */ +public TimeBucketCounter(int bucketDuration) { + +int durationMillis = bucketDuration * 1000; + +int bits = 0; +int pof2 = nextPowerOf2(durationMillis); +int bitCheck = pof2; +while (bitCheck > 1) { +bitCheck = pof2 >> ++bits; +} + +this.numBits = bits; + +this.ratio = ratioToPowerOf2(durationMillis); + +int cleanupsPerBucketDuration = (durationMillis >= 60_000) ? 6 : 3; +Thread mt = new MaintenanceThread(durationMillis / cleanupsPerBucketDuration); Review Comment: @rmaucher hmm, there is hat I mention in my previous comment ie use a scheduled executor service and not an active awaiting impl plus share the executor between the filters in the app at least (if the tomcat's one is too hard to reach, this part is ok) to avoid to consume 3 threads (and related resources) for nothing which can be an issue in some loaded env, in particular when pools are not fixed (ThreadPoolExecutor with max >> core size) or other needs. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch 10.1.x updated: Expose utility executor to webapps
This is an automated email from the ASF dual-hosted git repository. remm pushed a commit to branch 10.1.x in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/10.1.x by this push: new fe797d1417 Expose utility executor to webapps fe797d1417 is described below commit fe797d141723bd088825707b85b6c8abc957d012 Author: remm AuthorDate: Tue Apr 11 10:10:04 2023 +0200 Expose utility executor to webapps Part of the discussions in PR#607 Only enabled when the security manager is not active. --- java/org/apache/catalina/core/StandardContext.java | 7 +++ webapps/docs/changelog.xml | 5 + 2 files changed, 12 insertions(+) diff --git a/java/org/apache/catalina/core/StandardContext.java b/java/org/apache/catalina/core/StandardContext.java index 4e6af40ba0..34bbc4ac2d 100644 --- a/java/org/apache/catalina/core/StandardContext.java +++ b/java/org/apache/catalina/core/StandardContext.java @@ -134,6 +134,7 @@ import org.apache.tomcat.util.http.Rfc6265CookieProcessor; import org.apache.tomcat.util.scan.StandardJarScanner; import org.apache.tomcat.util.security.PrivilegedGetTccl; import org.apache.tomcat.util.security.PrivilegedSetTccl; +import org.apache.tomcat.util.threads.ScheduledThreadPoolExecutor; /** * Standard implementation of the Context interface. Each child container must be a Wrapper implementation to @@ -4864,6 +4865,12 @@ public class StandardContext extends ContainerBase implements Context, Notificat // Make the version info available getServletContext().setAttribute(Globals.WEBAPP_VERSION, getWebappVersion()); + +// Make the utility executor available +if (!Globals.IS_SECURITY_ENABLED) { + getServletContext().setAttribute(ScheduledThreadPoolExecutor.class.getName(), + Container.getService(this).getServer().getUtilityExecutor()); +} } // Set up the context init params diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index e084cbd1c3..b5792a67e3 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -175,6 +175,11 @@ avoid possible JVM thread creation in the webapp context on some platforms. (remm) + +Make the server utility executor available to webapps using a Servlet +context attribute named + org.apache.tomcat.util.threads.ScheduledThreadPoolExecutor. (remm) + - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch 9.0.x updated: Expose utility executor to webapps
This is an automated email from the ASF dual-hosted git repository. remm pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/9.0.x by this push: new 4e3972d33d Expose utility executor to webapps 4e3972d33d is described below commit 4e3972d33d38c14e8de26240f4d13675273c4e81 Author: remm AuthorDate: Tue Apr 11 10:10:04 2023 +0200 Expose utility executor to webapps Part of the discussions in PR#607 Only enabled when the security manager is not active. --- java/org/apache/catalina/core/StandardContext.java | 7 +++ webapps/docs/changelog.xml | 5 + 2 files changed, 12 insertions(+) diff --git a/java/org/apache/catalina/core/StandardContext.java b/java/org/apache/catalina/core/StandardContext.java index 6a7a03bcb0..5dbeae925c 100644 --- a/java/org/apache/catalina/core/StandardContext.java +++ b/java/org/apache/catalina/core/StandardContext.java @@ -135,6 +135,7 @@ import org.apache.tomcat.util.http.Rfc6265CookieProcessor; import org.apache.tomcat.util.scan.StandardJarScanner; import org.apache.tomcat.util.security.PrivilegedGetTccl; import org.apache.tomcat.util.security.PrivilegedSetTccl; +import org.apache.tomcat.util.threads.ScheduledThreadPoolExecutor; /** * Standard implementation of the Context interface. Each child container must be a Wrapper implementation to @@ -4918,6 +4919,12 @@ public class StandardContext extends ContainerBase implements Context, Notificat // Make the version info available getServletContext().setAttribute(Globals.WEBAPP_VERSION, getWebappVersion()); + +// Make the utility executor available +if (!Globals.IS_SECURITY_ENABLED) { + getServletContext().setAttribute(ScheduledThreadPoolExecutor.class.getName(), + Container.getService(this).getServer().getUtilityExecutor()); +} } // Set up the context init params diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 60626d2702..7d4dd421f0 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -175,6 +175,11 @@ avoid possible JVM thread creation in the webapp context on some platforms. (remm) + +Make the server utility executor available to webapps using a Servlet +context attribute named + org.apache.tomcat.util.threads.ScheduledThreadPoolExecutor. (remm) + - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] 01/02: Improve messages for invalid JRE_HOME/JAVA_HOME
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git commit eb981f73ee70b799dcd9dcd6694c9084d36169c7 Author: Mark Thomas AuthorDate: Tue Apr 11 10:50:04 2023 +0100 Improve messages for invalid JRE_HOME/JAVA_HOME --- bin/setclasspath.bat | 13 - 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/bin/setclasspath.bat b/bin/setclasspath.bat index 41548ef726..62e5d70cb3 100755 --- a/bin/setclasspath.bat +++ b/bin/setclasspath.bat @@ -42,13 +42,23 @@ goto okJava :noJavaHome echo The JAVA_HOME environment variable is not defined correctly. +echo JAVA_HOME=%JAVA_HOME% echo It is needed to run this program in debug mode. echo NB: JAVA_HOME should point to a JDK not a JRE. goto exit :gotJavaHome -rem No JRE given, use JAVA_HOME as JRE_HOME +rem No JRE given, check if JAVA_HOME is usable as JRE_HOME +if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHomeAsJre +rem Use JAVA_HOME as JRE_HOME set "JRE_HOME=%JAVA_HOME%" +goto okJava + +:noJavaHomeAsJre +echo The JAVA_HOME environment variable is not defined correctly. +echo JAVA_HOME=%JAVA_HOME% +echo NB: JAVA_HOME should point to a JDK not a JRE. +goto exit :gotJreHome rem Check if we have a usable JRE @@ -58,6 +68,7 @@ goto okJava :noJreHome rem Needed at least a JRE echo The JRE_HOME environment variable is not defined correctly +echo JRE_HOME=%JRE_HOME% echo This environment variable is needed to run this program goto exit - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch main updated (4de1e9e216 -> 0ccae46c22)
This is an automated email from the ASF dual-hosted git repository. markt pushed a change to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git from 4de1e9e216 Expose utility executor to webapps new eb981f73ee Improve messages for invalid JRE_HOME/JAVA_HOME new 0ccae46c22 Align JRE_HOME/JAVA_HOME handling with setclasspath.bat The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: bin/service.bat | 43 +++ bin/setclasspath.bat | 13 - 2 files changed, 39 insertions(+), 17 deletions(-) - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] 02/02: Align JRE_HOME/JAVA_HOME handling with setclasspath.bat
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git commit 0ccae46c22013e7b5ba7377334ac2315f88b12b7 Author: Mark Thomas AuthorDate: Tue Apr 11 10:51:48 2023 +0100 Align JRE_HOME/JAVA_HOME handling with setclasspath.bat --- bin/service.bat | 43 +++ 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/bin/service.bat b/bin/service.bat index fae79207b2..be6eca7e03 100755 --- a/bin/service.bat +++ b/bin/service.bat @@ -103,30 +103,42 @@ exit /b 1 cd "%CURRENT_DIR%" rem Make sure prerequisite environment variables are set -if not "%JAVA_HOME%" == "" goto gotJdkHome if not "%JRE_HOME%" == "" goto gotJreHome +if not "%JAVA_HOME%" == "" goto gotJavaHome echo Neither the JAVA_HOME nor the JRE_HOME environment variable is defined echo Service will try to guess them from the registry. -goto okJavaHome -:gotJreHome -if not exist "%JRE_HOME%\bin\java.exe" goto noJavaHome -goto okJavaHome -:gotJdkHome -if not exist "%JAVA_HOME%\bin\javac.exe" goto noJavaHome -if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome -if not "%JRE_HOME%" == "" goto okJavaHome +goto okJava + +:gotJavaHome +rem No JRE given, check if JAVA_HOME is usable as JRE_HOME +if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHomeAsJre +rem Use JAVA_HOME as JRE_HOME set "JRE_HOME=%JAVA_HOME%" -goto okJavaHome -:noJavaHome -echo The JAVA_HOME environment variable is not defined correctly +goto okJava + +:noJavaHomeAsJre +echo The JAVA_HOME environment variable is not defined correctly. +echo JAVA_HOME=%JAVA_HOME% +echo NB: JAVA_HOME should point to a JDK not a JRE. +exit /b 1 + +:gotJreHome +rem Check if we have a usable JRE +if not exist "%JRE_HOME%\bin\java.exe" goto noJreHome +goto okJava + +:noJreHome +rem Needed at least a JRE +echo The JRE_HOME environment variable is not defined correctly +echo JRE_HOME=%JRE_HOME% echo This environment variable is needed to run this program -echo NB: JAVA_HOME should point to a JDK not a JRE exit /b 1 -:okJavaHome + +:okJava if not "%CATALINA_BASE%" == "" goto gotBase set "CATALINA_BASE=%CATALINA_HOME%" -:gotBase +:gotBase rem Process the requested command if /i %SERVICE_CMD% == install goto doInstall if /i %SERVICE_CMD% == remove goto doRemove @@ -160,7 +172,6 @@ rem Install the service echo Installing the service '%SERVICE_NAME%' ... echo Using CATALINA_HOME:"%CATALINA_HOME%" echo Using CATALINA_BASE:"%CATALINA_BASE%" -echo Using JAVA_HOME:"%JAVA_HOME%" echo Using JRE_HOME: "%JRE_HOME%" rem Try to use the server jvm - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[GitHub] [tomcat] markt-asf commented on pull request #600: echo the value of %JAVA_HOME% when it is invalid.
markt-asf commented on PR #600: URL: https://github.com/apache/tomcat/pull/600#issuecomment-1503021102 If neither `JRE_HOME` nor `JAVA_HOME` is defined, a message is already shown. I have undertaken a wider review of setclasspath.bat and service.bat and added additional messages when values aren't valid and aligned the handling of `JRE_HOME` and `JAVA_HOME` for both scripts. There is no functional change but there are additional messages and the code is consistent. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[GitHub] [tomcat] markt-asf closed pull request #600: echo the value of %JAVA_HOME% when it is invalid.
markt-asf closed pull request #600: echo the value of %JAVA_HOME% when it is invalid. URL: https://github.com/apache/tomcat/pull/600 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch main updated: Improve messages if JAVA_HOME / JRE_HOME not set correctly
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/main by this push: new a788852f6b Improve messages if JAVA_HOME / JRE_HOME not set correctly a788852f6b is described below commit a788852f6b48e100bd505dcf7b5633a04f649e7b Author: Mark Thomas AuthorDate: Tue Apr 11 11:41:55 2023 +0100 Improve messages if JAVA_HOME / JRE_HOME not set correctly --- bin/setclasspath.sh| 24 +--- webapps/docs/changelog.xml | 6 ++ 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/bin/setclasspath.sh b/bin/setclasspath.sh index b81bc197d1..f56b2aa473 100755 --- a/bin/setclasspath.sh +++ b/bin/setclasspath.sh @@ -53,15 +53,13 @@ if [ -z "$JAVA_HOME" ] && [ "$1" = "debug" ]; then echo "JAVA_HOME should point to a JDK in order to run in debug mode." exit 1 fi -if [ -z "$JRE_HOME" ]; then - JRE_HOME="$JAVA_HOME" -fi # If we're running under jdb, we need a full jdk. if [ "$1" = "debug" ] ; then if [ "$os400" = "true" ]; then if [ ! -x "$JAVA_HOME"/bin/java ] || [ ! -x "$JAVA_HOME"/bin/javac ]; then echo "The JAVA_HOME environment variable is not defined correctly" + echo "JAVA_HOME=$JAVA_HOME" echo "This environment variable is needed to run this program" echo "NB: JAVA_HOME should point to a JDK not a JRE" exit 1 @@ -69,6 +67,7 @@ if [ "$1" = "debug" ] ; then else if [ ! -x "$JAVA_HOME"/bin/java ] || [ ! -x "$JAVA_HOME"/bin/jdb ] || [ ! -x "$JAVA_HOME"/bin/javac ]; then echo "The JAVA_HOME environment variable is not defined correctly" + echo "JAVA_HOME=$JAVA_HOME" echo "This environment variable is needed to run this program" echo "NB: JAVA_HOME should point to a JDK not a JRE" exit 1 @@ -76,6 +75,25 @@ if [ "$1" = "debug" ] ; then fi fi +if [ -z "$JRE_HOME" ]; then + # JAVA_HOME_MUST be set + if [ ! -x "$JAVA_HOME"/bin/java ]; then +echo "The JAVA_HOME environment variable is not defined correctly" +echo "JAVA_HOME=$JAVA_HOME" +echo "This environment variable is needed to run this program" +echo "NB: JAVA_HOME should point to a JDK not a JRE" +exit 1 + fi + JRE_HOME="$JAVA_HOME" +else + if [ ! -x "$JRE_HOME"/bin/java ]; then +echo "The JRE_HOME environment variable is not defined correctly" +echo "JRE_HOME=$JRE_HOME" +echo "This environment variable is needed to run this program" +exit 1 + fi +fi + # Set standard commands for invoking Java, if not already set. if [ -z "$_RUNJAVA" ]; then _RUNJAVA="$JRE_HOME"/bin/java diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 9b8cf45186..80eda46d47 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -295,6 +295,12 @@ 2.10.0-SNAPSHOT). This corrects a regression introduced in 11.0.0-M2. (markt) + +Improve the error messages if JRE_HOME or +JAVA_HOME are not set correctly. On windows, align the +handling of JRE_HOME and JAVA_HOME for the +start-up scripts and the service install script. (markt) + - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch 10.1.x updated: Improve messages for invalid JRE_HOME/JAVA_HOME
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 10.1.x in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/10.1.x by this push: new b1709064e3 Improve messages for invalid JRE_HOME/JAVA_HOME b1709064e3 is described below commit b1709064e39dc78e104731d5860ebc75a5824fb7 Author: Mark Thomas AuthorDate: Tue Apr 11 10:50:04 2023 +0100 Improve messages for invalid JRE_HOME/JAVA_HOME Align JRE_HOME/JAVA_HOME handling with setclasspath.bat --- bin/service.bat| 43 +++ bin/setclasspath.bat | 13 - bin/setclasspath.sh| 24 +--- webapps/docs/changelog.xml | 6 ++ 4 files changed, 66 insertions(+), 20 deletions(-) diff --git a/bin/service.bat b/bin/service.bat index fae79207b2..be6eca7e03 100755 --- a/bin/service.bat +++ b/bin/service.bat @@ -103,30 +103,42 @@ exit /b 1 cd "%CURRENT_DIR%" rem Make sure prerequisite environment variables are set -if not "%JAVA_HOME%" == "" goto gotJdkHome if not "%JRE_HOME%" == "" goto gotJreHome +if not "%JAVA_HOME%" == "" goto gotJavaHome echo Neither the JAVA_HOME nor the JRE_HOME environment variable is defined echo Service will try to guess them from the registry. -goto okJavaHome -:gotJreHome -if not exist "%JRE_HOME%\bin\java.exe" goto noJavaHome -goto okJavaHome -:gotJdkHome -if not exist "%JAVA_HOME%\bin\javac.exe" goto noJavaHome -if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome -if not "%JRE_HOME%" == "" goto okJavaHome +goto okJava + +:gotJavaHome +rem No JRE given, check if JAVA_HOME is usable as JRE_HOME +if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHomeAsJre +rem Use JAVA_HOME as JRE_HOME set "JRE_HOME=%JAVA_HOME%" -goto okJavaHome -:noJavaHome -echo The JAVA_HOME environment variable is not defined correctly +goto okJava + +:noJavaHomeAsJre +echo The JAVA_HOME environment variable is not defined correctly. +echo JAVA_HOME=%JAVA_HOME% +echo NB: JAVA_HOME should point to a JDK not a JRE. +exit /b 1 + +:gotJreHome +rem Check if we have a usable JRE +if not exist "%JRE_HOME%\bin\java.exe" goto noJreHome +goto okJava + +:noJreHome +rem Needed at least a JRE +echo The JRE_HOME environment variable is not defined correctly +echo JRE_HOME=%JRE_HOME% echo This environment variable is needed to run this program -echo NB: JAVA_HOME should point to a JDK not a JRE exit /b 1 -:okJavaHome + +:okJava if not "%CATALINA_BASE%" == "" goto gotBase set "CATALINA_BASE=%CATALINA_HOME%" -:gotBase +:gotBase rem Process the requested command if /i %SERVICE_CMD% == install goto doInstall if /i %SERVICE_CMD% == remove goto doRemove @@ -160,7 +172,6 @@ rem Install the service echo Installing the service '%SERVICE_NAME%' ... echo Using CATALINA_HOME:"%CATALINA_HOME%" echo Using CATALINA_BASE:"%CATALINA_BASE%" -echo Using JAVA_HOME:"%JAVA_HOME%" echo Using JRE_HOME: "%JRE_HOME%" rem Try to use the server jvm diff --git a/bin/setclasspath.bat b/bin/setclasspath.bat index 41548ef726..62e5d70cb3 100755 --- a/bin/setclasspath.bat +++ b/bin/setclasspath.bat @@ -42,13 +42,23 @@ goto okJava :noJavaHome echo The JAVA_HOME environment variable is not defined correctly. +echo JAVA_HOME=%JAVA_HOME% echo It is needed to run this program in debug mode. echo NB: JAVA_HOME should point to a JDK not a JRE. goto exit :gotJavaHome -rem No JRE given, use JAVA_HOME as JRE_HOME +rem No JRE given, check if JAVA_HOME is usable as JRE_HOME +if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHomeAsJre +rem Use JAVA_HOME as JRE_HOME set "JRE_HOME=%JAVA_HOME%" +goto okJava + +:noJavaHomeAsJre +echo The JAVA_HOME environment variable is not defined correctly. +echo JAVA_HOME=%JAVA_HOME% +echo NB: JAVA_HOME should point to a JDK not a JRE. +goto exit :gotJreHome rem Check if we have a usable JRE @@ -58,6 +68,7 @@ goto okJava :noJreHome rem Needed at least a JRE echo The JRE_HOME environment variable is not defined correctly +echo JRE_HOME=%JRE_HOME% echo This environment variable is needed to run this program goto exit diff --git a/bin/setclasspath.sh b/bin/setclasspath.sh index b81bc197d1..f56b2aa473 100755 --- a/bin/setclasspath.sh +++ b/bin/setclasspath.sh @@ -53,15 +53,13 @@ if [ -z "$JAVA_HOME" ] && [ "$1" = "debug" ]; then echo "JAVA_HOME should point to a JDK in order to run in debug mode." exit 1 fi -if [ -z "$JRE_HOME" ]; then - JRE_HOME="$JAVA_HOME" -fi # If we're running under jdb, we need a full jdk. if [ "$1" = "debug" ] ; then if [ "$os400" = "true" ]; then if [ ! -x "$JAVA_HOME"/bin/java ] || [ ! -x "$JAVA_HOME"/bin/javac ]; then echo "The JAVA_HOME environment variable is not defined correctly" + echo "JAVA_HOME=$JAVA_HOME" echo "This environment variable is needed to run this program" echo "NB: JAVA_HOME should point to a JDK not a JRE" exit 1
[GitHub] [tomcat] eirbjo opened a new pull request, #608: Remove uses of classes in deprecated package javax.security.cert
eirbjo opened a new pull request, #608: URL: https://github.com/apache/tomcat/pull/608 Efforts are underway in the OpenJDK project to remove the long deprecated-for-removal classes in the package `javax.security.cert`. These classes were introduced for backwards compatibility concerns with the unbundled JSSE release for JDK 1.2/1.3, but their use have been discouraged since they were introduced. It would be good to update Tomcat to not depend on / use these archaic APIs. See https://bugs.openjdk.org/browse/JDK-8227024 and the corresponding CSR https://bugs.openjdk.org/browse/JDK-8227395 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch 9.0.x updated: Improve messages for invalid JRE_HOME/JAVA_HOME
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/9.0.x by this push: new f3698ed9e6 Improve messages for invalid JRE_HOME/JAVA_HOME f3698ed9e6 is described below commit f3698ed9e633d16435a1b75c56d6257ee6342510 Author: Mark Thomas AuthorDate: Tue Apr 11 10:50:04 2023 +0100 Improve messages for invalid JRE_HOME/JAVA_HOME Align JRE_HOME/JAVA_HOME handling with setclasspath.bat --- bin/service.bat| 49 +- bin/setclasspath.bat | 13 +++- bin/setclasspath.sh| 24 --- webapps/docs/changelog.xml | 6 ++ 4 files changed, 70 insertions(+), 22 deletions(-) diff --git a/bin/service.bat b/bin/service.bat index a1ab56d2e2..421424470b 100755 --- a/bin/service.bat +++ b/bin/service.bat @@ -103,36 +103,49 @@ exit /b 1 cd "%CURRENT_DIR%" rem Make sure prerequisite environment variables are set -if not "%JAVA_HOME%" == "" goto gotJdkHome if not "%JRE_HOME%" == "" goto gotJreHome +if not "%JAVA_HOME%" == "" goto gotJavaHome echo Neither the JAVA_HOME nor the JRE_HOME environment variable is defined echo Service will try to guess them from the registry. -goto okJavaHome -:gotJreHome -if not exist "%JRE_HOME%\bin\java.exe" goto noJavaHome -goto okJavaHome -:gotJdkHome -if not exist "%JAVA_HOME%\bin\javac.exe" goto noJavaHome +goto okJava + +:gotJavaHome +rem No JRE given, check if JAVA_HOME is usable as JRE_HOME rem Java 9 has a different directory structure if exist "%JAVA_HOME%\jre\bin\java.exe" goto preJava9Layout -if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome -if not "%JRE_HOME%" == "" goto okJavaHome +if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHomeAsJre +rem Use JAVA_HOME as JRE_HOME set "JRE_HOME=%JAVA_HOME%" -goto okJavaHome +goto okJava + :preJava9Layout -if not "%JRE_HOME%" == "" goto okJavaHome +rem Use JAVA_HOME\jre as JRE_HOME set "JRE_HOME=%JAVA_HOME%\jre" -goto okJavaHome -:noJavaHome -echo The JAVA_HOME environment variable is not defined correctly +goto okJava + +:noJavaHomeAsJre +echo The JAVA_HOME environment variable is not defined correctly. +echo JAVA_HOME=%JAVA_HOME% +echo NB: JAVA_HOME should point to a JDK not a JRE. +exit /b 1 + +:gotJreHome +rem Check if we have a usable JRE +if not exist "%JRE_HOME%\bin\java.exe" goto noJreHome +goto okJava + +:noJreHome +rem Needed at least a JRE +echo The JRE_HOME environment variable is not defined correctly +echo JRE_HOME=%JRE_HOME% echo This environment variable is needed to run this program -echo NB: JAVA_HOME should point to a JDK not a JRE exit /b 1 -:okJavaHome + +:okJava if not "%CATALINA_BASE%" == "" goto gotBase set "CATALINA_BASE=%CATALINA_HOME%" -:gotBase +:gotBase rem Java 9 no longer supports the java.endorsed.dirs rem system property. Only try to use it if rem JAVA_ENDORSED_DIRS was explicitly set @@ -235,4 +248,4 @@ echo Failed installing '%SERVICE_NAME%' service exit /b 1 :installed echo The service '%SERVICE_NAME%' has been installed. -exit /b 0 \ No newline at end of file +exit /b 0 diff --git a/bin/setclasspath.bat b/bin/setclasspath.bat index 12da138fa5..1fa46de7d0 100755 --- a/bin/setclasspath.bat +++ b/bin/setclasspath.bat @@ -43,13 +43,23 @@ goto okJava :noJavaHome echo The JAVA_HOME environment variable is not defined correctly. +echo JAVA_HOME=%JAVA_HOME% echo It is needed to run this program in debug mode. echo NB: JAVA_HOME should point to a JDK not a JRE. goto exit :gotJavaHome -rem No JRE given, use JAVA_HOME as JRE_HOME +rem No JRE given, check if JAVA_HOME is usable as JRE_HOME +if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHomeAsJre +rem Use JAVA_HOME as JRE_HOME set "JRE_HOME=%JAVA_HOME%" +goto okJava + +:noJavaHomeAsJre +echo The JAVA_HOME environment variable is not defined correctly. +echo JAVA_HOME=%JAVA_HOME% +echo NB: JAVA_HOME should point to a JDK not a JRE. +goto exit :gotJreHome rem Check if we have a usable JRE @@ -59,6 +69,7 @@ goto okJava :noJreHome rem Needed at least a JRE echo The JRE_HOME environment variable is not defined correctly +echo JRE_HOME=%JRE_HOME% echo This environment variable is needed to run this program goto exit diff --git a/bin/setclasspath.sh b/bin/setclasspath.sh index 4ae4b6a149..77f1cb2882 100755 --- a/bin/setclasspath.sh +++ b/bin/setclasspath.sh @@ -54,15 +54,13 @@ if [ -z "$JAVA_HOME" ] && [ "$1" = "debug" ]; then echo "JAVA_HOME should point to a JDK in order to run in debug mode." exit 1 fi -if [ -z "$JRE_HOME" ]; then - JRE_HOME="$JAVA_HOME" -fi # If we're running under jdb, we need a full jdk. if [ "$1" = "debug" ] ; then if [ "$os400" = "true" ]; then if [ ! -x "$JAVA_HOME"/bin/java ] || [ ! -x "$JAVA_HOME"/bin/javac ]; then echo "The JAVA_HOME environment variable is not defined correctly" + echo
[tomcat] branch 8.5.x updated: Improve messages for invalid JRE_HOME/JAVA_HOME
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 8.5.x in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/8.5.x by this push: new a92db2f0b4 Improve messages for invalid JRE_HOME/JAVA_HOME a92db2f0b4 is described below commit a92db2f0b4f98130af763e6742be4b252ccdc435 Author: Mark Thomas AuthorDate: Tue Apr 11 10:50:04 2023 +0100 Improve messages for invalid JRE_HOME/JAVA_HOME Align JRE_HOME/JAVA_HOME handling with setclasspath.bat --- bin/service.bat| 49 +- bin/setclasspath.bat | 13 +++- bin/setclasspath.sh| 24 --- webapps/docs/changelog.xml | 6 ++ 4 files changed, 70 insertions(+), 22 deletions(-) diff --git a/bin/service.bat b/bin/service.bat index a1ab56d2e2..421424470b 100755 --- a/bin/service.bat +++ b/bin/service.bat @@ -103,36 +103,49 @@ exit /b 1 cd "%CURRENT_DIR%" rem Make sure prerequisite environment variables are set -if not "%JAVA_HOME%" == "" goto gotJdkHome if not "%JRE_HOME%" == "" goto gotJreHome +if not "%JAVA_HOME%" == "" goto gotJavaHome echo Neither the JAVA_HOME nor the JRE_HOME environment variable is defined echo Service will try to guess them from the registry. -goto okJavaHome -:gotJreHome -if not exist "%JRE_HOME%\bin\java.exe" goto noJavaHome -goto okJavaHome -:gotJdkHome -if not exist "%JAVA_HOME%\bin\javac.exe" goto noJavaHome +goto okJava + +:gotJavaHome +rem No JRE given, check if JAVA_HOME is usable as JRE_HOME rem Java 9 has a different directory structure if exist "%JAVA_HOME%\jre\bin\java.exe" goto preJava9Layout -if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome -if not "%JRE_HOME%" == "" goto okJavaHome +if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHomeAsJre +rem Use JAVA_HOME as JRE_HOME set "JRE_HOME=%JAVA_HOME%" -goto okJavaHome +goto okJava + :preJava9Layout -if not "%JRE_HOME%" == "" goto okJavaHome +rem Use JAVA_HOME\jre as JRE_HOME set "JRE_HOME=%JAVA_HOME%\jre" -goto okJavaHome -:noJavaHome -echo The JAVA_HOME environment variable is not defined correctly +goto okJava + +:noJavaHomeAsJre +echo The JAVA_HOME environment variable is not defined correctly. +echo JAVA_HOME=%JAVA_HOME% +echo NB: JAVA_HOME should point to a JDK not a JRE. +exit /b 1 + +:gotJreHome +rem Check if we have a usable JRE +if not exist "%JRE_HOME%\bin\java.exe" goto noJreHome +goto okJava + +:noJreHome +rem Needed at least a JRE +echo The JRE_HOME environment variable is not defined correctly +echo JRE_HOME=%JRE_HOME% echo This environment variable is needed to run this program -echo NB: JAVA_HOME should point to a JDK not a JRE exit /b 1 -:okJavaHome + +:okJava if not "%CATALINA_BASE%" == "" goto gotBase set "CATALINA_BASE=%CATALINA_HOME%" -:gotBase +:gotBase rem Java 9 no longer supports the java.endorsed.dirs rem system property. Only try to use it if rem JAVA_ENDORSED_DIRS was explicitly set @@ -235,4 +248,4 @@ echo Failed installing '%SERVICE_NAME%' service exit /b 1 :installed echo The service '%SERVICE_NAME%' has been installed. -exit /b 0 \ No newline at end of file +exit /b 0 diff --git a/bin/setclasspath.bat b/bin/setclasspath.bat index 12da138fa5..1fa46de7d0 100755 --- a/bin/setclasspath.bat +++ b/bin/setclasspath.bat @@ -43,13 +43,23 @@ goto okJava :noJavaHome echo The JAVA_HOME environment variable is not defined correctly. +echo JAVA_HOME=%JAVA_HOME% echo It is needed to run this program in debug mode. echo NB: JAVA_HOME should point to a JDK not a JRE. goto exit :gotJavaHome -rem No JRE given, use JAVA_HOME as JRE_HOME +rem No JRE given, check if JAVA_HOME is usable as JRE_HOME +if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHomeAsJre +rem Use JAVA_HOME as JRE_HOME set "JRE_HOME=%JAVA_HOME%" +goto okJava + +:noJavaHomeAsJre +echo The JAVA_HOME environment variable is not defined correctly. +echo JAVA_HOME=%JAVA_HOME% +echo NB: JAVA_HOME should point to a JDK not a JRE. +goto exit :gotJreHome rem Check if we have a usable JRE @@ -59,6 +69,7 @@ goto okJava :noJreHome rem Needed at least a JRE echo The JRE_HOME environment variable is not defined correctly +echo JRE_HOME=%JRE_HOME% echo This environment variable is needed to run this program goto exit diff --git a/bin/setclasspath.sh b/bin/setclasspath.sh index 4ae4b6a149..77f1cb2882 100755 --- a/bin/setclasspath.sh +++ b/bin/setclasspath.sh @@ -54,15 +54,13 @@ if [ -z "$JAVA_HOME" ] && [ "$1" = "debug" ]; then echo "JAVA_HOME should point to a JDK in order to run in debug mode." exit 1 fi -if [ -z "$JRE_HOME" ]; then - JRE_HOME="$JAVA_HOME" -fi # If we're running under jdb, we need a full jdk. if [ "$1" = "debug" ] ; then if [ "$os400" = "true" ]; then if [ ! -x "$JAVA_HOME"/bin/java ] || [ ! -x "$JAVA_HOME"/bin/javac ]; then echo "The JAVA_HOME environment variable is not defined correctly" + echo
[GitHub] [tomcat] markt-asf commented on pull request #608: Remove uses of deprecated classes in javax.security.cert
markt-asf commented on PR #608: URL: https://github.com/apache/tomcat/pull/608#issuecomment-1503257308 Thanks for the PR. Note for reviewers: There is a default method in Java 17 (but not Java 11) so this change is safe in Tomcat 11 but can't be back-ported to earlier versions. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[GitHub] [tomcat] markt-asf merged pull request #608: Remove uses of deprecated classes in javax.security.cert
markt-asf merged PR #608: URL: https://github.com/apache/tomcat/pull/608 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch main updated: Remove usages of classes in the deprecated-for-removal package javax.security.cert.
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/main by this push: new 58c3b5da1d Remove usages of classes in the deprecated-for-removal package javax.security.cert. 58c3b5da1d is described below commit 58c3b5da1dab993fd0fbf530ccfd82147a3dc229 Author: Eirik Bjorsnos AuthorDate: Tue Apr 11 13:42:40 2023 +0200 Remove usages of classes in the deprecated-for-removal package javax.security.cert. --- .../tomcat/util/net/openssl/OpenSSLEngine.java | 34 -- .../util/net/openssl/panama/OpenSSLEngine.java | 34 -- .../util/net/openssl/panama/OpenSSLEngine.java | 34 -- 3 files changed, 102 deletions(-) diff --git a/java/org/apache/tomcat/util/net/openssl/OpenSSLEngine.java b/java/org/apache/tomcat/util/net/openssl/OpenSSLEngine.java index 39ee3f9130..1c38eebe0b 100644 --- a/java/org/apache/tomcat/util/net/openssl/OpenSSLEngine.java +++ b/java/org/apache/tomcat/util/net/openssl/OpenSSLEngine.java @@ -151,8 +151,6 @@ public final class OpenSSLEngine extends SSLEngine implements SSLUtil.ProtocolIn private volatile String applicationProtocol; private volatile Certificate[] peerCerts; -@Deprecated -private volatile javax.security.cert.X509Certificate[] x509PeerCerts; private volatile ClientAuthMode clientAuth = ClientAuthMode.NONE; // SSL Engine status variables @@ -947,7 +945,6 @@ public final class OpenSSLEngine extends SSLEngine implements SSLUtil.ProtocolIn } handshakeFinished = false; peerCerts = null; -x509PeerCerts = null; currentHandshake = SSL.getHandshakeCount(state.ssl); int code2 = SSL.doHandshake(state.ssl); if (code2 <= 0) { @@ -1327,37 +1324,6 @@ public final class OpenSSLEngine extends SSLEngine implements SSLUtil.ProtocolIn return EMPTY_CERTIFICATES; } -@Deprecated -@Override -public javax.security.cert.X509Certificate[] getPeerCertificateChain() -throws SSLPeerUnverifiedException { -// these are lazy created to reduce memory overhead -javax.security.cert.X509Certificate[] c = x509PeerCerts; -if (c == null) { -byte[][] chain; -synchronized (OpenSSLEngine.this) { -if (destroyed || SSL.isInInit(state.ssl) != 0) { -throw new SSLPeerUnverifiedException(sm.getString("engine.unverifiedPeer")); -} -chain = SSL.getPeerCertChain(state.ssl); -} -if (chain == null) { -throw new SSLPeerUnverifiedException(sm.getString("engine.unverifiedPeer")); -} -javax.security.cert.X509Certificate[] peerCerts = -new javax.security.cert.X509Certificate[chain.length]; -for (int i = 0; i < peerCerts.length; i++) { -try { -peerCerts[i] = javax.security.cert.X509Certificate.getInstance(chain[i]); -} catch (javax.security.cert.CertificateException e) { -throw new IllegalStateException(e); -} -} -c = x509PeerCerts = peerCerts; -} -return c; -} - @Override public Principal getPeerPrincipal() throws SSLPeerUnverifiedException { Certificate[] peer = getPeerCertificates(); diff --git a/modules/openssl-foreign/src/main/java/org/apache/tomcat/util/net/openssl/panama/OpenSSLEngine.java b/modules/openssl-foreign/src/main/java/org/apache/tomcat/util/net/openssl/panama/OpenSSLEngine.java index c3755f0d40..1645f8f0b4 100644 --- a/modules/openssl-foreign/src/main/java/org/apache/tomcat/util/net/openssl/panama/OpenSSLEngine.java +++ b/modules/openssl-foreign/src/main/java/org/apache/tomcat/util/net/openssl/panama/OpenSSLEngine.java @@ -203,8 +203,6 @@ public final class OpenSSLEngine extends SSLEngine implements SSLUtil.ProtocolIn private volatile String applicationProtocol; private volatile Certificate[] peerCerts; -@Deprecated -private volatile javax.security.cert.X509Certificate[] x509PeerCerts; private volatile ClientAuthMode clientAuth = ClientAuthMode.NONE; // SSL Engine status variables @@ -1006,7 +1004,6 @@ public final class OpenSSLEngine extends SSLEngine implements SSLUtil.ProtocolIn } handshakeFinished = false; peerCerts = null; -x509PeerCerts = null; currentHandshake = state.handshakeCount; int code2 = SSL_do_handshake(state.ssl); if (code2 <= 0) { @@ -1673,37 +1670,6 @@ public final class OpenSSLEngine extends SSLEngine implements SSLUtil.ProtocolIn
[tomcat] branch main updated: Add change log entry
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/main by this push: new 85287b7648 Add change log entry 85287b7648 is described below commit 85287b7648c09b896553d8f855ab074d7beb660d Author: Mark Thomas AuthorDate: Tue Apr 11 14:01:37 2023 +0100 Add change log entry --- webapps/docs/changelog.xml | 4 1 file changed, 4 insertions(+) diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 80eda46d47..be30c78a54 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -219,6 +219,10 @@ ERR_HTTP2_SERVER_REFUSED_STREAM for some connections. (markt) + +Remove use of deprecated classes in the javax.security.cert +package. Pull request 608 provided by Eirik Bjorsnos. (markt) + - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] 01/03: Prep for clean-up
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git commit 554cea6b6c05d548b10ffe9d14494839c9cb38c0 Author: Mark Thomas AuthorDate: Tue Apr 11 16:31:18 2023 +0100 Prep for clean-up --- java/org/apache/tomcat/util/http/MimeHeaders.java | 15 +-- .../apache/tomcat/util/http/Rfc6265CookieProcessor.java | 11 ++- java/org/apache/tomcat/util/http/ServerCookie.java| 2 +- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/java/org/apache/tomcat/util/http/MimeHeaders.java b/java/org/apache/tomcat/util/http/MimeHeaders.java index b2b56b7d2e..89007660a8 100644 --- a/java/org/apache/tomcat/util/http/MimeHeaders.java +++ b/java/org/apache/tomcat/util/http/MimeHeaders.java @@ -67,20 +67,23 @@ import org.apache.tomcat.util.res.StringManager; /** * Memory-efficient repository for Mime Headers. When the object is recycled, it * will keep the allocated headers[] and all the MimeHeaderField - no GC is generated. - * + * * For input headers it is possible to use the MessageByte for Fields - so no GC * will be generated. - * + * * The only garbage is generated when using the String for header names/values - * this can't be avoided when the servlet calls header methods, but is easy * to avoid inside tomcat. The goal is to use _only_ MessageByte-based Fields, * and reduce to 0 the memory overhead of tomcat. + * * * TODO: - * XXX one-buffer parsing - for http ( other protocols don't need that ) - * XXX remove unused methods - * XXX External enumerations, with 0 GC. - * XXX use HeaderName ID + * + * one-buffer parsing - for http (other protocols don't need that) + * remove unused methods + * External enumerations, with 0 GC. + * use HeaderName ID + * * * * @author d...@eng.sun.com diff --git a/java/org/apache/tomcat/util/http/Rfc6265CookieProcessor.java b/java/org/apache/tomcat/util/http/Rfc6265CookieProcessor.java index 2a35863a2b..fae81d5657 100644 --- a/java/org/apache/tomcat/util/http/Rfc6265CookieProcessor.java +++ b/java/org/apache/tomcat/util/http/Rfc6265CookieProcessor.java @@ -108,11 +108,12 @@ public class Rfc6265CookieProcessor extends CookieProcessorBase { // Can't use StringBuilder due to DateFormat StringBuffer header = new StringBuffer(); -// TODO: Name validation takes place in Cookie and cannot be configured -// per Context. Moving it to here would allow per Context config -// but delay validation until the header is generated. However, -// the spec requires an IllegalArgumentException on Cookie -// generation. +/* TODO: Name validation takes place in Cookie and cannot be configured + * per Context. Moving it to here would allow per Context config + * but delay validation until the header is generated. However, + * the spec requires an IllegalArgumentException on Cookie + * generation. + */ header.append(cookie.getName()); header.append('='); String value = cookie.getValue(); diff --git a/java/org/apache/tomcat/util/http/ServerCookie.java b/java/org/apache/tomcat/util/http/ServerCookie.java index 157b76ae00..43261fe13f 100644 --- a/java/org/apache/tomcat/util/http/ServerCookie.java +++ b/java/org/apache/tomcat/util/http/ServerCookie.java @@ -26,7 +26,7 @@ import org.apache.tomcat.util.buf.MessageBytes; * Allows recycling and uses MessageBytes as low-level * representation ( and thus the byte -> char conversion can be delayed * until we know the charset ). - * + * * Tomcat.core uses this recyclable object to represent cookies, * and the facade will convert it to the external representation. */ - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch main updated (85287b7648 -> d53d8e7f77)
This is an automated email from the ASF dual-hosted git repository. markt pushed a change to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git from 85287b7648 Add change log entry new 554cea6b6c Prep for clean-up new 4a5766fc05 Clean-up. No functional change. new d53d8e7f77 Fix parameter counting logic The 3 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../tomcat/util/http/ConcurrentDateFormat.java | 5 +- .../apache/tomcat/util/http/CookieProcessor.java | 26 ++--- .../tomcat/util/http/CookieProcessorBase.java | 11 +- .../tomcat/util/http/FastHttpDateFormat.java | 16 +-- java/org/apache/tomcat/util/http/HeaderUtil.java | 10 +- java/org/apache/tomcat/util/http/MimeHeaders.java | 18 ++-- java/org/apache/tomcat/util/http/Parameters.java | 113 ++--- java/org/apache/tomcat/util/http/RequestUtil.java | 22 ++-- .../tomcat/util/http/Rfc6265CookieProcessor.java | 87 +++- java/org/apache/tomcat/util/http/ServerCookie.java | 16 ++- .../org/apache/tomcat/util/http/ServerCookies.java | 11 +- 11 files changed, 154 insertions(+), 181 deletions(-) - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] 03/03: Fix parameter counting logic
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git commit d53d8e7f77042cc32a3b98f589496a1ef5088e38 Author: Mark Thomas AuthorDate: Tue Apr 11 16:41:44 2023 +0100 Fix parameter counting logic --- java/org/apache/tomcat/util/http/Parameters.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/java/org/apache/tomcat/util/http/Parameters.java b/java/org/apache/tomcat/util/http/Parameters.java index d4cc5868b1..debf968acf 100644 --- a/java/org/apache/tomcat/util/http/Parameters.java +++ b/java/org/apache/tomcat/util/http/Parameters.java @@ -201,13 +201,13 @@ public final class Parameters { return; } -parameterCount++; -if (limit > -1 && parameterCount > limit) { +if (limit > -1 && parameterCount >= limit) { // Processing this parameter will push us over the limit. ISE is // what Request.parseParts() uses for requests that are too big setParseFailedReason(FailReason.TOO_MANY_PARAMETERS); throw new IllegalStateException(sm.getString("parameters.maxCountFail", Integer.valueOf(limit))); } +parameterCount++; paramHashValues.computeIfAbsent(key, k -> new ArrayList<>(1)).add(value); } - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] 02/03: Clean-up. No functional change.
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git commit 4a5766fc05960dfd1edbb4855eb6e92c0fd67cf0 Author: Mark Thomas AuthorDate: Tue Apr 11 16:36:27 2023 +0100 Clean-up. No functional change. --- .../tomcat/util/http/ConcurrentDateFormat.java | 5 +- .../apache/tomcat/util/http/CookieProcessor.java | 26 ++--- .../tomcat/util/http/CookieProcessorBase.java | 11 +- .../tomcat/util/http/FastHttpDateFormat.java | 16 +-- java/org/apache/tomcat/util/http/HeaderUtil.java | 10 +- java/org/apache/tomcat/util/http/MimeHeaders.java | 3 +- java/org/apache/tomcat/util/http/Parameters.java | 111 ++--- java/org/apache/tomcat/util/http/RequestUtil.java | 22 ++-- .../tomcat/util/http/Rfc6265CookieProcessor.java | 86 +++- java/org/apache/tomcat/util/http/ServerCookie.java | 14 ++- .../org/apache/tomcat/util/http/ServerCookies.java | 11 +- 11 files changed, 142 insertions(+), 173 deletions(-) diff --git a/java/org/apache/tomcat/util/http/ConcurrentDateFormat.java b/java/org/apache/tomcat/util/http/ConcurrentDateFormat.java index 02a456f20a..eb678aa5fb 100644 --- a/java/org/apache/tomcat/util/http/ConcurrentDateFormat.java +++ b/java/org/apache/tomcat/util/http/ConcurrentDateFormat.java @@ -25,9 +25,8 @@ import java.util.TimeZone; import java.util.concurrent.ConcurrentLinkedQueue; /** - * A thread safe wrapper around {@link SimpleDateFormat} that does not make use - * of ThreadLocal and - broadly - only creates enough SimpleDateFormat objects - * to satisfy the concurrency requirements. + * A thread safe wrapper around {@link SimpleDateFormat} that does not make use of ThreadLocal and - broadly - only + * creates enough SimpleDateFormat objects to satisfy the concurrency requirements. */ public class ConcurrentDateFormat { diff --git a/java/org/apache/tomcat/util/http/CookieProcessor.java b/java/org/apache/tomcat/util/http/CookieProcessor.java index 6ea0fe9b18..d84cc87099 100644 --- a/java/org/apache/tomcat/util/http/CookieProcessor.java +++ b/java/org/apache/tomcat/util/http/CookieProcessor.java @@ -27,33 +27,27 @@ public interface CookieProcessor { * Parse the provided headers into server cookie objects. * * @param headers The HTTP headers to parse - * @param serverCookies The server cookies object to populate with the - * results of the parsing + * @param serverCookies The server cookies object to populate with the results of the parsing */ void parseCookieHeader(MimeHeaders headers, ServerCookies serverCookies); /** - * Generate the {@code Set-Cookie} HTTP header value for the given Cookie. - * This method receives as parameter the servlet request so that it can make - * decisions based on request properties. One such use-case is decide if the - * SameSite attribute should be added to the cookie based on the User-Agent - * or other request header because there are browser versions incompatible - * with the SameSite attribute. This is described by https://www.chromium.org/updates/same-site/incompatible-clients";>the - * Chromium project. + * Generate the {@code Set-Cookie} HTTP header value for the given Cookie. This method receives as parameter the + * servlet request so that it can make decisions based on request properties. One such use-case is decide if the + * SameSite attribute should be added to the cookie based on the User-Agent or other request header because there + * are browser versions incompatible with the SameSite attribute. This is described by + * https://www.chromium.org/updates/same-site/incompatible-clients";>the Chromium project. * * @param request The servlet request + * @param cookie The cookie for which the header will be generated * - * @param cookie The cookie for which the header will be generated - * - * @return The header value in a form that can be added directly to the - * response + * @return The header value in a form that can be added directly to the response */ String generateHeader(Cookie cookie, HttpServletRequest request); /** - * Obtain the character set that will be used when converting between bytes - * and characters when parsing and/or generating HTTP headers for cookies. + * Obtain the character set that will be used when converting between bytes and characters when parsing and/or + * generating HTTP headers for cookies. * * @return The character set used for byte<->character conversions */ diff --git a/java/org/apache/tomcat/util/http/CookieProcessorBase.java b/java/org/apache/tomcat/util/http/CookieProcessorBase.java index 5c3b08bfd9..00c852cc75 100644 --- a/java/org/apache/tomcat/util/http/CookieProcessorBase.java +++ b/java/org/apach
[tomcat] branch 10.1.x updated (b1709064e3 -> ba848da71c)
This is an automated email from the ASF dual-hosted git repository. markt pushed a change to branch 10.1.x in repository https://gitbox.apache.org/repos/asf/tomcat.git from b1709064e3 Improve messages for invalid JRE_HOME/JAVA_HOME new d39db0c10b Prep for clean-up new 969c239e09 Code clean-up. No functional change. new ba848da71c Fix parameter counting logic The 3 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../tomcat/util/http/ConcurrentDateFormat.java | 5 +- .../apache/tomcat/util/http/CookieProcessor.java | 26 ++- .../tomcat/util/http/CookieProcessorBase.java | 11 +- .../tomcat/util/http/FastHttpDateFormat.java | 16 +- java/org/apache/tomcat/util/http/HeaderUtil.java | 10 +- java/org/apache/tomcat/util/http/MimeHeaders.java | 184 +++-- java/org/apache/tomcat/util/http/Parameters.java | 113 ++--- java/org/apache/tomcat/util/http/RequestUtil.java | 22 ++- .../tomcat/util/http/Rfc6265CookieProcessor.java | 87 +- java/org/apache/tomcat/util/http/ServerCookie.java | 16 +- .../org/apache/tomcat/util/http/ServerCookies.java | 11 +- 11 files changed, 238 insertions(+), 263 deletions(-) - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] 02/03: Code clean-up. No functional change.
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 10.1.x in repository https://gitbox.apache.org/repos/asf/tomcat.git commit 969c239e093dea6ce89d86d033704c9726eb00f7 Author: Mark Thomas AuthorDate: Tue Apr 11 16:43:20 2023 +0100 Code clean-up. No functional change. --- .../tomcat/util/http/ConcurrentDateFormat.java | 5 +- .../apache/tomcat/util/http/CookieProcessor.java | 26 ++- .../tomcat/util/http/CookieProcessorBase.java | 11 +- .../tomcat/util/http/FastHttpDateFormat.java | 16 +- java/org/apache/tomcat/util/http/HeaderUtil.java | 10 +- java/org/apache/tomcat/util/http/MimeHeaders.java | 185 +++-- java/org/apache/tomcat/util/http/Parameters.java | 111 ++--- java/org/apache/tomcat/util/http/RequestUtil.java | 22 ++- .../tomcat/util/http/Rfc6265CookieProcessor.java | 86 +- java/org/apache/tomcat/util/http/ServerCookie.java | 14 +- .../org/apache/tomcat/util/http/ServerCookies.java | 11 +- 11 files changed, 234 insertions(+), 263 deletions(-) diff --git a/java/org/apache/tomcat/util/http/ConcurrentDateFormat.java b/java/org/apache/tomcat/util/http/ConcurrentDateFormat.java index 02a456f20a..eb678aa5fb 100644 --- a/java/org/apache/tomcat/util/http/ConcurrentDateFormat.java +++ b/java/org/apache/tomcat/util/http/ConcurrentDateFormat.java @@ -25,9 +25,8 @@ import java.util.TimeZone; import java.util.concurrent.ConcurrentLinkedQueue; /** - * A thread safe wrapper around {@link SimpleDateFormat} that does not make use - * of ThreadLocal and - broadly - only creates enough SimpleDateFormat objects - * to satisfy the concurrency requirements. + * A thread safe wrapper around {@link SimpleDateFormat} that does not make use of ThreadLocal and - broadly - only + * creates enough SimpleDateFormat objects to satisfy the concurrency requirements. */ public class ConcurrentDateFormat { diff --git a/java/org/apache/tomcat/util/http/CookieProcessor.java b/java/org/apache/tomcat/util/http/CookieProcessor.java index 6ea0fe9b18..d84cc87099 100644 --- a/java/org/apache/tomcat/util/http/CookieProcessor.java +++ b/java/org/apache/tomcat/util/http/CookieProcessor.java @@ -27,33 +27,27 @@ public interface CookieProcessor { * Parse the provided headers into server cookie objects. * * @param headers The HTTP headers to parse - * @param serverCookies The server cookies object to populate with the - * results of the parsing + * @param serverCookies The server cookies object to populate with the results of the parsing */ void parseCookieHeader(MimeHeaders headers, ServerCookies serverCookies); /** - * Generate the {@code Set-Cookie} HTTP header value for the given Cookie. - * This method receives as parameter the servlet request so that it can make - * decisions based on request properties. One such use-case is decide if the - * SameSite attribute should be added to the cookie based on the User-Agent - * or other request header because there are browser versions incompatible - * with the SameSite attribute. This is described by https://www.chromium.org/updates/same-site/incompatible-clients";>the - * Chromium project. + * Generate the {@code Set-Cookie} HTTP header value for the given Cookie. This method receives as parameter the + * servlet request so that it can make decisions based on request properties. One such use-case is decide if the + * SameSite attribute should be added to the cookie based on the User-Agent or other request header because there + * are browser versions incompatible with the SameSite attribute. This is described by + * https://www.chromium.org/updates/same-site/incompatible-clients";>the Chromium project. * * @param request The servlet request + * @param cookie The cookie for which the header will be generated * - * @param cookie The cookie for which the header will be generated - * - * @return The header value in a form that can be added directly to the - * response + * @return The header value in a form that can be added directly to the response */ String generateHeader(Cookie cookie, HttpServletRequest request); /** - * Obtain the character set that will be used when converting between bytes - * and characters when parsing and/or generating HTTP headers for cookies. + * Obtain the character set that will be used when converting between bytes and characters when parsing and/or + * generating HTTP headers for cookies. * * @return The character set used for byte<->character conversions */ diff --git a/java/org/apache/tomcat/util/http/CookieProcessorBase.java b/java/org/apache/tomcat/util/http/CookieProcessorBase.java index 5c3b08bfd9..00c852cc75 100644 --- a/java/org/apache/tomcat/util/http/CookieProcessorBase.java +++ b/java/or
[tomcat] 03/03: Fix parameter counting logic
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 10.1.x in repository https://gitbox.apache.org/repos/asf/tomcat.git commit ba848da71c523d94950d3c53c19ea155189df9dc Author: Mark Thomas AuthorDate: Tue Apr 11 16:41:44 2023 +0100 Fix parameter counting logic --- java/org/apache/tomcat/util/http/Parameters.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/java/org/apache/tomcat/util/http/Parameters.java b/java/org/apache/tomcat/util/http/Parameters.java index d4cc5868b1..debf968acf 100644 --- a/java/org/apache/tomcat/util/http/Parameters.java +++ b/java/org/apache/tomcat/util/http/Parameters.java @@ -201,13 +201,13 @@ public final class Parameters { return; } -parameterCount++; -if (limit > -1 && parameterCount > limit) { +if (limit > -1 && parameterCount >= limit) { // Processing this parameter will push us over the limit. ISE is // what Request.parseParts() uses for requests that are too big setParseFailedReason(FailReason.TOO_MANY_PARAMETERS); throw new IllegalStateException(sm.getString("parameters.maxCountFail", Integer.valueOf(limit))); } +parameterCount++; paramHashValues.computeIfAbsent(key, k -> new ArrayList<>(1)).add(value); } - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] 01/03: Prep for clean-up
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 10.1.x in repository https://gitbox.apache.org/repos/asf/tomcat.git commit d39db0c10b78878617e3dd3f502eedbe10388c40 Author: Mark Thomas AuthorDate: Tue Apr 11 16:31:18 2023 +0100 Prep for clean-up --- java/org/apache/tomcat/util/http/MimeHeaders.java | 15 +-- .../apache/tomcat/util/http/Rfc6265CookieProcessor.java | 11 ++- java/org/apache/tomcat/util/http/ServerCookie.java| 2 +- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/java/org/apache/tomcat/util/http/MimeHeaders.java b/java/org/apache/tomcat/util/http/MimeHeaders.java index b2b56b7d2e..89007660a8 100644 --- a/java/org/apache/tomcat/util/http/MimeHeaders.java +++ b/java/org/apache/tomcat/util/http/MimeHeaders.java @@ -67,20 +67,23 @@ import org.apache.tomcat.util.res.StringManager; /** * Memory-efficient repository for Mime Headers. When the object is recycled, it * will keep the allocated headers[] and all the MimeHeaderField - no GC is generated. - * + * * For input headers it is possible to use the MessageByte for Fields - so no GC * will be generated. - * + * * The only garbage is generated when using the String for header names/values - * this can't be avoided when the servlet calls header methods, but is easy * to avoid inside tomcat. The goal is to use _only_ MessageByte-based Fields, * and reduce to 0 the memory overhead of tomcat. + * * * TODO: - * XXX one-buffer parsing - for http ( other protocols don't need that ) - * XXX remove unused methods - * XXX External enumerations, with 0 GC. - * XXX use HeaderName ID + * + * one-buffer parsing - for http (other protocols don't need that) + * remove unused methods + * External enumerations, with 0 GC. + * use HeaderName ID + * * * * @author d...@eng.sun.com diff --git a/java/org/apache/tomcat/util/http/Rfc6265CookieProcessor.java b/java/org/apache/tomcat/util/http/Rfc6265CookieProcessor.java index 8f2da681b2..e6e8a0e702 100644 --- a/java/org/apache/tomcat/util/http/Rfc6265CookieProcessor.java +++ b/java/org/apache/tomcat/util/http/Rfc6265CookieProcessor.java @@ -108,11 +108,12 @@ public class Rfc6265CookieProcessor extends CookieProcessorBase { // Can't use StringBuilder due to DateFormat StringBuffer header = new StringBuffer(); -// TODO: Name validation takes place in Cookie and cannot be configured -// per Context. Moving it to here would allow per Context config -// but delay validation until the header is generated. However, -// the spec requires an IllegalArgumentException on Cookie -// generation. +/* TODO: Name validation takes place in Cookie and cannot be configured + * per Context. Moving it to here would allow per Context config + * but delay validation until the header is generated. However, + * the spec requires an IllegalArgumentException on Cookie + * generation. + */ header.append(cookie.getName()); header.append('='); String value = cookie.getValue(); diff --git a/java/org/apache/tomcat/util/http/ServerCookie.java b/java/org/apache/tomcat/util/http/ServerCookie.java index 157b76ae00..43261fe13f 100644 --- a/java/org/apache/tomcat/util/http/ServerCookie.java +++ b/java/org/apache/tomcat/util/http/ServerCookie.java @@ -26,7 +26,7 @@ import org.apache.tomcat.util.buf.MessageBytes; * Allows recycling and uses MessageBytes as low-level * representation ( and thus the byte -> char conversion can be delayed * until we know the charset ). - * + * * Tomcat.core uses this recyclable object to represent cookies, * and the facade will convert it to the external representation. */ - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch 9.0.x updated (f3698ed9e6 -> fbd8142162)
This is an automated email from the ASF dual-hosted git repository. markt pushed a change to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git from f3698ed9e6 Improve messages for invalid JRE_HOME/JAVA_HOME new fa18633dec Prep for clean-up new 98016a0e5f Code clean-up. No functional change. new fbd8142162 Fix parameter counting logic The 3 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../tomcat/util/http/ConcurrentDateFormat.java | 5 +- .../apache/tomcat/util/http/CookieProcessor.java | 42 +-- .../tomcat/util/http/CookieProcessorBase.java | 11 +- .../tomcat/util/http/FastHttpDateFormat.java | 33 +- java/org/apache/tomcat/util/http/HeaderUtil.java | 10 +- .../tomcat/util/http/LegacyCookieProcessor.java| 331 + java/org/apache/tomcat/util/http/MimeHeaders.java | 184 ++-- java/org/apache/tomcat/util/http/Parameters.java | 113 --- java/org/apache/tomcat/util/http/RequestUtil.java | 22 +- .../tomcat/util/http/Rfc6265CookieProcessor.java | 49 ++- java/org/apache/tomcat/util/http/ServerCookie.java | 27 +- .../org/apache/tomcat/util/http/ServerCookies.java | 11 +- 12 files changed, 382 insertions(+), 456 deletions(-) - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] 01/03: Prep for clean-up
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git commit fa18633dec56053aff7deb82624fc9801842888a Author: Mark Thomas AuthorDate: Tue Apr 11 16:31:18 2023 +0100 Prep for clean-up --- java/org/apache/tomcat/util/http/MimeHeaders.java | 15 +-- .../apache/tomcat/util/http/Rfc6265CookieProcessor.java | 11 ++- java/org/apache/tomcat/util/http/ServerCookie.java| 2 +- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/java/org/apache/tomcat/util/http/MimeHeaders.java b/java/org/apache/tomcat/util/http/MimeHeaders.java index b2b56b7d2e..89007660a8 100644 --- a/java/org/apache/tomcat/util/http/MimeHeaders.java +++ b/java/org/apache/tomcat/util/http/MimeHeaders.java @@ -67,20 +67,23 @@ import org.apache.tomcat.util.res.StringManager; /** * Memory-efficient repository for Mime Headers. When the object is recycled, it * will keep the allocated headers[] and all the MimeHeaderField - no GC is generated. - * + * * For input headers it is possible to use the MessageByte for Fields - so no GC * will be generated. - * + * * The only garbage is generated when using the String for header names/values - * this can't be avoided when the servlet calls header methods, but is easy * to avoid inside tomcat. The goal is to use _only_ MessageByte-based Fields, * and reduce to 0 the memory overhead of tomcat. + * * * TODO: - * XXX one-buffer parsing - for http ( other protocols don't need that ) - * XXX remove unused methods - * XXX External enumerations, with 0 GC. - * XXX use HeaderName ID + * + * one-buffer parsing - for http (other protocols don't need that) + * remove unused methods + * External enumerations, with 0 GC. + * use HeaderName ID + * * * * @author d...@eng.sun.com diff --git a/java/org/apache/tomcat/util/http/Rfc6265CookieProcessor.java b/java/org/apache/tomcat/util/http/Rfc6265CookieProcessor.java index f2d9152ffe..264dd45cf0 100644 --- a/java/org/apache/tomcat/util/http/Rfc6265CookieProcessor.java +++ b/java/org/apache/tomcat/util/http/Rfc6265CookieProcessor.java @@ -111,11 +111,12 @@ public class Rfc6265CookieProcessor extends CookieProcessorBase { // Can't use StringBuilder due to DateFormat StringBuffer header = new StringBuffer(); -// TODO: Name validation takes place in Cookie and cannot be configured -// per Context. Moving it to here would allow per Context config -// but delay validation until the header is generated. However, -// the spec requires an IllegalArgumentException on Cookie -// generation. +/* TODO: Name validation takes place in Cookie and cannot be configured + * per Context. Moving it to here would allow per Context config + * but delay validation until the header is generated. However, + * the spec requires an IllegalArgumentException on Cookie + * generation. + */ header.append(cookie.getName()); header.append('='); String value = cookie.getValue(); diff --git a/java/org/apache/tomcat/util/http/ServerCookie.java b/java/org/apache/tomcat/util/http/ServerCookie.java index 5ae7f0da6b..23c088797f 100644 --- a/java/org/apache/tomcat/util/http/ServerCookie.java +++ b/java/org/apache/tomcat/util/http/ServerCookie.java @@ -26,7 +26,7 @@ import org.apache.tomcat.util.buf.MessageBytes; * Allows recycling and uses MessageBytes as low-level * representation ( and thus the byte -> char conversion can be delayed * until we know the charset ). - * + * * Tomcat.core uses this recyclable object to represent cookies, * and the facade will convert it to the external representation. */ - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] 03/03: Fix parameter counting logic
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git commit fbd81421629afe8b8a3922d59020cde81caea861 Author: Mark Thomas AuthorDate: Tue Apr 11 16:41:44 2023 +0100 Fix parameter counting logic --- java/org/apache/tomcat/util/http/Parameters.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/java/org/apache/tomcat/util/http/Parameters.java b/java/org/apache/tomcat/util/http/Parameters.java index d4cc5868b1..debf968acf 100644 --- a/java/org/apache/tomcat/util/http/Parameters.java +++ b/java/org/apache/tomcat/util/http/Parameters.java @@ -201,13 +201,13 @@ public final class Parameters { return; } -parameterCount++; -if (limit > -1 && parameterCount > limit) { +if (limit > -1 && parameterCount >= limit) { // Processing this parameter will push us over the limit. ISE is // what Request.parseParts() uses for requests that are too big setParseFailedReason(FailReason.TOO_MANY_PARAMETERS); throw new IllegalStateException(sm.getString("parameters.maxCountFail", Integer.valueOf(limit))); } +parameterCount++; paramHashValues.computeIfAbsent(key, k -> new ArrayList<>(1)).add(value); } - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] 02/03: Code clean-up. No functional change.
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git commit 98016a0e5f46e582b3ffce78914ae7928cc12832 Author: Mark Thomas AuthorDate: Tue Apr 11 16:46:11 2023 +0100 Code clean-up. No functional change. --- .../tomcat/util/http/ConcurrentDateFormat.java | 5 +- .../apache/tomcat/util/http/CookieProcessor.java | 42 +-- .../tomcat/util/http/CookieProcessorBase.java | 11 +- .../tomcat/util/http/FastHttpDateFormat.java | 33 +- java/org/apache/tomcat/util/http/HeaderUtil.java | 10 +- .../tomcat/util/http/LegacyCookieProcessor.java| 331 + java/org/apache/tomcat/util/http/MimeHeaders.java | 185 ++-- java/org/apache/tomcat/util/http/Parameters.java | 111 --- java/org/apache/tomcat/util/http/RequestUtil.java | 22 +- .../tomcat/util/http/Rfc6265CookieProcessor.java | 48 ++- java/org/apache/tomcat/util/http/ServerCookie.java | 25 +- .../org/apache/tomcat/util/http/ServerCookies.java | 11 +- 12 files changed, 378 insertions(+), 456 deletions(-) diff --git a/java/org/apache/tomcat/util/http/ConcurrentDateFormat.java b/java/org/apache/tomcat/util/http/ConcurrentDateFormat.java index 02a456f20a..eb678aa5fb 100644 --- a/java/org/apache/tomcat/util/http/ConcurrentDateFormat.java +++ b/java/org/apache/tomcat/util/http/ConcurrentDateFormat.java @@ -25,9 +25,8 @@ import java.util.TimeZone; import java.util.concurrent.ConcurrentLinkedQueue; /** - * A thread safe wrapper around {@link SimpleDateFormat} that does not make use - * of ThreadLocal and - broadly - only creates enough SimpleDateFormat objects - * to satisfy the concurrency requirements. + * A thread safe wrapper around {@link SimpleDateFormat} that does not make use of ThreadLocal and - broadly - only + * creates enough SimpleDateFormat objects to satisfy the concurrency requirements. */ public class ConcurrentDateFormat { diff --git a/java/org/apache/tomcat/util/http/CookieProcessor.java b/java/org/apache/tomcat/util/http/CookieProcessor.java index 19d70708d5..9f3ff17ded 100644 --- a/java/org/apache/tomcat/util/http/CookieProcessor.java +++ b/java/org/apache/tomcat/util/http/CookieProcessor.java @@ -27,8 +27,7 @@ public interface CookieProcessor { * Parse the provided headers into server cookie objects. * * @param headers The HTTP headers to parse - * @param serverCookies The server cookies object to populate with the - * results of the parsing + * @param serverCookies The server cookies object to populate with the results of the parsing */ void parseCookieHeader(MimeHeaders headers, ServerCookies serverCookies); @@ -37,46 +36,37 @@ public interface CookieProcessor { * * @param cookie The cookie for which the header will be generated * - * @return The header value in a form that can be added directly to the - * response + * @return The header value in a form that can be added directly to the response * - * @deprecated This method has been replaced with - * {@link #generateHeader(Cookie, HttpServletRequest)} and will - * be removed from Tomcat 10 onwards. + * @deprecated This method has been replaced with {@link #generateHeader(Cookie, HttpServletRequest)} and will be + * removed from Tomcat 10 onwards. */ @Deprecated String generateHeader(Cookie cookie); /** - * Generate the {@code Set-Cookie} HTTP header value for the given Cookie. - * This method receives as parameter the servlet request so that it can make - * decisions based on request properties. One such use-case is decide if the - * SameSite attribute should be added to the cookie based on the User-Agent - * or other request header because there are browser versions incompatible - * with the SameSite attribute. This is described by https://www.chromium.org/updates/same-site/incompatible-clients";>the - * Chromium project. + * Generate the {@code Set-Cookie} HTTP header value for the given Cookie. This method receives as parameter the + * servlet request so that it can make decisions based on request properties. One such use-case is decide if the + * SameSite attribute should be added to the cookie based on the User-Agent or other request header because there + * are browser versions incompatible with the SameSite attribute. This is described by + * https://www.chromium.org/updates/same-site/incompatible-clients";>the Chromium project. * - * The default implementation calls the deprecated - * {@link #generateHeader(Cookie)} method. Implementors should not rely on - * this default method as it is present only for transitional compatibility - * and will be removed in Tomcat 10 at the same time as the - * {@link #generateHe
[tomcat] branch 8.5.x updated (a92db2f0b4 -> 5badf94e79)
This is an automated email from the ASF dual-hosted git repository. markt pushed a change to branch 8.5.x in repository https://gitbox.apache.org/repos/asf/tomcat.git from a92db2f0b4 Improve messages for invalid JRE_HOME/JAVA_HOME new 3e7a97bb60 Prep for clean-up new f00b3b95a0 Code clean-up. No functional change. new 5badf94e79 Fix parameter counting logic The 3 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../tomcat/util/http/ConcurrentDateFormat.java | 5 +- .../apache/tomcat/util/http/CookieProcessor.java | 34 +-- .../tomcat/util/http/CookieProcessorBase.java | 13 +- .../tomcat/util/http/FastHttpDateFormat.java | 33 +- java/org/apache/tomcat/util/http/HeaderUtil.java | 10 +- java/org/apache/tomcat/util/http/HttpMessages.java | 79 +++-- .../tomcat/util/http/LegacyCookieProcessor.java| 331 + java/org/apache/tomcat/util/http/MimeHeaders.java | 184 ++-- java/org/apache/tomcat/util/http/Parameters.java | 117 java/org/apache/tomcat/util/http/RequestUtil.java | 22 +- .../tomcat/util/http/Rfc6265CookieProcessor.java | 49 ++- java/org/apache/tomcat/util/http/ServerCookie.java | 27 +- .../org/apache/tomcat/util/http/ServerCookies.java | 11 +- 13 files changed, 418 insertions(+), 497 deletions(-) - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] 01/03: Prep for clean-up
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 8.5.x in repository https://gitbox.apache.org/repos/asf/tomcat.git commit 3e7a97bb60f6a10a1df79588dd05e525591b6247 Author: Mark Thomas AuthorDate: Tue Apr 11 16:31:18 2023 +0100 Prep for clean-up --- java/org/apache/tomcat/util/http/MimeHeaders.java | 15 +-- .../apache/tomcat/util/http/Rfc6265CookieProcessor.java | 11 ++- java/org/apache/tomcat/util/http/ServerCookie.java| 2 +- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/java/org/apache/tomcat/util/http/MimeHeaders.java b/java/org/apache/tomcat/util/http/MimeHeaders.java index b2b56b7d2e..89007660a8 100644 --- a/java/org/apache/tomcat/util/http/MimeHeaders.java +++ b/java/org/apache/tomcat/util/http/MimeHeaders.java @@ -67,20 +67,23 @@ import org.apache.tomcat.util.res.StringManager; /** * Memory-efficient repository for Mime Headers. When the object is recycled, it * will keep the allocated headers[] and all the MimeHeaderField - no GC is generated. - * + * * For input headers it is possible to use the MessageByte for Fields - so no GC * will be generated. - * + * * The only garbage is generated when using the String for header names/values - * this can't be avoided when the servlet calls header methods, but is easy * to avoid inside tomcat. The goal is to use _only_ MessageByte-based Fields, * and reduce to 0 the memory overhead of tomcat. + * * * TODO: - * XXX one-buffer parsing - for http ( other protocols don't need that ) - * XXX remove unused methods - * XXX External enumerations, with 0 GC. - * XXX use HeaderName ID + * + * one-buffer parsing - for http (other protocols don't need that) + * remove unused methods + * External enumerations, with 0 GC. + * use HeaderName ID + * * * * @author d...@eng.sun.com diff --git a/java/org/apache/tomcat/util/http/Rfc6265CookieProcessor.java b/java/org/apache/tomcat/util/http/Rfc6265CookieProcessor.java index f2d9152ffe..264dd45cf0 100644 --- a/java/org/apache/tomcat/util/http/Rfc6265CookieProcessor.java +++ b/java/org/apache/tomcat/util/http/Rfc6265CookieProcessor.java @@ -111,11 +111,12 @@ public class Rfc6265CookieProcessor extends CookieProcessorBase { // Can't use StringBuilder due to DateFormat StringBuffer header = new StringBuffer(); -// TODO: Name validation takes place in Cookie and cannot be configured -// per Context. Moving it to here would allow per Context config -// but delay validation until the header is generated. However, -// the spec requires an IllegalArgumentException on Cookie -// generation. +/* TODO: Name validation takes place in Cookie and cannot be configured + * per Context. Moving it to here would allow per Context config + * but delay validation until the header is generated. However, + * the spec requires an IllegalArgumentException on Cookie + * generation. + */ header.append(cookie.getName()); header.append('='); String value = cookie.getValue(); diff --git a/java/org/apache/tomcat/util/http/ServerCookie.java b/java/org/apache/tomcat/util/http/ServerCookie.java index 5ae7f0da6b..23c088797f 100644 --- a/java/org/apache/tomcat/util/http/ServerCookie.java +++ b/java/org/apache/tomcat/util/http/ServerCookie.java @@ -26,7 +26,7 @@ import org.apache.tomcat.util.buf.MessageBytes; * Allows recycling and uses MessageBytes as low-level * representation ( and thus the byte -> char conversion can be delayed * until we know the charset ). - * + * * Tomcat.core uses this recyclable object to represent cookies, * and the facade will convert it to the external representation. */ - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] 03/03: Fix parameter counting logic
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 8.5.x in repository https://gitbox.apache.org/repos/asf/tomcat.git commit 5badf94e79e5de206fc0ef3054fd536b1bb787cd Author: Mark Thomas AuthorDate: Tue Apr 11 16:41:44 2023 +0100 Fix parameter counting logic --- java/org/apache/tomcat/util/http/Parameters.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/java/org/apache/tomcat/util/http/Parameters.java b/java/org/apache/tomcat/util/http/Parameters.java index de99e5b190..66fdc9302a 100644 --- a/java/org/apache/tomcat/util/http/Parameters.java +++ b/java/org/apache/tomcat/util/http/Parameters.java @@ -233,13 +233,13 @@ public final class Parameters { return; } -parameterCount++; -if (limit > -1 && parameterCount > limit) { +if (limit > -1 && parameterCount >= limit) { // Processing this parameter will push us over the limit. ISE is // what Request.parseParts() uses for requests that are too big setParseFailedReason(FailReason.TOO_MANY_PARAMETERS); throw new IllegalStateException(sm.getString("parameters.maxCountFail", Integer.valueOf(limit))); } +parameterCount++; ArrayList values = paramHashValues.get(key); if (values == null) { - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] 02/03: Code clean-up. No functional change.
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 8.5.x in repository https://gitbox.apache.org/repos/asf/tomcat.git commit f00b3b95a0fbb343a3dce17986f4866c6b485570 Author: Mark Thomas AuthorDate: Tue Apr 11 16:47:10 2023 +0100 Code clean-up. No functional change. --- .../tomcat/util/http/ConcurrentDateFormat.java | 5 +- .../apache/tomcat/util/http/CookieProcessor.java | 34 +-- .../tomcat/util/http/CookieProcessorBase.java | 13 +- .../tomcat/util/http/FastHttpDateFormat.java | 33 +- java/org/apache/tomcat/util/http/HeaderUtil.java | 10 +- java/org/apache/tomcat/util/http/HttpMessages.java | 79 +++-- .../tomcat/util/http/LegacyCookieProcessor.java| 331 + java/org/apache/tomcat/util/http/MimeHeaders.java | 185 ++-- java/org/apache/tomcat/util/http/Parameters.java | 115 --- java/org/apache/tomcat/util/http/RequestUtil.java | 22 +- .../tomcat/util/http/Rfc6265CookieProcessor.java | 48 ++- java/org/apache/tomcat/util/http/ServerCookie.java | 25 +- .../org/apache/tomcat/util/http/ServerCookies.java | 11 +- 13 files changed, 414 insertions(+), 497 deletions(-) diff --git a/java/org/apache/tomcat/util/http/ConcurrentDateFormat.java b/java/org/apache/tomcat/util/http/ConcurrentDateFormat.java index 02a456f20a..eb678aa5fb 100644 --- a/java/org/apache/tomcat/util/http/ConcurrentDateFormat.java +++ b/java/org/apache/tomcat/util/http/ConcurrentDateFormat.java @@ -25,9 +25,8 @@ import java.util.TimeZone; import java.util.concurrent.ConcurrentLinkedQueue; /** - * A thread safe wrapper around {@link SimpleDateFormat} that does not make use - * of ThreadLocal and - broadly - only creates enough SimpleDateFormat objects - * to satisfy the concurrency requirements. + * A thread safe wrapper around {@link SimpleDateFormat} that does not make use of ThreadLocal and - broadly - only + * creates enough SimpleDateFormat objects to satisfy the concurrency requirements. */ public class ConcurrentDateFormat { diff --git a/java/org/apache/tomcat/util/http/CookieProcessor.java b/java/org/apache/tomcat/util/http/CookieProcessor.java index ffda7b7916..e6003319b1 100644 --- a/java/org/apache/tomcat/util/http/CookieProcessor.java +++ b/java/org/apache/tomcat/util/http/CookieProcessor.java @@ -27,8 +27,7 @@ public interface CookieProcessor { * Parse the provided headers into server cookie objects. * * @param headers The HTTP headers to parse - * @param serverCookies The server cookies object to populate with the - * results of the parsing + * @param serverCookies The server cookies object to populate with the results of the parsing */ void parseCookieHeader(MimeHeaders headers, ServerCookies serverCookies); @@ -37,38 +36,31 @@ public interface CookieProcessor { * * @param cookie The cookie for which the header will be generated * - * @return The header value in a form that can be added directly to the - * response + * @return The header value in a form that can be added directly to the response * - * @deprecated This method has been replaced with - * {@link #generateHeader(Cookie, HttpServletRequest)} and will - * be removed from Tomcat 10 onwards. + * @deprecated This method has been replaced with {@link #generateHeader(Cookie, HttpServletRequest)} and will be + * removed from Tomcat 10 onwards. */ @Deprecated String generateHeader(Cookie cookie); /** - * Generate the {@code Set-Cookie} HTTP header value for the given Cookie. - * This method receives as parameter the servlet request so that it can make - * decisions based on request properties. One such use-case is decide if the - * SameSite attribute should be added to the cookie based on the User-Agent - * or other request header because there are browser versions incompatible - * with the SameSite attribute. This is described by https://www.chromium.org/updates/same-site/incompatible-clients";>the - * Chromium project. + * Generate the {@code Set-Cookie} HTTP header value for the given Cookie. This method receives as parameter the + * servlet request so that it can make decisions based on request properties. One such use-case is decide if the + * SameSite attribute should be added to the cookie based on the User-Agent or other request header because there + * are browser versions incompatible with the SameSite attribute. This is described by + * https://www.chromium.org/updates/same-site/incompatible-clients";>the Chromium project. * * @param request The servlet request + * @param cookie The cookie for which the header will be generated * - * @param cookie The cookie for which the header will be generated - * - * @return The header value in a for
Re: BZ 66508 and tagging progress update
On 06/04/2023 09:18, Mark Thomas wrote: OK, that isn't going to work. It is going to have to be the back-port of the switch to ReentrantLock. Those back-ports have been completed along with the final bits and pieces I had on my TODO list. I need to run the tests ob various platforms but assuming those tests pass, I should be tagging 11.0.x later today. Mark - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Buildbot failure in on tomcat-11.0.x
Build status: BUILD FAILED: failed compile (failure) Worker used: bb_worker2_ubuntu URL: https://ci2.apache.org/#builders/112/builds/302 Blamelist: Mark Thomas Build Text: failed compile (failure) Status Detected: new failure Build Source Stamp: [branch main] d53d8e7f77042cc32a3b98f589496a1ef5088e38 Steps: worker_preparation: 0 git: 0 shell: 0 shell_1: 0 shell_2: 0 shell_3: 0 shell_4: 0 shell_5: 0 compile: 1 shell_6: 0 shell_7: 0 shell_8: 0 shell_9: 0 Rsync docs to nightlies.apache.org: 0 shell_10: 0 Rsync RAT to nightlies.apache.org: 0 compile_1: 2 shell_11: 0 Rsync Logs to nightlies.apache.org: 0 -- ASF Buildbot - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch main updated: Intermittent failure locally. Increase wait time.
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/main by this push: new c3511b1baf Intermittent failure locally. Increase wait time. c3511b1baf is described below commit c3511b1baf7defc57923fce7e12b5e6b392c68c5 Author: Mark Thomas AuthorDate: Tue Apr 11 18:05:19 2023 +0100 Intermittent failure locally. Increase wait time. --- .../websocket/server/TestWsRemoteEndpointImplServerDeadlock.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/org/apache/tomcat/websocket/server/TestWsRemoteEndpointImplServerDeadlock.java b/test/org/apache/tomcat/websocket/server/TestWsRemoteEndpointImplServerDeadlock.java index 269f112849..a3a0d10773 100644 --- a/test/org/apache/tomcat/websocket/server/TestWsRemoteEndpointImplServerDeadlock.java +++ b/test/org/apache/tomcat/websocket/server/TestWsRemoteEndpointImplServerDeadlock.java @@ -134,7 +134,9 @@ public class TestWsRemoteEndpointImplServerDeadlock extends WebSocketBaseTest { Object state = f.get(Bug66508Endpoint.serverSession); int count = 0; long start = System.nanoTime(); -while (!"CLOSED".equals(state.toString()) && count < 100) { +// Send times out after 20s so test should complete in less than that. Allow large margin as VMs can sometimes +// be slow when running tests. +while (!"CLOSED".equals(state.toString()) && count < 190) { count++; Thread.sleep(100); state = f.get(Bug66508Endpoint.serverSession); - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch 10.1.x updated: Intermittent failure locally. Increase wait time.
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 10.1.x in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/10.1.x by this push: new 5336f33466 Intermittent failure locally. Increase wait time. 5336f33466 is described below commit 5336f33466ef7e96303742820545afa0c482466d Author: Mark Thomas AuthorDate: Tue Apr 11 18:05:19 2023 +0100 Intermittent failure locally. Increase wait time. --- .../websocket/server/TestWsRemoteEndpointImplServerDeadlock.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/org/apache/tomcat/websocket/server/TestWsRemoteEndpointImplServerDeadlock.java b/test/org/apache/tomcat/websocket/server/TestWsRemoteEndpointImplServerDeadlock.java index 269f112849..a3a0d10773 100644 --- a/test/org/apache/tomcat/websocket/server/TestWsRemoteEndpointImplServerDeadlock.java +++ b/test/org/apache/tomcat/websocket/server/TestWsRemoteEndpointImplServerDeadlock.java @@ -134,7 +134,9 @@ public class TestWsRemoteEndpointImplServerDeadlock extends WebSocketBaseTest { Object state = f.get(Bug66508Endpoint.serverSession); int count = 0; long start = System.nanoTime(); -while (!"CLOSED".equals(state.toString()) && count < 100) { +// Send times out after 20s so test should complete in less than that. Allow large margin as VMs can sometimes +// be slow when running tests. +while (!"CLOSED".equals(state.toString()) && count < 190) { count++; Thread.sleep(100); state = f.get(Bug66508Endpoint.serverSession); - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch 9.0.x updated: Intermittent failure locally. Increase wait time.
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/9.0.x by this push: new 79e654a869 Intermittent failure locally. Increase wait time. 79e654a869 is described below commit 79e654a869d2effba562b0076d37b1d6783ce4e6 Author: Mark Thomas AuthorDate: Tue Apr 11 18:05:19 2023 +0100 Intermittent failure locally. Increase wait time. --- .../websocket/server/TestWsRemoteEndpointImplServerDeadlock.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/org/apache/tomcat/websocket/server/TestWsRemoteEndpointImplServerDeadlock.java b/test/org/apache/tomcat/websocket/server/TestWsRemoteEndpointImplServerDeadlock.java index de49113382..986b35cdeb 100644 --- a/test/org/apache/tomcat/websocket/server/TestWsRemoteEndpointImplServerDeadlock.java +++ b/test/org/apache/tomcat/websocket/server/TestWsRemoteEndpointImplServerDeadlock.java @@ -134,7 +134,9 @@ public class TestWsRemoteEndpointImplServerDeadlock extends WebSocketBaseTest { Object state = f.get(Bug66508Endpoint.serverSession); int count = 0; long start = System.nanoTime(); -while (!"CLOSED".equals(state.toString()) && count < 100) { +// Send times out after 20s so test should complete in less than that. Allow large margin as VMs can sometimes +// be slow when running tests. +while (!"CLOSED".equals(state.toString()) && count < 190) { count++; Thread.sleep(100); state = f.get(Bug66508Endpoint.serverSession); - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch 8.5.x updated: Intermittent failure locally. Increase wait time.
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 8.5.x in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/8.5.x by this push: new df61a5ccd4 Intermittent failure locally. Increase wait time. df61a5ccd4 is described below commit df61a5ccd4e2677052565c18e59e6433755e217c Author: Mark Thomas AuthorDate: Tue Apr 11 18:05:19 2023 +0100 Intermittent failure locally. Increase wait time. --- .../websocket/server/TestWsRemoteEndpointImplServerDeadlock.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/org/apache/tomcat/websocket/server/TestWsRemoteEndpointImplServerDeadlock.java b/test/org/apache/tomcat/websocket/server/TestWsRemoteEndpointImplServerDeadlock.java index f7074a9009..9a812d2498 100644 --- a/test/org/apache/tomcat/websocket/server/TestWsRemoteEndpointImplServerDeadlock.java +++ b/test/org/apache/tomcat/websocket/server/TestWsRemoteEndpointImplServerDeadlock.java @@ -134,7 +134,9 @@ public class TestWsRemoteEndpointImplServerDeadlock extends WebSocketBaseTest { Object state = f.get(Bug66508Endpoint.serverSession); int count = 0; long start = System.nanoTime(); -while (!"CLOSED".equals(state.toString()) && count < 100) { +// Send times out after 20s so test should complete in less than that. Allow large margin as VMs can sometimes +// be slow when running tests. +while (!"CLOSED".equals(state.toString()) && count < 190) { count++; Thread.sleep(100); state = f.get(Bug66508Endpoint.serverSession); - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: [tomcat] branch main updated: Improve messages if JAVA_HOME / JRE_HOME not set correctly
Mark, On 4/11/23 06:42, ma...@apache.org wrote: This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/main by this push: new a788852f6b Improve messages if JAVA_HOME / JRE_HOME not set correctly a788852f6b is described below commit a788852f6b48e100bd505dcf7b5633a04f649e7b Author: Mark Thomas AuthorDate: Tue Apr 11 11:41:55 2023 +0100 Improve messages if JAVA_HOME / JRE_HOME not set correctly --- bin/setclasspath.sh| 24 +--- webapps/docs/changelog.xml | 6 ++ 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/bin/setclasspath.sh b/bin/setclasspath.sh index b81bc197d1..f56b2aa473 100755 --- a/bin/setclasspath.sh +++ b/bin/setclasspath.sh @@ -53,15 +53,13 @@ if [ -z "$JAVA_HOME" ] && [ "$1" = "debug" ]; then echo "JAVA_HOME should point to a JDK in order to run in debug mode." exit 1 fi -if [ -z "$JRE_HOME" ]; then - JRE_HOME="$JAVA_HOME" -fi # If we're running under jdb, we need a full jdk. if [ "$1" = "debug" ] ; then if [ "$os400" = "true" ]; then if [ ! -x "$JAVA_HOME"/bin/java ] || [ ! -x "$JAVA_HOME"/bin/javac ]; then echo "The JAVA_HOME environment variable is not defined correctly" + echo "JAVA_HOME=$JAVA_HOME" echo "This environment variable is needed to run this program" echo "NB: JAVA_HOME should point to a JDK not a JRE" I think this message is no longer accurate, right? ^^^ AIUI, Tomcat can use a JRE ever since we started bundling the Eclipse compiler for JSPs. -chris - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: BZ 66508 and tagging progress update
Mark, On 4/11/23 11:49, Mark Thomas wrote: On 06/04/2023 09:18, Mark Thomas wrote: OK, that isn't going to work. It is going to have to be the back-port of the switch to ReentrantLock. Those back-ports have been completed along with the final bits and pieces I had on my TODO list. I need to run the tests ob various platforms but assuming those tests pass, I should be tagging 11.0.x later today. ACK -chris - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: [tomcat] branch main updated: Improve messages if JAVA_HOME / JRE_HOME not set correctly
On 11/04/2023 18:12, Christopher Schultz wrote: Mark, On 4/11/23 06:42, ma...@apache.org wrote: This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/main by this push: new a788852f6b Improve messages if JAVA_HOME / JRE_HOME not set correctly a788852f6b is described below commit a788852f6b48e100bd505dcf7b5633a04f649e7b Author: Mark Thomas AuthorDate: Tue Apr 11 11:41:55 2023 +0100 Improve messages if JAVA_HOME / JRE_HOME not set correctly --- bin/setclasspath.sh | 24 +--- webapps/docs/changelog.xml | 6 ++ 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/bin/setclasspath.sh b/bin/setclasspath.sh index b81bc197d1..f56b2aa473 100755 --- a/bin/setclasspath.sh +++ b/bin/setclasspath.sh @@ -53,15 +53,13 @@ if [ -z "$JAVA_HOME" ] && [ "$1" = "debug" ]; then echo "JAVA_HOME should point to a JDK in order to run in debug mode." exit 1 fi -if [ -z "$JRE_HOME" ]; then - JRE_HOME="$JAVA_HOME" -fi See comment below. # If we're running under jdb, we need a full jdk. if [ "$1" = "debug" ] ; then if [ "$os400" = "true" ]; then if [ ! -x "$JAVA_HOME"/bin/java ] || [ ! -x "$JAVA_HOME"/bin/javac ]; then echo "The JAVA_HOME environment variable is not defined correctly" + echo "JAVA_HOME=$JAVA_HOME" echo "This environment variable is needed to run this program" echo "NB: JAVA_HOME should point to a JDK not a JRE" I think this message is no longer accurate, right? ^^^ AIUI, Tomcat can use a JRE ever since we started bundling the Eclipse compiler for JSPs. This applies when running with debug which requires a full jdk. Mark - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Buildbot success in on tomcat-11.0.x
Build status: Build succeeded! Worker used: bb_worker2_ubuntu URL: https://ci2.apache.org/#builders/112/builds/303 Blamelist: Mark Thomas Build Text: build successful Status Detected: restored build Build Source Stamp: [branch main] c3511b1baf7defc57923fce7e12b5e6b392c68c5 Steps: worker_preparation: 0 git: 0 shell: 0 shell_1: 0 shell_2: 0 shell_3: 0 shell_4: 0 shell_5: 0 compile: 1 shell_6: 0 shell_7: 0 shell_8: 0 shell_9: 0 Rsync docs to nightlies.apache.org: 0 shell_10: 0 Rsync RAT to nightlies.apache.org: 0 compile_1: 1 shell_11: 0 Rsync Logs to nightlies.apache.org: 0 -- ASF Buildbot - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch main updated: Make test more robust
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/main by this push: new 28493058c3 Make test more robust 28493058c3 is described below commit 28493058c38776519576ac17223493d3d6c76f88 Author: Mark Thomas AuthorDate: Tue Apr 11 20:17:58 2023 +0100 Make test more robust --- test/org/apache/coyote/http2/TestRfc9218.java | 15 --- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/test/org/apache/coyote/http2/TestRfc9218.java b/test/org/apache/coyote/http2/TestRfc9218.java index 85dd834eee..c42fd6ed7b 100644 --- a/test/org/apache/coyote/http2/TestRfc9218.java +++ b/test/org/apache/coyote/http2/TestRfc9218.java @@ -16,6 +16,8 @@ */ package org.apache.coyote.http2; +import java.io.IOException; + import org.junit.Assert; import org.junit.Test; @@ -144,9 +146,16 @@ public class TestRfc9218 extends Http2TestBase { * with the remainder split equally between 17 and 21. */ sendWindowUpdate(0, 1024 * 8); -parser.readFrame(); -parser.readFrame(); -parser.readFrame(); +// Use try/catch as third read has been failing on some tests runs +try { +parser.readFrame(); +parser.readFrame(); +parser.readFrame(); +} catch (IOException ioe) { +// Dump for debugging purposes +ioe.printStackTrace(); +// Continue - we'll get trace dumped to stdout below +} trace = output.getTrace(); System.out.println(trace); - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: [tomcat] branch main updated: Improve messages if JAVA_HOME / JRE_HOME not set correctly
Mark, On 4/11/23 13:18, Mark Thomas wrote: On 11/04/2023 18:12, Christopher Schultz wrote: Mark, On 4/11/23 06:42, ma...@apache.org wrote: This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/main by this push: new a788852f6b Improve messages if JAVA_HOME / JRE_HOME not set correctly a788852f6b is described below commit a788852f6b48e100bd505dcf7b5633a04f649e7b Author: Mark Thomas AuthorDate: Tue Apr 11 11:41:55 2023 +0100 Improve messages if JAVA_HOME / JRE_HOME not set correctly --- bin/setclasspath.sh | 24 +--- webapps/docs/changelog.xml | 6 ++ 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/bin/setclasspath.sh b/bin/setclasspath.sh index b81bc197d1..f56b2aa473 100755 --- a/bin/setclasspath.sh +++ b/bin/setclasspath.sh @@ -53,15 +53,13 @@ if [ -z "$JAVA_HOME" ] && [ "$1" = "debug" ]; then echo "JAVA_HOME should point to a JDK in order to run in debug mode." exit 1 fi -if [ -z "$JRE_HOME" ]; then - JRE_HOME="$JAVA_HOME" -fi See comment below. # If we're running under jdb, we need a full jdk. if [ "$1" = "debug" ] ; then if [ "$os400" = "true" ]; then if [ ! -x "$JAVA_HOME"/bin/java ] || [ ! -x "$JAVA_HOME"/bin/javac ]; then echo "The JAVA_HOME environment variable is not defined correctly" + echo "JAVA_HOME=$JAVA_HOME" echo "This environment variable is needed to run this program" echo "NB: JAVA_HOME should point to a JDK not a JRE" I think this message is no longer accurate, right? ^^^ AIUI, Tomcat can use a JRE ever since we started bundling the Eclipse compiler for JSPs. This applies when running with debug which requires a full jdk. Ah, right. I wasn't looking at the execution branch, only the warning message. -chris - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: BZ 66508 and tagging progress update
On 11/04/2023 18:14, Christopher Schultz wrote: Mark, On 4/11/23 11:49, Mark Thomas wrote: On 06/04/2023 09:18, Mark Thomas wrote: OK, that isn't going to work. It is going to have to be the back-port of the switch to ReentrantLock. Those back-ports have been completed along with the final bits and pieces I had on my TODO list. I need to run the tests ob various platforms but assuming those tests pass, I should be tagging 11.0.x later today. ACK Ah, assumptions. It appears that a couple of the tests I've added since the last release are less than happy when run in a Windows VM. On the positive side, at least one of the failures is consistent enough I can repeat it running from an IDE so hopefully I'll figure out what is going on soon. The tag may not be today... Mark - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[GitHub] [tomcat] VirtualTim commented on pull request #600: echo the value of %JAVA_HOME% when it is invalid.
VirtualTim commented on PR #600: URL: https://github.com/apache/tomcat/pull/600#issuecomment-1504514693 Oh cool. I was planning on getting around to it, but didn't get time. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[GitHub] [tomcat] VirtualTim opened a new pull request, #609: Unify Windows/Linux package filesets
VirtualTim opened a new pull request, #609: URL: https://github.com/apache/tomcat/pull/609 This looks like a bigger change than it is, simply because I sorted the list. **Changes**: * Sorted the Windows/Linux include/exclude lists, to make it easy to compare the two * **Windows** * Removed exclusion of `service.bat`. * Added exclusion of `bin/*.sh` * **Linux** * Removed the exclusion of `conf/**` * This now matches Windows, and I think this was intended. * Changed the exclusion `bin/service.bat` to `bin/*.bat` * Removed the exclusion of `src/**`, as it's not excluded in Windows, and I don't think it's needed. The "big" change is that now `service.bat` is included in the windows zip. I don't know why it was ever excluded, and when I asked about it in the mailing list I was told to create a PR. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org