[tomcat] branch master updated: Format. No functional change.

2021-05-19 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new c7f904b  Format. No functional change.
c7f904b is described below

commit c7f904bc1a65c1cf93cc2b590974ebb1e8bbba8e
Author: Mark Thomas 
AuthorDate: Wed May 19 09:29:23 2021 +0100

Format. No functional change.
---
 .../apache/catalina/servlets/DefaultServlet.java   | 25 ++
 1 file changed, 11 insertions(+), 14 deletions(-)

diff --git a/java/org/apache/catalina/servlets/DefaultServlet.java 
b/java/org/apache/catalina/servlets/DefaultServlet.java
index 3acf5e8..05ceabd 100644
--- a/java/org/apache/catalina/servlets/DefaultServlet.java
+++ b/java/org/apache/catalina/servlets/DefaultServlet.java
@@ -2619,6 +2619,7 @@ public class DefaultServlet extends HttpServlet {
 }
 }
 
+
 private static class PrecompressedResource {
 public final WebResource resource;
 public final CompressionFormat format;
@@ -2629,6 +2630,7 @@ public class DefaultServlet extends HttpServlet {
 }
 }
 
+
 /**
  * This is secure in the sense that any attempt to use an external entity
  * will trigger an exception.
@@ -2658,6 +2660,7 @@ public class DefaultServlet extends HttpServlet {
 }
 }
 
+
 /**
  * Gets the ordering character to be used for a particular column.
  *
@@ -2679,11 +2682,11 @@ public class DefaultServlet extends HttpServlet {
 }
 }
 
+
 /**
  * A class encapsulating the sorting of resources.
  */
-private static class SortManager
-{
+private static class SortManager {
 /**
  * The default sort.
  */
@@ -2871,9 +2874,8 @@ public class DefaultServlet extends HttpServlet {
 }
 }
 
-private static class DirsFirstComparator
-implements Comparator
-{
+
+private static class DirsFirstComparator implements 
Comparator {
 private final Comparator base;
 
 public DirsFirstComparator(Comparator core) {
@@ -2896,18 +2898,15 @@ public class DefaultServlet extends HttpServlet {
 }
 }
 
-private static class ResourceNameComparator
-implements Comparator
-{
+private static class ResourceNameComparator implements 
Comparator {
 @Override
 public int compare(WebResource r1, WebResource r2) {
 return r1.getName().compareTo(r2.getName());
 }
 }
 
-private static class ResourceSizeComparator
-implements Comparator
-{
+
+private static class ResourceSizeComparator implements 
Comparator {
 private Comparator base;
 
 public ResourceSizeComparator(Comparator base) {
@@ -2925,9 +2924,7 @@ public class DefaultServlet extends HttpServlet {
 }
 }
 
-private static class ResourceLastModifiedDateComparator
-implements Comparator
-{
+private static class ResourceLastModifiedDateComparator implements 
Comparator {
 private Comparator base;
 
 public ResourceLastModifiedDateComparator(Comparator 
base) {

-
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: Format. No functional change.

2021-05-19 Thread markt
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 6801339  Format. No functional change.
6801339 is described below

commit 6801339e728ec799a108b73790884a4dd228dda4
Author: Mark Thomas 
AuthorDate: Wed May 19 09:29:23 2021 +0100

Format. No functional change.
---
 .../apache/catalina/servlets/DefaultServlet.java   | 25 ++
 1 file changed, 11 insertions(+), 14 deletions(-)

diff --git a/java/org/apache/catalina/servlets/DefaultServlet.java 
b/java/org/apache/catalina/servlets/DefaultServlet.java
index e0b6711..3c135f8 100644
--- a/java/org/apache/catalina/servlets/DefaultServlet.java
+++ b/java/org/apache/catalina/servlets/DefaultServlet.java
@@ -2701,6 +2701,7 @@ public class DefaultServlet extends HttpServlet {
 }
 }
 
+
 private static class PrecompressedResource {
 public final WebResource resource;
 public final CompressionFormat format;
@@ -2711,6 +2712,7 @@ public class DefaultServlet extends HttpServlet {
 }
 }
 
+
 /**
  * This is secure in the sense that any attempt to use an external entity
  * will trigger an exception.
@@ -2740,6 +2742,7 @@ public class DefaultServlet extends HttpServlet {
 }
 }
 
+
 /**
  * Gets the ordering character to be used for a particular column.
  *
@@ -2761,11 +2764,11 @@ public class DefaultServlet extends HttpServlet {
 }
 }
 
+
 /**
  * A class encapsulating the sorting of resources.
  */
-private static class SortManager
-{
+private static class SortManager {
 /**
  * The default sort.
  */
@@ -2953,9 +2956,8 @@ public class DefaultServlet extends HttpServlet {
 }
 }
 
-private static class DirsFirstComparator
-implements Comparator
-{
+
+private static class DirsFirstComparator implements 
Comparator {
 private final Comparator base;
 
 public DirsFirstComparator(Comparator core) {
@@ -2978,18 +2980,15 @@ public class DefaultServlet extends HttpServlet {
 }
 }
 
-private static class ResourceNameComparator
-implements Comparator
-{
+private static class ResourceNameComparator implements 
Comparator {
 @Override
 public int compare(WebResource r1, WebResource r2) {
 return r1.getName().compareTo(r2.getName());
 }
 }
 
-private static class ResourceSizeComparator
-implements Comparator
-{
+
+private static class ResourceSizeComparator implements 
Comparator {
 private Comparator base;
 
 public ResourceSizeComparator(Comparator base) {
@@ -3007,9 +3006,7 @@ public class DefaultServlet extends HttpServlet {
 }
 }
 
-private static class ResourceLastModifiedDateComparator
-implements Comparator
-{
+private static class ResourceLastModifiedDateComparator implements 
Comparator {
 private Comparator base;
 
 public ResourceLastModifiedDateComparator(Comparator 
base) {

-
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: Format. No functional change.

2021-05-19 Thread markt
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 2ea2421  Format. No functional change.
2ea2421 is described below

commit 2ea24216520c9b7ddbcf0d3c52321d88e191cc47
Author: Mark Thomas 
AuthorDate: Wed May 19 09:29:23 2021 +0100

Format. No functional change.
---
 .../apache/catalina/servlets/DefaultServlet.java   | 25 ++
 1 file changed, 11 insertions(+), 14 deletions(-)

diff --git a/java/org/apache/catalina/servlets/DefaultServlet.java 
b/java/org/apache/catalina/servlets/DefaultServlet.java
index 862f2d1..8ab6bbe 100644
--- a/java/org/apache/catalina/servlets/DefaultServlet.java
+++ b/java/org/apache/catalina/servlets/DefaultServlet.java
@@ -2824,6 +2824,7 @@ public class DefaultServlet extends HttpServlet {
 }
 }
 
+
 private static class PrecompressedResource {
 public final WebResource resource;
 public final CompressionFormat format;
@@ -2834,6 +2835,7 @@ public class DefaultServlet extends HttpServlet {
 }
 }
 
+
 /**
  * This is secure in the sense that any attempt to use an external entity
  * will trigger an exception.
@@ -2863,6 +2865,7 @@ public class DefaultServlet extends HttpServlet {
 }
 }
 
+
 /**
  * Gets the ordering character to be used for a particular column.
  *
@@ -2884,11 +2887,11 @@ public class DefaultServlet extends HttpServlet {
 }
 }
 
+
 /**
  * A class encapsulating the sorting of resources.
  */
-private static class SortManager
-{
+private static class SortManager {
 /**
  * The default sort.
  */
@@ -3076,9 +3079,8 @@ public class DefaultServlet extends HttpServlet {
 }
 }
 
-private static class DirsFirstComparator
-implements Comparator
-{
+
+private static class DirsFirstComparator implements 
Comparator {
 private final Comparator base;
 
 public DirsFirstComparator(Comparator core) {
@@ -3101,18 +3103,15 @@ public class DefaultServlet extends HttpServlet {
 }
 }
 
-private static class ResourceNameComparator
-implements Comparator
-{
+private static class ResourceNameComparator implements 
Comparator {
 @Override
 public int compare(WebResource r1, WebResource r2) {
 return r1.getName().compareTo(r2.getName());
 }
 }
 
-private static class ResourceSizeComparator
-implements Comparator
-{
+
+private static class ResourceSizeComparator implements 
Comparator {
 private Comparator base;
 
 public ResourceSizeComparator(Comparator base) {
@@ -3130,9 +3129,7 @@ public class DefaultServlet extends HttpServlet {
 }
 }
 
-private static class ResourceLastModifiedDateComparator
-implements Comparator
-{
+private static class ResourceLastModifiedDateComparator implements 
Comparator {
 private Comparator base;
 
 public ResourceLastModifiedDateComparator(Comparator 
base) {

-
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 #418: DefaultServlet - Strip BOM improvements.

2021-05-19 Thread GitBox


markt-asf commented on pull request #418:
URL: https://github.com/apache/tomcat/pull/418#issuecomment-843968274


   I have this applied locally along with an update to the documentation and 
the change log. I also refactored it to use an Enum for the configuration 
option.
   I'll commit it shortly but I want to update the changelog processing first 
so we can link to PRs as well as BZ issues.


-- 
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.

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 master updated: Fix #418 - add "pass-through" as an option for useBomIfPresent

2021-05-19 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new ea00bb5  Fix #418 - add "pass-through" as an option for useBomIfPresent
ea00bb5 is described below

commit ea00bb55348faad97db3f5f70de0efad036fec17
Author: Mark Thomas 
AuthorDate: Wed May 19 12:17:17 2021 +0100

Fix #418 - add "pass-through" as an option for useBomIfPresent

Based on a PR by Jean-Louis Monteiro
Also adds support for the  element in the change log
---
 .../apache/catalina/servlets/DefaultServlet.java   | 84 +-
 .../catalina/servlets/LocalStrings.properties  |  1 +
 .../servlets/DefaultServletEncodingBaseTest.java   | 28 +---
 ... TestDefaultServletEncodingPassThroughBom.java} |  7 +-
 .../TestDefaultServletEncodingWithBom.java |  5 +-
 .../TestDefaultServletEncodingWithoutBom.java  |  5 +-
 webapps/docs/changelog.xml |  9 +++
 webapps/docs/default-servlet.xml   |  6 +-
 webapps/docs/tomcat-docs.xsl   |  7 ++
 9 files changed, 117 insertions(+), 35 deletions(-)

diff --git a/java/org/apache/catalina/servlets/DefaultServlet.java 
b/java/org/apache/catalina/servlets/DefaultServlet.java
index 05ceabd..cff8f88 100644
--- a/java/org/apache/catalina/servlets/DefaultServlet.java
+++ b/java/org/apache/catalina/servlets/DefaultServlet.java
@@ -246,8 +246,9 @@ public class DefaultServlet extends HttpServlet {
 
 /**
  * If a file has a BOM, should that be used in preference to fileEncoding?
+ * Will default to {@link BomConfig#TRUE} in {@link #init()}.
  */
-private boolean useBomIfPresent = true;
+private BomConfig useBomIfPresent = null;
 
 /**
  * Minimum size for sendfile usage in bytes.
@@ -335,8 +336,23 @@ public class DefaultServlet extends HttpServlet {
 }
 }
 
-if (getServletConfig().getInitParameter("useBomIfPresent") != null) {
-useBomIfPresent = 
Boolean.parseBoolean(getServletConfig().getInitParameter("useBomIfPresent"));
+String useBomIfPresent = 
getServletConfig().getInitParameter("useBomIfPresent");
+if (useBomIfPresent == null) {
+// Use default
+this.useBomIfPresent = BomConfig.TRUE;
+} else {
+for (BomConfig bomConfig : BomConfig.values()) {
+if 
(bomConfig.configurationValue.equalsIgnoreCase(useBomIfPresent)) {
+this.useBomIfPresent = bomConfig;
+break;
+}
+}
+if (this.useBomIfPresent == null) {
+// Unrecognised configuration value
+IllegalArgumentException iae = new IllegalArgumentException(
+sm.getString("defaultServlet.unknownBomConfig", 
useBomIfPresent));
+throw new ServletException(iae);
+}
 }
 
 globalXsltFile = getServletConfig().getInitParameter("globalXsltFile");
@@ -1083,8 +1099,8 @@ public class DefaultServlet extends HttpServlet {
 if (!renderResult.markSupported()) {
 renderResult = new 
BufferedInputStream(renderResult);
 }
-Charset bomCharset = processBom(renderResult);
-if (bomCharset != null && useBomIfPresent) {
+Charset bomCharset = processBom(renderResult, 
useBomIfPresent.stripBom);
+if (bomCharset != null && 
useBomIfPresent.useBomEncoding) {
 inputEncoding = bomCharset.name();
 }
 }
@@ -1105,8 +1121,8 @@ public class DefaultServlet extends HttpServlet {
 if (!source.markSupported()) {
 source = new BufferedInputStream(source);
 }
-Charset bomCharset = processBom(source);
-if (bomCharset != null && useBomIfPresent) {
+Charset bomCharset = processBom(source, 
useBomIfPresent.stripBom);
+if (bomCharset != null && 
useBomIfPresent.useBomEncoding) {
 inputEncoding = bomCharset.name();
 }
 // Following test also ensures included resources
@@ -1217,7 +1233,7 @@ public class DefaultServlet extends HttpServlet {
 /*
  * Code borrowed heavily from Jasper's EncodingDetector
  */
-private static Charset processBom(InputStream is) throws IOException {
+private static Charset processBom(InputStream is, boolean stripBom) throws 
IOException {
 // Java supported character sets do not use BOMs longer tha

[GitHub] [tomcat] markt-asf closed pull request #418: DefaultServlet - Strip BOM improvements.

2021-05-19 Thread GitBox


markt-asf closed pull request #418:
URL: https://github.com/apache/tomcat/pull/418


   


-- 
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.

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: Fix #418 - add "pass-through" as an option for useBomIfPresent

2021-05-19 Thread markt
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 61a27bd  Fix #418 - add "pass-through" as an option for useBomIfPresent
61a27bd is described below

commit 61a27bd60a8c2e26a6338d21d82e47a8a206241c
Author: Mark Thomas 
AuthorDate: Wed May 19 12:17:17 2021 +0100

Fix #418 - add "pass-through" as an option for useBomIfPresent

Based on a PR by Jean-Louis Monteiro
Also adds support for the  element in the change log
---
 .../apache/catalina/servlets/DefaultServlet.java   | 84 +-
 .../catalina/servlets/LocalStrings.properties  |  1 +
 .../servlets/DefaultServletEncodingBaseTest.java   | 28 +---
 ... TestDefaultServletEncodingPassThroughBom.java} |  7 +-
 .../TestDefaultServletEncodingWithBom.java |  5 +-
 .../TestDefaultServletEncodingWithoutBom.java  |  5 +-
 webapps/docs/changelog.xml |  9 +++
 webapps/docs/default-servlet.xml   |  6 +-
 webapps/docs/tomcat-docs.xsl   |  7 ++
 9 files changed, 117 insertions(+), 35 deletions(-)

diff --git a/java/org/apache/catalina/servlets/DefaultServlet.java 
b/java/org/apache/catalina/servlets/DefaultServlet.java
index 3c135f8..9618d63 100644
--- a/java/org/apache/catalina/servlets/DefaultServlet.java
+++ b/java/org/apache/catalina/servlets/DefaultServlet.java
@@ -246,8 +246,9 @@ public class DefaultServlet extends HttpServlet {
 
 /**
  * If a file has a BOM, should that be used in preference to fileEncoding?
+ * Will default to {@link BomConfig#TRUE} in {@link #init()}.
  */
-private boolean useBomIfPresent = true;
+private BomConfig useBomIfPresent = null;
 
 /**
  * Minimum size for sendfile usage in bytes.
@@ -335,8 +336,23 @@ public class DefaultServlet extends HttpServlet {
 }
 }
 
-if (getServletConfig().getInitParameter("useBomIfPresent") != null) {
-useBomIfPresent = 
Boolean.parseBoolean(getServletConfig().getInitParameter("useBomIfPresent"));
+String useBomIfPresent = 
getServletConfig().getInitParameter("useBomIfPresent");
+if (useBomIfPresent == null) {
+// Use default
+this.useBomIfPresent = BomConfig.TRUE;
+} else {
+for (BomConfig bomConfig : BomConfig.values()) {
+if 
(bomConfig.configurationValue.equalsIgnoreCase(useBomIfPresent)) {
+this.useBomIfPresent = bomConfig;
+break;
+}
+}
+if (this.useBomIfPresent == null) {
+// Unrecognised configuration value
+IllegalArgumentException iae = new IllegalArgumentException(
+sm.getString("defaultServlet.unknownBomConfig", 
useBomIfPresent));
+throw new ServletException(iae);
+}
 }
 
 globalXsltFile = getServletConfig().getInitParameter("globalXsltFile");
@@ -1083,8 +1099,8 @@ public class DefaultServlet extends HttpServlet {
 if (!renderResult.markSupported()) {
 renderResult = new 
BufferedInputStream(renderResult);
 }
-Charset bomCharset = processBom(renderResult);
-if (bomCharset != null && useBomIfPresent) {
+Charset bomCharset = processBom(renderResult, 
useBomIfPresent.stripBom);
+if (bomCharset != null && 
useBomIfPresent.useBomEncoding) {
 inputEncoding = bomCharset.name();
 }
 }
@@ -1105,8 +1121,8 @@ public class DefaultServlet extends HttpServlet {
 if (!source.markSupported()) {
 source = new BufferedInputStream(source);
 }
-Charset bomCharset = processBom(source);
-if (bomCharset != null && useBomIfPresent) {
+Charset bomCharset = processBom(source, 
useBomIfPresent.stripBom);
+if (bomCharset != null && 
useBomIfPresent.useBomEncoding) {
 inputEncoding = bomCharset.name();
 }
 // Following test also ensures included resources
@@ -1217,7 +1233,7 @@ public class DefaultServlet extends HttpServlet {
 /*
  * Code borrowed heavily from Jasper's EncodingDetector
  */
-private static Charset processBom(InputStream is) throws IOException {
+private static Charset processBom(InputStream is, boolean stripBom) throws 
IOException {
 // Java supported character sets do not use BOMs longer than 

[tomcat] branch 8.5.x updated: Fix #418 - add "pass-through" as an option for useBomIfPresent

2021-05-19 Thread markt
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 aae6bb9  Fix #418 - add "pass-through" as an option for useBomIfPresent
aae6bb9 is described below

commit aae6bb9c0e00d67b03bd553d0d7518fbf743a4ca
Author: Mark Thomas 
AuthorDate: Wed May 19 12:17:17 2021 +0100

Fix #418 - add "pass-through" as an option for useBomIfPresent

Based on a PR by Jean-Louis Monteiro
Also adds support for the  element in the change log
---
 .../apache/catalina/servlets/DefaultServlet.java   | 84 +-
 .../catalina/servlets/LocalStrings.properties  |  1 +
 .../servlets/DefaultServletEncodingBaseTest.java   | 28 +---
 ... TestDefaultServletEncodingPassThroughBom.java} |  7 +-
 .../TestDefaultServletEncodingWithBom.java |  5 +-
 .../TestDefaultServletEncodingWithoutBom.java  |  5 +-
 webapps/docs/changelog.xml |  9 +++
 webapps/docs/default-servlet.xml   |  8 +++
 webapps/docs/tomcat-docs.xsl   |  7 ++
 9 files changed, 120 insertions(+), 34 deletions(-)

diff --git a/java/org/apache/catalina/servlets/DefaultServlet.java 
b/java/org/apache/catalina/servlets/DefaultServlet.java
index 8ab6bbe..944e8f4 100644
--- a/java/org/apache/catalina/servlets/DefaultServlet.java
+++ b/java/org/apache/catalina/servlets/DefaultServlet.java
@@ -253,8 +253,9 @@ public class DefaultServlet extends HttpServlet {
 
 /**
  * If a file has a BOM, should that be used in preference to fileEncoding?
+ * Will default to {@link BomConfig#TRUE} in {@link #init()}.
  */
-private boolean useBomIfPresent = true;
+private BomConfig useBomIfPresent = null;
 
 /**
  * Minimum size for sendfile usage in bytes.
@@ -342,8 +343,23 @@ public class DefaultServlet extends HttpServlet {
 }
 }
 
-if (getServletConfig().getInitParameter("useBomIfPresent") != null) {
-useBomIfPresent = 
Boolean.parseBoolean(getServletConfig().getInitParameter("useBomIfPresent"));
+String useBomIfPresent = 
getServletConfig().getInitParameter("useBomIfPresent");
+if (useBomIfPresent == null) {
+// Use default
+this.useBomIfPresent = BomConfig.TRUE;
+} else {
+for (BomConfig bomConfig : BomConfig.values()) {
+if 
(bomConfig.configurationValue.equalsIgnoreCase(useBomIfPresent)) {
+this.useBomIfPresent = bomConfig;
+break;
+}
+}
+if (this.useBomIfPresent == null) {
+// Unrecognised configuration value
+IllegalArgumentException iae = new IllegalArgumentException(
+sm.getString("defaultServlet.unknownBomConfig", 
useBomIfPresent));
+throw new ServletException(iae);
+}
 }
 
 globalXsltFile = getServletConfig().getInitParameter("globalXsltFile");
@@ -1090,8 +1106,8 @@ public class DefaultServlet extends HttpServlet {
 if (!renderResult.markSupported()) {
 renderResult = new 
BufferedInputStream(renderResult);
 }
-Charset bomCharset = processBom(renderResult);
-if (bomCharset != null && useBomIfPresent) {
+Charset bomCharset = processBom(renderResult, 
useBomIfPresent.stripBom);
+if (bomCharset != null && 
useBomIfPresent.useBomEncoding) {
 inputEncoding = bomCharset.name();
 }
 }
@@ -1112,8 +1128,8 @@ public class DefaultServlet extends HttpServlet {
 if (!source.markSupported()) {
 source = new BufferedInputStream(source);
 }
-Charset bomCharset = processBom(source);
-if (bomCharset != null && useBomIfPresent) {
+Charset bomCharset = processBom(source, 
useBomIfPresent.stripBom);
+if (bomCharset != null && 
useBomIfPresent.useBomEncoding) {
 inputEncoding = bomCharset.name();
 }
 // Following test also ensures included resources
@@ -1224,7 +1240,7 @@ public class DefaultServlet extends HttpServlet {
 /*
  * Code borrowed heavily from Jasper's EncodingDetector
  */
-private static Charset processBom(InputStream is) throws IOException {
+private static Charset processBom(InputStream is, boolean stripBom) throws 
IOException {
 // Java supported character sets do not use BOMs longer than

[tomcat] branch master updated: Fix #412. Add commented out users for the Manager app

2021-05-19 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new 94c352d  Fix #412. Add commented out users for the Manager app
94c352d is described below

commit 94c352d518f3bb03028c450933dfcd95b69c23ff
Author: Mark Thomas 
AuthorDate: Wed May 19 13:03:16 2021 +0100

Fix #412. Add commented out users for the Manager app

Based on a PR by Arnaud Dagnelies.
---
 conf/tomcat-users.xml  | 24 ++--
 res/confinstall/tomcat-users_2.xml | 24 ++--
 webapps/docs/changelog.xml |  5 +
 3 files changed, 41 insertions(+), 12 deletions(-)

diff --git a/conf/tomcat-users.xml b/conf/tomcat-users.xml
index aef66d0..86b2a4a 100644
--- a/conf/tomcat-users.xml
+++ b/conf/tomcat-users.xml
@@ -20,15 +20,27 @@
   xsi:schemaLocation="http://tomcat.apache.org/xml 
tomcat-users.xsd"
   version="1.0">
 
+
 
 
+

[tomcat] branch 9.0.x updated: Fix #412. Add commented out users for the Manager app

2021-05-19 Thread markt
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 3a06704  Fix #412. Add commented out users for the Manager app
3a06704 is described below

commit 3a067041e53f5087a79b70dc62c293100b6d2afd
Author: Mark Thomas 
AuthorDate: Wed May 19 13:03:16 2021 +0100

Fix #412. Add commented out users for the Manager app

Based on a PR by Arnaud Dagnelies.
---
 conf/tomcat-users.xml  | 24 ++--
 res/confinstall/tomcat-users_2.xml | 24 ++--
 webapps/docs/changelog.xml |  5 +
 3 files changed, 41 insertions(+), 12 deletions(-)

diff --git a/conf/tomcat-users.xml b/conf/tomcat-users.xml
index aef66d0..86b2a4a 100644
--- a/conf/tomcat-users.xml
+++ b/conf/tomcat-users.xml
@@ -20,15 +20,27 @@
   xsi:schemaLocation="http://tomcat.apache.org/xml 
tomcat-users.xsd"
   version="1.0">
 
+
 
 
+

[GitHub] [tomcat] markt-asf closed pull request #412: Adding default manager roles in tomcat users config.

2021-05-19 Thread GitBox


markt-asf closed pull request #412:
URL: https://github.com/apache/tomcat/pull/412


   


-- 
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.

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 8.5.x updated: Fix #412. Add commented out users for the Manager app

2021-05-19 Thread markt
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 7e5c30d  Fix #412. Add commented out users for the Manager app
7e5c30d is described below

commit 7e5c30d22e6fce8754d1462a70e4cc8b85e756d5
Author: Mark Thomas 
AuthorDate: Wed May 19 13:03:16 2021 +0100

Fix #412. Add commented out users for the Manager app

Based on a PR by Arnaud Dagnelies.
---
 conf/tomcat-users.xml  | 24 ++--
 res/confinstall/tomcat-users_2.xml | 24 ++--
 webapps/docs/changelog.xml |  5 +
 3 files changed, 41 insertions(+), 12 deletions(-)

diff --git a/conf/tomcat-users.xml b/conf/tomcat-users.xml
index aef66d0..86b2a4a 100644
--- a/conf/tomcat-users.xml
+++ b/conf/tomcat-users.xml
@@ -20,15 +20,27 @@
   xsi:schemaLocation="http://tomcat.apache.org/xml 
tomcat-users.xsd"
   version="1.0">
 
+
 
 
+

[tomcat] branch master updated: Attempt to get GitHub to store the test logs to help debug failures

2021-05-19 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new e9d0584  Attempt to get GitHub to store the test logs to help debug 
failures
e9d0584 is described below

commit e9d05842b87b7e88630db42aab2816d2be0e996a
Author: Mark Thomas 
AuthorDate: Wed May 19 13:21:32 2021 +0100

Attempt to get GitHub to store the test logs to help debug failures
---
 .github/workflows/ci.yml | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index e9c246e..1d380ea 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -47,3 +47,9 @@ jobs:
 ant -noinput echoproperties deploy embed test-nio test-status
   env:
 ANT_OPTS: -Dtest.openssl.exists=false -Dtest.excludePerformance=true 
-Dtest.exclude=**/TestHttp2Limits.java,org/apache/catalina/connector/TestRequest.java,org/apache/coyote/http11/filters/TestChunkedInputFilter.java,org/apache/catalina/startup/TestTomcat.java,org/apache/coyote/http2/TestHttp2Timeouts.java,org/apache/catalina/core/TestAsyncContextStateChanges.java,org/apache/catalina/valves/TestStuckThreadDetectionValve.java,org/apache/coyote/http11/TestHttp11Processor.java,org/ap
 [...]
+- name: Upload logs
+  uses: actions/upload-artifact@v2
+  with:
+name: logs
+path: output/build/logs/TEST*.txt
+retention-days: 7

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



buildbot failure in on tomcat-85-trunk

2021-05-19 Thread buildbot
The Buildbot has detected a new failure on builder tomcat-85-trunk while 
building tomcat. Full details are available at:
https://ci.apache.org/builders/tomcat-85-trunk/builds/2725

Buildbot URL: https://ci.apache.org/

Buildslave for this Build: asf946_ubuntu

Build Reason: The AnyBranchScheduler scheduler named 'on-tomcat-85-commit' 
triggered this build
Build Source Stamp: [branch 8.5.x] 7e5c30d22e6fce8754d1462a70e4cc8b85e756d5
Blamelist: Mark Thomas 

BUILD FAILED: failed compile

Sincerely,
 -The Buildbot




-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Re: Time to create Tomcat 10.1.x and master->main migration

2021-05-19 Thread Martin Grigorov
On Tue, May 18, 2021 at 3:16 PM Romain Manni-Bucau 
wrote:

> +1 to move forward even if jakarta is not yet adopted (there is a single
> time direction - at least at our scale ;))
> -0 to break all clones and related toolings/automotion for hypothetical
> reasons, didn't pay in all projects which did AFAIK
>

Same vote from me!


>
> Romain Manni-Bucau
> @rmannibucau  |  Blog
>  | Old Blog
>  | Github <
> https://github.com/rmannibucau> |
> LinkedIn  | Book
> <
> https://www.packtpub.com/application-development/java-ee-8-high-performance
> >
>
>
> Le mar. 18 mai 2021 à 14:13, Emmanuel Bourg  a écrit :
>
> > Le 2021-05-18 14:10, Emmanuel Bourg a écrit :
> >
> > >> Comments?
> > >
> > > I don't think the 7.0.x branch should be removed, there is no harm
> > > keeping it.
> > >
> > > As for the master->main change I think that's a waste of time for all
> > > of us. i don't buy the argument that "master" is offensive, but by
> > > moving awa
> >
> > Grr message sent too quickly, sorry.
> >
> > I don't want to reopen the debate, please ignore my comment.
> >
> > Emmanuel Bourg
> >
> > -
> > To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
> > For additional commands, e-mail: dev-h...@tomcat.apache.org
> >
> >
>


[tomcat-jakartaee-migration] branch master updated: Use commons-compression for the default code path

2021-05-19 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat-jakartaee-migration.git


The following commit(s) were added to refs/heads/master by this push:
 new 105e5b9  Use commons-compression for the default code path
105e5b9 is described below

commit 105e5b97c6aa274b95332697338a7c535415ad77
Author: remm 
AuthorDate: Wed May 19 15:50:05 2021 +0200

Use commons-compression for the default code path

The JVM code has too much exception throwing and hardcoded behavior
given what the migration tool does, as seen in issue #20. The
commons-compression code does not seem to have the same check in that
case, as seen when using -zipInMemory (it does not do anything special
yet does not complain about duplicate entries since there's no check for
that in the code).
In some cases, this seems faster. In others not so much. This needs more
investigation to verify there's no regression in that area (or anywhere
else).
---
 CHANGES.md |  2 ++
 .../org/apache/tomcat/jakartaee/Migration.java | 34 +-
 .../tomcat/jakartaee/LocalStrings.properties   |  1 -
 3 files changed, 16 insertions(+), 21 deletions(-)

diff --git a/CHANGES.md b/CHANGES.md
index 98be94f..c7c1c95 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -2,6 +2,8 @@
 
 ## 1.0.1 (in progress)
 
+- Fix [#20] by using commons-compression instead of the Java zip code (remm)
+
 ## 1.0.0
 
 - Fix [#14](https://github.com/apache/tomcat-jakartaee-migration/issues/14). 
Do not migrate `javax.xml.(registry|rpc)` namespaces. (mgrigorov)
diff --git a/src/main/java/org/apache/tomcat/jakartaee/Migration.java 
b/src/main/java/org/apache/tomcat/jakartaee/Migration.java
index 59d4600..097c04e 100644
--- a/src/main/java/org/apache/tomcat/jakartaee/Migration.java
+++ b/src/main/java/org/apache/tomcat/jakartaee/Migration.java
@@ -30,21 +30,16 @@ import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 import java.util.concurrent.TimeUnit;
-import java.util.jar.JarEntry;
 import java.util.logging.Level;
 import java.util.logging.Logger;
-import java.util.zip.ZipEntry;
 import java.util.zip.ZipException;
-import java.util.zip.ZipInputStream;
-import java.util.zip.ZipOutputStream;
 
 import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
+import org.apache.commons.compress.archivers.zip.ZipArchiveInputStream;
 import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream;
 import org.apache.commons.compress.archivers.zip.ZipFile;
 import org.apache.commons.compress.utils.SeekableInMemoryByteChannel;
 import org.apache.commons.io.IOUtils;
-import org.apache.commons.io.input.CloseShieldInputStream;
-import org.apache.commons.io.output.CloseShieldOutputStream;
 
 public class Migration {
 
@@ -214,23 +209,22 @@ public class Migration {
 
 
 private void migrateArchiveStreaming(String name, InputStream src, 
OutputStream dest) throws IOException {
-try (ZipInputStream zipIs = new ZipInputStream(new 
CloseShieldInputStream(src));
-ZipOutputStream zipOs = new ZipOutputStream(new 
CloseShieldOutputStream(dest))) {
-ZipEntry zipEntry;
-while ((zipEntry = zipIs.getNextEntry()) != null) {
-String sourceName = zipEntry.getName();
-if (isSignatureFile(sourceName)) {
-logger.log(Level.WARNING, 
sm.getString("migration.skipSignatureFile", sourceName));
+try (ZipArchiveInputStream srcZipStream = new 
ZipArchiveInputStream(src);
+ZipArchiveOutputStream destZipStream = new 
ZipArchiveOutputStream(dest)) {
+ZipArchiveEntry srcZipEntry;
+while ((srcZipEntry = srcZipStream.getNextZipEntry()) != null) {
+String srcName = srcZipEntry.getName();
+if (isSignatureFile(srcName)) {
+logger.log(Level.WARNING, 
sm.getString("migration.skipSignatureFile", srcName));
 continue;
 }
-String destName = profile.convert(sourceName);
-JarEntry destEntry = new JarEntry(destName);
-zipOs.putNextEntry(destEntry);
-migrateStream(sourceName, zipIs, zipOs);
+String destName = profile.convert(srcName);
+RenamableZipArchiveEntry destZipEntry = new 
RenamableZipArchiveEntry(srcZipEntry);
+destZipEntry.setName(destName);
+destZipStream.putArchiveEntry(destZipEntry);
+migrateStream(srcName, srcZipStream, destZipStream);
+destZipStream.closeArchiveEntry();
 }
-} catch (ZipException ze) {
-logger.log(Level.SEVERE, sm.getString("migration.archiveFailed", 
name), ze);
-throw ze;
 }
 }
 
diff --git 
a/src/main/resources/org/apache/tomcat/jak

[tomcat-jakartaee-migration] branch master updated: Add issue link

2021-05-19 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat-jakartaee-migration.git


The following commit(s) were added to refs/heads/master by this push:
 new 0bf8836  Add issue link
0bf8836 is described below

commit 0bf8836cde6a47c12a6270edd4b3300bd0126f5e
Author: remm 
AuthorDate: Wed May 19 15:52:57 2021 +0200

Add issue link
---
 CHANGES.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/CHANGES.md b/CHANGES.md
index c7c1c95..ad44c6c 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -2,7 +2,7 @@
 
 ## 1.0.1 (in progress)
 
-- Fix [#20] by using commons-compression instead of the Java zip code (remm)
+- Fix [#20](https://github.com/apache/tomcat-jakartaee-migration/issues/20) by 
using commons-compression instead of the Java zip code (remm)
 
 ## 1.0.0
 

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat-jakartaee-migration] branch master updated: Remove deprecated -verbose option

2021-05-19 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat-jakartaee-migration.git


The following commit(s) were added to refs/heads/master by this push:
 new 528f05e  Remove deprecated -verbose option
528f05e is described below

commit 528f05e09ba5745c56bcd66e02d88ce7ad8bb596
Author: remm 
AuthorDate: Wed May 19 15:58:32 2021 +0200

Remove deprecated -verbose option
---
 CHANGES.md   |  1 +
 src/main/java/org/apache/tomcat/jakartaee/MigrationCLI.java  | 10 --
 src/test/java/org/apache/tomcat/jakartaee/MigrationTest.java |  2 +-
 3 files changed, 2 insertions(+), 11 deletions(-)

diff --git a/CHANGES.md b/CHANGES.md
index ad44c6c..6e3beef 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -3,6 +3,7 @@
 ## 1.0.1 (in progress)
 
 - Fix [#20](https://github.com/apache/tomcat-jakartaee-migration/issues/20) by 
using commons-compression instead of the Java zip code (remm)
+- Remove deprecated `-verbose` command line option (remm)
 
 ## 1.0.0
 
diff --git a/src/main/java/org/apache/tomcat/jakartaee/MigrationCLI.java 
b/src/main/java/org/apache/tomcat/jakartaee/MigrationCLI.java
index 36e9dc5..1b7c92f 100644
--- a/src/main/java/org/apache/tomcat/jakartaee/MigrationCLI.java
+++ b/src/main/java/org/apache/tomcat/jakartaee/MigrationCLI.java
@@ -33,9 +33,6 @@ public class MigrationCLI {
 private static final String EXCLUDE_ARG = "-exclude=";
 private static final String LOGLEVEL_ARG = "-logLevel=";
 private static final String PROFILE_ARG = "-profile=";
-// Will be removed for 1.0.0
-@Deprecated
-private static final String VERBOSE_ARG = "-verbose";
 private static final String ZIPINMEMORY_ARG = "-zipInMemory";
 
 public static void main(String[] args) throws IOException {
@@ -81,13 +78,6 @@ public class MigrationCLI {
 } else if (argument.equals(ZIPINMEMORY_ARG)) {
 iter.remove();
 migration.setZipInMemory(true);
-} else if (argument.equals(VERBOSE_ARG)) {
-iter.remove();
-// Ignore if LOGLEVEL_ARG has set something different
-if 
(Logger.getGlobal().getParent().getLevel().equals(Level.INFO)) {
-
Logger.getGlobal().getParent().getHandlers()[0].setLevel(Level.FINE);
-Logger.getGlobal().getParent().setLevel(Level.FINE);
-}
 }
 }
 
diff --git a/src/test/java/org/apache/tomcat/jakartaee/MigrationTest.java 
b/src/test/java/org/apache/tomcat/jakartaee/MigrationTest.java
index e4384be..0d61442 100644
--- a/src/test/java/org/apache/tomcat/jakartaee/MigrationTest.java
+++ b/src/test/java/org/apache/tomcat/jakartaee/MigrationTest.java
@@ -57,7 +57,7 @@ public class MigrationTest {
 @Test
 public void testMigrateSingleSourceFileWithProfile() throws Exception {
 File migratedFile = new 
File("target/test-classes/HelloServlet.migrated.java");
-MigrationCLI.main(new String[] {"-verbose", "-profile=EE", 
"target/test-classes/HelloServlet.java", migratedFile.getAbsolutePath()});
+MigrationCLI.main(new String[] {"-logLevel=FINE", "-profile=EE", 
"target/test-classes/HelloServlet.java", migratedFile.getAbsolutePath()});
 
 assertTrue("Migrated file not found", migratedFile.exists());
 

-
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: Fix Javadoc error

2021-05-19 Thread markt
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 05633b3  Fix Javadoc error
05633b3 is described below

commit 05633b3b188db077a54b12c6ba92c8de973febda
Author: Mark Thomas 
AuthorDate: Wed May 19 15:10:38 2021 +0100

Fix Javadoc error
---
 java/org/apache/catalina/servlets/DefaultServlet.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/java/org/apache/catalina/servlets/DefaultServlet.java 
b/java/org/apache/catalina/servlets/DefaultServlet.java
index 944e8f4..062b979 100644
--- a/java/org/apache/catalina/servlets/DefaultServlet.java
+++ b/java/org/apache/catalina/servlets/DefaultServlet.java
@@ -253,7 +253,7 @@ public class DefaultServlet extends HttpServlet {
 
 /**
  * If a file has a BOM, should that be used in preference to fileEncoding?
- * Will default to {@link BomConfig#TRUE} in {@link #init()}.
+ * Will default to {@code BomConfig.TRUE} in {@link #init()}.
  */
 private BomConfig useBomIfPresent = null;
 

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



buildbot success in on tomcat-85-trunk

2021-05-19 Thread buildbot
The Buildbot has detected a restored build on builder tomcat-85-trunk while 
building tomcat. Full details are available at:
https://ci.apache.org/builders/tomcat-85-trunk/builds/2726

Buildbot URL: https://ci.apache.org/

Buildslave for this Build: asf946_ubuntu

Build Reason: The AnyBranchScheduler scheduler named 'on-tomcat-85-commit' 
triggered this build
Build Source Stamp: [branch 8.5.x] 05633b3b188db077a54b12c6ba92c8de973febda
Blamelist: Mark Thomas 

Build succeeded!

Sincerely,
 -The Buildbot




-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[Bug 65317] New: PerMessageDeflate getMoreData doesn't return correct TransformationResult if the payload is inflated to exact 8192 bytes

2021-05-19 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=65317

Bug ID: 65317
   Summary: PerMessageDeflate getMoreData doesn't return correct
TransformationResult if the payload is inflated to
exact 8192 bytes
   Product: Tomcat 9
   Version: 9.0.31
  Hardware: PC
Status: NEW
  Severity: normal
  Priority: P2
 Component: WebSocket
  Assignee: dev@tomcat.apache.org
  Reporter: saksham.ve...@gmail.com
  Target Milestone: -

Created attachment 37868
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=37868&action=edit
A probable fix for the issue. Needs confirmation though.

If the compression is enabled and inflated size is exactly 8192, then tomcat
closes the websocket connection with Close code 1009 below message:

No async message support and buffer too small. Buffer size: [8,192], Message
size: [1,202]] 


Root cause:

PerMessageDeflate.getMoreData() finds that there's no space in the buffer but
doesn't check if at that time, the complete message is written or not. 

And thus, instead of returning the END_OF_FRAME it returns OVERFLOW.
It causes to close the connection with a message that doesn't make much sense
(buffer size 8192 is small for message size 1202).

With the attached file containing the changes, I was able to get around the
problem and my connection was stable, but not sure if this is the most elegant
way to do it as there's already some complicated logic to find the
TransformationResut.

-- 
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



[Bug 65317] PerMessageDeflate getMoreData doesn't return correct TransformationResult if the payload is inflated to exact 8192 bytes

2021-05-19 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=65317

Saksham Verma  changed:

   What|Removed |Added

 OS||All
 CC||saksham.ve...@gmail.com

-- 
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



[GitHub] [tomcat] markt-asf merged pull request #406: Improve the SSLValve so it is able to handle the ssl_client_escaped_cert header from Nginx

2021-05-19 Thread GitBox


markt-asf merged pull request #406:
URL: https://github.com/apache/tomcat/pull/406


   


-- 
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.

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 the SSLValve so it is able to handle the ssl_client_escaped_cert header from Nginx

2021-05-19 Thread markt
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 be0408d  Improve the SSLValve so it is able to handle the 
ssl_client_escaped_cert header from Nginx
be0408d is described below

commit be0408da2235892fd6af618d9474c0750397b056
Author: Florent Guillaume 
AuthorDate: Fri Mar 5 16:49:13 2021 +0100

Improve the SSLValve so it is able to handle the ssl_client_escaped_cert 
header from Nginx
---
 java/org/apache/catalina/valves/SSLValve.java | 20 +++-
 test/org/apache/catalina/valves/TestSSLValve.java | 23 +++
 webapps/docs/changelog.xml|  5 +
 webapps/docs/config/valve.xml |  8 
 4 files changed, 55 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/catalina/valves/SSLValve.java 
b/java/org/apache/catalina/valves/SSLValve.java
index 7c92c2e..0575bbd 100644
--- a/java/org/apache/catalina/valves/SSLValve.java
+++ b/java/org/apache/catalina/valves/SSLValve.java
@@ -30,6 +30,7 @@ import org.apache.catalina.connector.Request;
 import org.apache.catalina.connector.Response;
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
+import org.apache.tomcat.util.buf.UDecoder;
 
 /**
  * When using mod_proxy_http, the client SSL information is not included in the
@@ -65,6 +66,7 @@ public class SSLValve extends ValveBase {
 private static final Log log = LogFactory.getLog(SSLValve.class);
 
 private String sslClientCertHeader = "ssl_client_cert";
+private String sslClientEscapedCertHeader = "ssl_client_escaped_cert";
 private String sslCipherHeader = "ssl_cipher";
 private String sslSessionIdHeader = "ssl_session_id";
 private String sslCipherUserKeySizeHeader = "ssl_cipher_usekeysize";
@@ -83,6 +85,14 @@ public class SSLValve extends ValveBase {
 this.sslClientCertHeader = sslClientCertHeader;
 }
 
+public String getSslClientEscapedCertHeader() {
+return sslClientEscapedCertHeader;
+}
+
+public void setSslClientEscapedCertHeader(String 
sslClientEscapedCertHeader) {
+this.sslClientEscapedCertHeader = sslClientEscapedCertHeader;
+}
+
 public String getSslCipherHeader() {
 return sslCipherHeader;
 }
@@ -128,6 +138,8 @@ public class SSLValve extends ValveBase {
  * processing below:
  * - mod_header converts the '\n' into ' '
  * - nginx converts the '\n' into multiple ' '
+ * - nginx ssl_client_escaped_cert uses "uri component" escaping,
+ *   keeping only ALPHA, DIGIT, "-", ".", "_", "~"
  *
  * The code assumes that the trimmed header value starts with
  * '-BEGIN CERTIFICATE-' and ends with
@@ -137,7 +149,13 @@ public class SSLValve extends ValveBase {
  *   separate lines, the CertificateFactory is tolerant of any
  *   additional whitespace.
  */
-String headerValue = mygetHeader(request, sslClientCertHeader);
+String headerValue;
+String headerEscapedValue = mygetHeader(request, 
sslClientEscapedCertHeader);
+if (headerEscapedValue != null) {
+headerValue = UDecoder.URLDecode(headerEscapedValue, null);
+} else {
+headerValue = mygetHeader(request, sslClientCertHeader);
+}
 if (headerValue != null) {
 headerValue = headerValue.trim();
 if (headerValue.length() > 27) {
diff --git a/test/org/apache/catalina/valves/TestSSLValve.java 
b/test/org/apache/catalina/valves/TestSSLValve.java
index 7e0b073..3d8df7b 100644
--- a/test/org/apache/catalina/valves/TestSSLValve.java
+++ b/test/org/apache/catalina/valves/TestSSLValve.java
@@ -29,6 +29,7 @@ import org.apache.catalina.Valve;
 import org.apache.catalina.connector.Connector;
 import org.apache.catalina.connector.Request;
 import org.apache.tomcat.unittest.TesterLogValidationFilter;
+import org.apache.tomcat.util.buf.UEncoder;
 import org.easymock.EasyMock;
 
 public class TestSSLValve {
@@ -184,6 +185,17 @@ public class TestSSLValve {
 
 
 @Test
+public void testSslClientCertHeaderEscaped() throws Exception {
+String cert = certificateEscaped();
+mockRequest.setHeader(valve.getSslClientEscapedCertHeader(), cert);
+
+valve.invoke(mockRequest, null);
+
+assertCertificateParsed();
+}
+
+
+@Test
 public void testSslClientCertNull() throws Exception {
 TesterLogValidationFilter f = TesterLogValidationFilter.add(null, "", 
null,
 "org.apache.catalina.valves.SSLValve");
@@ -318,6 +330,17 @@ public class TestSSLValve {
 }
 
 
+private static String certificateEscaped() throws Exception {
+String cert = certificateSingleLine(CERTIFICATE_LINES, "\n");
+String escaped = new 

[tomcat] branch master updated: Improve the SSLValve so it is able to handle the ssl_client_escaped_cert header from Nginx

2021-05-19 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new b3ff835  Improve the SSLValve so it is able to handle the 
ssl_client_escaped_cert header from Nginx
b3ff835 is described below

commit b3ff8357a9559e781ae6f9bcd61738cd7ccae2bf
Author: Florent Guillaume 
AuthorDate: Fri Mar 5 16:49:13 2021 +0100

Improve the SSLValve so it is able to handle the ssl_client_escaped_cert 
header from Nginx
---
 java/org/apache/catalina/valves/SSLValve.java | 20 +++-
 test/org/apache/catalina/valves/TestSSLValve.java | 23 +++
 webapps/docs/changelog.xml|  5 +
 webapps/docs/config/valve.xml |  8 
 4 files changed, 55 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/catalina/valves/SSLValve.java 
b/java/org/apache/catalina/valves/SSLValve.java
index e2ea6ae..05b60f7 100644
--- a/java/org/apache/catalina/valves/SSLValve.java
+++ b/java/org/apache/catalina/valves/SSLValve.java
@@ -30,6 +30,7 @@ import org.apache.catalina.connector.Request;
 import org.apache.catalina.connector.Response;
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
+import org.apache.tomcat.util.buf.UDecoder;
 
 /**
  * When using mod_proxy_http, the client SSL information is not included in the
@@ -65,6 +66,7 @@ public class SSLValve extends ValveBase {
 private static final Log log = LogFactory.getLog(SSLValve.class);
 
 private String sslClientCertHeader = "ssl_client_cert";
+private String sslClientEscapedCertHeader = "ssl_client_escaped_cert";
 private String sslCipherHeader = "ssl_cipher";
 private String sslSessionIdHeader = "ssl_session_id";
 private String sslCipherUserKeySizeHeader = "ssl_cipher_usekeysize";
@@ -83,6 +85,14 @@ public class SSLValve extends ValveBase {
 this.sslClientCertHeader = sslClientCertHeader;
 }
 
+public String getSslClientEscapedCertHeader() {
+return sslClientEscapedCertHeader;
+}
+
+public void setSslClientEscapedCertHeader(String 
sslClientEscapedCertHeader) {
+this.sslClientEscapedCertHeader = sslClientEscapedCertHeader;
+}
+
 public String getSslCipherHeader() {
 return sslCipherHeader;
 }
@@ -128,6 +138,8 @@ public class SSLValve extends ValveBase {
  * processing below:
  * - mod_header converts the '\n' into ' '
  * - nginx converts the '\n' into multiple ' '
+ * - nginx ssl_client_escaped_cert uses "uri component" escaping,
+ *   keeping only ALPHA, DIGIT, "-", ".", "_", "~"
  *
  * The code assumes that the trimmed header value starts with
  * '-BEGIN CERTIFICATE-' and ends with
@@ -137,7 +149,13 @@ public class SSLValve extends ValveBase {
  *   separate lines, the CertificateFactory is tolerant of any
  *   additional whitespace.
  */
-String headerValue = mygetHeader(request, sslClientCertHeader);
+String headerValue;
+String headerEscapedValue = mygetHeader(request, 
sslClientEscapedCertHeader);
+if (headerEscapedValue != null) {
+headerValue = UDecoder.URLDecode(headerEscapedValue, null);
+} else {
+headerValue = mygetHeader(request, sslClientCertHeader);
+}
 if (headerValue != null) {
 headerValue = headerValue.trim();
 if (headerValue.length() > 27) {
diff --git a/test/org/apache/catalina/valves/TestSSLValve.java 
b/test/org/apache/catalina/valves/TestSSLValve.java
index 7e0b073..3d8df7b 100644
--- a/test/org/apache/catalina/valves/TestSSLValve.java
+++ b/test/org/apache/catalina/valves/TestSSLValve.java
@@ -29,6 +29,7 @@ import org.apache.catalina.Valve;
 import org.apache.catalina.connector.Connector;
 import org.apache.catalina.connector.Request;
 import org.apache.tomcat.unittest.TesterLogValidationFilter;
+import org.apache.tomcat.util.buf.UEncoder;
 import org.easymock.EasyMock;
 
 public class TestSSLValve {
@@ -184,6 +185,17 @@ public class TestSSLValve {
 
 
 @Test
+public void testSslClientCertHeaderEscaped() throws Exception {
+String cert = certificateEscaped();
+mockRequest.setHeader(valve.getSslClientEscapedCertHeader(), cert);
+
+valve.invoke(mockRequest, null);
+
+assertCertificateParsed();
+}
+
+
+@Test
 public void testSslClientCertNull() throws Exception {
 TesterLogValidationFilter f = TesterLogValidationFilter.add(null, "", 
null,
 "org.apache.catalina.valves.SSLValve");
@@ -318,6 +330,17 @@ public class TestSSLValve {
 }
 
 
+private static String certificateEscaped() throws Exception {
+String cert = certificateSingleLine(CERTIFICATE_LINES, "\n");
+String escaped = ne

[tomcat] branch 8.5.x updated: Improve the SSLValve so it is able to handle the ssl_client_escaped_cert header from Nginx

2021-05-19 Thread markt
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 02f012b  Improve the SSLValve so it is able to handle the 
ssl_client_escaped_cert header from Nginx
02f012b is described below

commit 02f012b9543cfbdbbe8088583c52da116ea72b51
Author: Florent Guillaume 
AuthorDate: Fri Mar 5 16:49:13 2021 +0100

Improve the SSLValve so it is able to handle the ssl_client_escaped_cert 
header from Nginx
---
 java/org/apache/catalina/valves/SSLValve.java | 20 +++-
 test/org/apache/catalina/valves/TestSSLValve.java | 23 +++
 webapps/docs/changelog.xml|  5 +
 webapps/docs/config/valve.xml |  8 
 4 files changed, 55 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/catalina/valves/SSLValve.java 
b/java/org/apache/catalina/valves/SSLValve.java
index 26f6a23..55cc26e 100644
--- a/java/org/apache/catalina/valves/SSLValve.java
+++ b/java/org/apache/catalina/valves/SSLValve.java
@@ -30,6 +30,7 @@ import org.apache.catalina.connector.Request;
 import org.apache.catalina.connector.Response;
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
+import org.apache.tomcat.util.buf.UDecoder;
 
 /**
  * When using mod_proxy_http, the client SSL information is not included in the
@@ -65,6 +66,7 @@ public class SSLValve extends ValveBase {
 private static final Log log = LogFactory.getLog(SSLValve.class);
 
 private String sslClientCertHeader = "ssl_client_cert";
+private String sslClientEscapedCertHeader = "ssl_client_escaped_cert";
 private String sslCipherHeader = "ssl_cipher";
 private String sslSessionIdHeader = "ssl_session_id";
 private String sslCipherUserKeySizeHeader = "ssl_cipher_usekeysize";
@@ -83,6 +85,14 @@ public class SSLValve extends ValveBase {
 this.sslClientCertHeader = sslClientCertHeader;
 }
 
+public String getSslClientEscapedCertHeader() {
+return sslClientEscapedCertHeader;
+}
+
+public void setSslClientEscapedCertHeader(String 
sslClientEscapedCertHeader) {
+this.sslClientEscapedCertHeader = sslClientEscapedCertHeader;
+}
+
 public String getSslCipherHeader() {
 return sslCipherHeader;
 }
@@ -128,6 +138,8 @@ public class SSLValve extends ValveBase {
  * processing below:
  * - mod_header converts the '\n' into ' '
  * - nginx converts the '\n' into multiple ' '
+ * - nginx ssl_client_escaped_cert uses "uri component" escaping,
+ *   keeping only ALPHA, DIGIT, "-", ".", "_", "~"
  *
  * The code assumes that the trimmed header value starts with
  * '-BEGIN CERTIFICATE-' and ends with
@@ -139,7 +151,13 @@ public class SSLValve extends ValveBase {
  *   such as leading and trailing spaces and new lines as long as
  *   they do not appear in the middle of an original content line.
  */
-String headerValue = mygetHeader(request, sslClientCertHeader);
+String headerValue;
+String headerEscapedValue = mygetHeader(request, 
sslClientEscapedCertHeader);
+if (headerEscapedValue != null) {
+headerValue = UDecoder.URLDecode(headerEscapedValue, 
StandardCharsets.ISO_8859_1);
+} else {
+headerValue = mygetHeader(request, sslClientCertHeader);
+}
 if (headerValue != null) {
 headerValue = headerValue.trim();
 if (headerValue.length() > 27) {
diff --git a/test/org/apache/catalina/valves/TestSSLValve.java 
b/test/org/apache/catalina/valves/TestSSLValve.java
index 0699ff6..d3c3373 100644
--- a/test/org/apache/catalina/valves/TestSSLValve.java
+++ b/test/org/apache/catalina/valves/TestSSLValve.java
@@ -29,6 +29,7 @@ import org.apache.catalina.Valve;
 import org.apache.catalina.connector.Connector;
 import org.apache.catalina.connector.Request;
 import org.apache.tomcat.unittest.TesterLogValidationFilter;
+import org.apache.tomcat.util.buf.UEncoder;
 import org.easymock.EasyMock;
 
 public class TestSSLValve {
@@ -184,6 +185,17 @@ public class TestSSLValve {
 
 
 @Test
+public void testSslClientCertHeaderEscaped() throws Exception {
+String cert = certificateEscaped();
+mockRequest.setHeader(valve.getSslClientEscapedCertHeader(), cert);
+
+valve.invoke(mockRequest, null);
+
+assertCertificateParsed();
+}
+
+
+@Test
 public void testSslClientCertNull() throws Exception {
 TesterLogValidationFilter f = TesterLogValidationFilter.add(null, "", 
null,
 "org.apache.catalina.valves.SSLValve");
@@ -318,6 +330,17 @@ public class TestSSLValve {
 }
 
 
+private static String certificateEscaped() throws Exception {
+String cert = certificateS

[GitHub] [tomcat] markt-asf closed pull request #401: Add support for unix domain sockets (APR Protocol)

2021-05-19 Thread GitBox


markt-asf closed pull request #401:
URL: https://github.com/apache/tomcat/pull/401


   


-- 
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.

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 commented on pull request #401: Add support for unix domain sockets (APR Protocol)

2021-05-19 Thread GitBox


markt-asf commented on pull request #401:
URL: https://github.com/apache/tomcat/pull/401#issuecomment-844365000


   As far as I can tell, this PR was applied in a616bf38


-- 
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.

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 8.5.x updated: Remove unnecessary code - align with 9.0.x/10.0.x

2021-05-19 Thread markt
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 c099d68  Remove unnecessary code - align with 9.0.x/10.0.x
c099d68 is described below

commit c099d68e48bcbb0e8fd54a6ac9bccfcb7432cb07
Author: Mark Thomas 
AuthorDate: Wed May 19 19:59:46 2021 +0100

Remove unnecessary code - align with 9.0.x/10.0.x
---
 .../catalina/connector/CoyoteInputStream.java  | 33 +-
 1 file changed, 1 insertion(+), 32 deletions(-)

diff --git a/java/org/apache/catalina/connector/CoyoteInputStream.java 
b/java/org/apache/catalina/connector/CoyoteInputStream.java
index 8662e9a..8e47c53 100644
--- a/java/org/apache/catalina/connector/CoyoteInputStream.java
+++ b/java/org/apache/catalina/connector/CoyoteInputStream.java
@@ -125,32 +125,7 @@ public class CoyoteInputStream extends ServletInputStream {
 
 @Override
 public int read(final byte[] b) throws IOException {
-checkNonBlockingRead();
-
-if (SecurityUtil.isPackageProtectionEnabled()) {
-try {
-Integer result = AccessController
-.doPrivileged(new PrivilegedExceptionAction() 
{
-
-@Override
-public Integer run() throws IOException {
-Integer integer = Integer.valueOf(ib.read(b, 
0, b.length));
-return integer;
-}
-
-});
-return result.intValue();
-} catch (PrivilegedActionException pae) {
-Exception e = pae.getException();
-if (e instanceof IOException) {
-throw (IOException) e;
-} else {
-throw new RuntimeException(e.getMessage(), e);
-}
-}
-} else {
-return ib.read(b, 0, b.length);
-}
+return read(b, 0, b.length);
 }
 
 
@@ -226,12 +201,6 @@ public class CoyoteInputStream extends ServletInputStream {
 }
 
 
-@Override
-public int readLine(byte[] b, int off, int len) throws IOException {
-return super.readLine(b, off, len);
-}
-
-
 /**
  * Close the stream
  * Since we re-cycle, we can't allow the call to super.close()

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[Bug 65124] Inefficient generated JSP code

2021-05-19 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=65124

--- Comment #15 from John Engebretson  ---
Sorry, I'm a little confused - are you planning to generate plugins for every
tag?  I view this more as an optimization to the global JSP compiler.

-- 
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



[GitHub] [tomcat] tianshuang opened a new pull request #419: part.getString will cause OOM without checking maxPostSize, checking maxPostSize first will avoid OOM caused by huge string

2021-05-19 Thread GitBox


tianshuang opened a new pull request #419:
URL: https://github.com/apache/tomcat/pull/419


   In our online server, when the client sends a huge string (hundreds of 
megabytes) to the server via multipart/form-data, OOM occurs, and the 
maxPostSize check logic is not executed


-- 
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.

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