[tomcat] 01/03: Remove mappings provided by the JVM
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 commit a610cf45177b7d49a23c99bb969c391f0d74a1b3 Author: Mark Thomas AuthorDate: Mon Jun 24 10:09:55 2019 +0100 Remove mappings provided by the JVM --- .../apache/tomcat/util/http/fileupload/util/mime/MimeUtility.java | 7 --- 1 file changed, 7 deletions(-) diff --git a/java/org/apache/tomcat/util/http/fileupload/util/mime/MimeUtility.java b/java/org/apache/tomcat/util/http/fileupload/util/mime/MimeUtility.java index b5b4cdd..a6200ca 100644 --- a/java/org/apache/tomcat/util/http/fileupload/util/mime/MimeUtility.java +++ b/java/org/apache/tomcat/util/http/fileupload/util/mime/MimeUtility.java @@ -68,15 +68,8 @@ public final class MimeUtility { private static final Map MIME2JAVA = new HashMap<>(); static { -MIME2JAVA.put("iso-2022-cn", "ISO2022CN"); -MIME2JAVA.put("iso-2022-kr", "ISO2022KR"); -MIME2JAVA.put("utf-8", "UTF8"); -MIME2JAVA.put("utf8", "UTF8"); MIME2JAVA.put("ja_jp.iso2022-7", "ISO2022JP"); MIME2JAVA.put("ja_jp.eucjp", "EUCJIS"); -MIME2JAVA.put("euc-kr", "KSC5601"); -MIME2JAVA.put("euckr", "KSC5601"); -MIME2JAVA.put("us-ascii", "ISO-8859-1"); MIME2JAVA.put("x-us-ascii", "ISO-8859-1"); } - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] 02/03: Use standard charset rather than (non-standard) name for UTF-8
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 commit d0bfb8a33d15de94c9f3f31a6c4a0594b0c831fb Author: Mark Thomas AuthorDate: Mon Jun 24 10:11:08 2019 +0100 Use standard charset rather than (non-standard) name for UTF-8 --- java/org/apache/catalina/servlets/DefaultServlet.java | 4 ++-- java/org/apache/catalina/users/MemoryUserDatabase.java | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/java/org/apache/catalina/servlets/DefaultServlet.java b/java/org/apache/catalina/servlets/DefaultServlet.java index a9ba7b6..16eb297 100644 --- a/java/org/apache/catalina/servlets/DefaultServlet.java +++ b/java/org/apache/catalina/servlets/DefaultServlet.java @@ -1756,7 +1756,7 @@ public class DefaultServlet extends HttpServlet { Transformer transformer = tFactory.newTransformer(xsltSource); ByteArrayOutputStream stream = new ByteArrayOutputStream(); -OutputStreamWriter osWriter = new OutputStreamWriter(stream, "UTF8"); +OutputStreamWriter osWriter = new OutputStreamWriter(stream, StandardCharsets.UTF_8); StreamResult out = new StreamResult(osWriter); transformer.transform(xmlSource, out); osWriter.flush(); @@ -1811,7 +1811,7 @@ public class DefaultServlet extends HttpServlet { // Prepare a writer to a buffered area ByteArrayOutputStream stream = new ByteArrayOutputStream(); -OutputStreamWriter osWriter = new OutputStreamWriter(stream, "UTF8"); +OutputStreamWriter osWriter = new OutputStreamWriter(stream, StandardCharsets.UTF_8); PrintWriter writer = new PrintWriter(osWriter); StringBuilder sb = new StringBuilder(); diff --git a/java/org/apache/catalina/users/MemoryUserDatabase.java b/java/org/apache/catalina/users/MemoryUserDatabase.java index 2a594f9..28856b4 100644 --- a/java/org/apache/catalina/users/MemoryUserDatabase.java +++ b/java/org/apache/catalina/users/MemoryUserDatabase.java @@ -24,6 +24,7 @@ import java.io.PrintWriter; import java.net.URI; import java.net.URL; import java.net.URLConnection; +import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.Iterator; import java.util.Map; @@ -566,7 +567,7 @@ public class MemoryUserDatabase implements UserDatabase { writeLock.lock(); try { try (FileOutputStream fos = new FileOutputStream(fileNew); -OutputStreamWriter osw = new OutputStreamWriter(fos, "UTF8"); +OutputStreamWriter osw = new OutputStreamWriter(fos, StandardCharsets.UTF_8); PrintWriter writer = new PrintWriter(osw)) { // Print the file prolog - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch master updated (d328560 -> 7b37b04)
This is an automated email from the ASF dual-hosted git repository. markt pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/tomcat.git. from d328560 Fix charset name for UTF-32LE in bom detection. new a610cf4 Remove mappings provided by the JVM new d0bfb8a Use standard charset rather than (non-standard) name for UTF-8 new 7b37b04 Use standard form to reference UTF-8 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: java/org/apache/catalina/servlets/DefaultServlet.java | 4 ++-- java/org/apache/catalina/storeconfig/StoreLoader.java | 2 +- java/org/apache/catalina/users/MemoryUserDatabase.java | 3 ++- java/org/apache/jasper/EmbeddedServletOptions.java | 2 +- .../apache/tomcat/util/http/fileupload/util/mime/MimeUtility.java | 7 --- 5 files changed, 6 insertions(+), 12 deletions(-) - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] 03/03: Use standard form to reference UTF-8
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 commit 7b37b0429dc511929a546078f5ce9e5517a7eab4 Author: Mark Thomas AuthorDate: Mon Jun 24 10:11:29 2019 +0100 Use standard form to reference UTF-8 --- java/org/apache/catalina/storeconfig/StoreLoader.java | 2 +- java/org/apache/jasper/EmbeddedServletOptions.java| 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/java/org/apache/catalina/storeconfig/StoreLoader.java b/java/org/apache/catalina/storeconfig/StoreLoader.java index 17fba3a..bbbfdfc 100644 --- a/java/org/apache/catalina/storeconfig/StoreLoader.java +++ b/java/org/apache/catalina/storeconfig/StoreLoader.java @@ -29,7 +29,7 @@ import org.apache.tomcat.util.file.ConfigurationSource.Resource; * * * {@code - * + * *
[tomcat] branch 8.5.x updated: Aligning o.a.c.servlets between 9.0.x and 8.5.x. 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 The following commit(s) were added to refs/heads/8.5.x by this push: new bcb0e5b Aligning o.a.c.servlets between 9.0.x and 8.5.x. No functional change. bcb0e5b is described below commit bcb0e5b1f356958a7cc377e6eaaa918288a030fb Author: Mark Thomas AuthorDate: Mon Jun 24 10:32:45 2019 +0100 Aligning o.a.c.servlets between 9.0.x and 8.5.x. No functional change. --- java/org/apache/catalina/servlets/CGIServlet.java | 6 ++-- .../apache/catalina/servlets/DefaultServlet.java | 24 +++ .../catalina/servlets/LocalStrings.properties | 5 ++- .../catalina/servlets/LocalStrings_es.properties | 10 ++ .../catalina/servlets/LocalStrings_fr.properties | 36 +- .../catalina/servlets/LocalStrings_ja.properties | 32 +++ .../apache/catalina/servlets/WebdavServlet.java| 28 +++-- 7 files changed, 107 insertions(+), 34 deletions(-) diff --git a/java/org/apache/catalina/servlets/CGIServlet.java b/java/org/apache/catalina/servlets/CGIServlet.java index 5d0de11..b519497 100644 --- a/java/org/apache/catalina/servlets/CGIServlet.java +++ b/java/org/apache/catalina/servlets/CGIServlet.java @@ -1611,9 +1611,9 @@ public final class CGIServlet extends HttpServlet { log.debug("envp: [" + env + "], command: [" + command + "]"); } -if ((command.indexOf(File.separator + "." + File.separator) >= 0) -|| (command.indexOf(File.separator + "..") >= 0) -|| (command.indexOf(".." + File.separator) >= 0)) { +if ((command.contains(File.separator + "." + File.separator)) +|| (command.contains(File.separator + "..")) +|| (command.contains(".." + File.separator))) { throw new IOException(this.getClass().getName() + "Illegal Character in CGI command " + "path ('.' or '..') detected. Not " diff --git a/java/org/apache/catalina/servlets/DefaultServlet.java b/java/org/apache/catalina/servlets/DefaultServlet.java index 9aa9950..e38723d 100644 --- a/java/org/apache/catalina/servlets/DefaultServlet.java +++ b/java/org/apache/catalina/servlets/DefaultServlet.java @@ -266,7 +266,7 @@ public class DefaultServlet extends HttpServlet { /** * The sorting manager for sorting files and directories. */ -protected SortManager sortManager; +protected transient SortManager sortManager; // - Public Methods @@ -333,7 +333,7 @@ public class DefaultServlet extends HttpServlet { Globals.RESOURCES_ATTR); if (resources == null) { -throw new UnavailableException("No resources"); +throw new UnavailableException(sm.getString("defaultServlet.noResources")); } if (getServletConfig().getInitParameter("showServerInfo") != null) { @@ -1328,7 +1328,7 @@ public class DefaultServlet extends HttpServlet { rangeHeader = rangeHeader.substring(6); -// Vector which will contain all the ranges which are successfully +// Collection which will contain all the ranges which are successfully // parsed. ArrayList result = new ArrayList<>(); StringTokenizer commaTokenizer = new StringTokenizer(rangeHeader, ","); @@ -1633,7 +1633,7 @@ public class DefaultServlet extends HttpServlet { osWriter.flush(); return new ByteArrayInputStream(stream.toByteArray()); } catch (TransformerException e) { -throw new ServletException("XSL transformer error", e); +throw new ServletException(sm.getString("defaultServlet.xslError"), e); } finally { if (Globals.IS_SECURITY_ENABLED) { PrivilegedSetTccl pa = new PrivilegedSetTccl(original); @@ -1922,7 +1922,7 @@ public class DefaultServlet extends HttpServlet { } copyRange(reader, new PrintWriter(buffer)); } catch (IOException e) { -log("Failure to close reader", e); +log(sm.getString("defaultServlet.readerCloseFailed"), e); } finally { if (reader != null) { try { @@ -2866,14 +2866,14 @@ public class DefaultServlet extends HttpServlet { this.ascending = ascending; } -public static Order NAME = new Order('N', false); -public static Order NAME_ASC = new Order('N', true); -public static Order SIZE = new Order('S', false); -public static Order SIZE_ASC = new Order('S', true); -public static Order LAST_MODIFIED = new Order('M', false); -
[tomcat] 02/02: Correct sub-section order
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 8f9fdb0eab7ec7ff0eeb8debbd8c5629da9729c0 Author: Mark Thomas AuthorDate: Mon Jun 24 10:50:19 2019 +0100 Correct sub-section order --- webapps/docs/changelog.xml | 24 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 6e2a4dc..793eb19 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -61,18 +61,6 @@ - - - -Switch i18n message files to use UTF-8 and convert to ASCII at build -time. (markt) - - -63523: Restore SSLUtilBase methods as protected to preserve -compatibility. (remm) - - - @@ -91,6 +79,18 @@ + + + +Switch i18n message files to use UTF-8 and convert to ASCII at build +time. (markt) + + +63523: Restore SSLUtilBase methods as protected to preserve +compatibility. (remm) + + + - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] 01/02: Align use of Allow header and HTTP 405 status code
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 00a302f75fa757d91967fdc03a8abfd1b2bb3d26 Author: Mark Thomas AuthorDate: Tue Jan 9 13:50:52 2018 + Align use of Allow header and HTTP 405 status code Modify the Default and WebDAV Servlets so that a 405 status code is returned for PUT and DELETE requests when disabled via the readonly initialisation parameter. Align the contents of the Allow header with the response code for the Default and WebDAV Servlets. For any given resource a method that returns a 405 status code will not be listed in the Allow header and a method listed in the Allow header will not return a 405 status code. Based on a patch suggested by Ken Dombeck. --- .../apache/catalina/servlets/DefaultServlet.java | 37 +++-- .../apache/catalina/servlets/WebdavServlet.java| 75 +- .../catalina/servlets/ServletOptionsBaseTest.java | 161 + .../servlets/TestDefaultServletOptions.java| 61 .../servlets/TestWebdavServletOptions.java | 62 .../apache/catalina/startup/SimpleHttpClient.java | 5 + .../apache/catalina/startup/TomcatBaseTest.java| 2 +- webapps/docs/changelog.xml | 16 ++ 8 files changed, 368 insertions(+), 51 deletions(-) diff --git a/java/org/apache/catalina/servlets/DefaultServlet.java b/java/org/apache/catalina/servlets/DefaultServlet.java index e38723d..87860f0 100644 --- a/java/org/apache/catalina/servlets/DefaultServlet.java +++ b/java/org/apache/catalina/servlets/DefaultServlet.java @@ -512,24 +512,35 @@ public class DefaultServlet extends HttpServlet { protected void doOptions(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { +resp.setHeader("Allow", determineMethodsAllowed(req)); +} + + +protected String determineMethodsAllowed(HttpServletRequest req) { StringBuilder allow = new StringBuilder(); -// There is a doGet method -allow.append("GET, HEAD"); -// There is a doPost -allow.append(", POST"); -// There is a doPut -allow.append(", PUT"); -// There is a doDelete -allow.append(", DELETE"); + +// Start with methods that are always allowed +allow.append("OPTIONS, GET, HEAD, POST"); + +// PUT and DELETE depend on readonly +if (!readOnly) { +allow.append(", PUT, DELETE"); +} + // Trace - assume disabled unless we can prove otherwise if (req instanceof RequestFacade && ((RequestFacade) req).getAllowTrace()) { allow.append(", TRACE"); } -// Always allow options -allow.append(", OPTIONS"); -resp.setHeader("Allow", allow.toString()); +return allow.toString(); +} + + +protected void sendNotAllowed(HttpServletRequest req, HttpServletResponse resp) +throws IOException { +resp.addHeader("Allow", determineMethodsAllowed(req)); +resp.sendError(WebdavStatus.SC_METHOD_NOT_ALLOWED); } @@ -564,7 +575,7 @@ public class DefaultServlet extends HttpServlet { throws ServletException, IOException { if (readOnly) { -resp.sendError(HttpServletResponse.SC_FORBIDDEN); +sendNotAllowed(req, resp); return; } @@ -688,7 +699,7 @@ public class DefaultServlet extends HttpServlet { throws ServletException, IOException { if (readOnly) { -resp.sendError(HttpServletResponse.SC_FORBIDDEN); +sendNotAllowed(req, resp); return; } diff --git a/java/org/apache/catalina/servlets/WebdavServlet.java b/java/org/apache/catalina/servlets/WebdavServlet.java index 0428c72..5ce1678 100644 --- a/java/org/apache/catalina/servlets/WebdavServlet.java +++ b/java/org/apache/catalina/servlets/WebdavServlet.java @@ -463,10 +463,7 @@ public class WebdavServlet extends DefaultServlet { throws ServletException, IOException { resp.addHeader("DAV", "1,2"); - -StringBuilder methodsAllowed = determineMethodsAllowed(req); - -resp.addHeader("Allow", methodsAllowed.toString()); +resp.addHeader("Allow", determineMethodsAllowed(req)); resp.addHeader("MS-Author-Via", "DAV"); } @@ -482,11 +479,7 @@ public class WebdavServlet extends DefaultServlet { throws ServletException, IOException { if (!listings) { -// Get allowed methods -StringBuilder methodsAllowed = determineMethodsAllowed(req); - -resp.addHeader("Allow", methodsAllowed.toString()); -resp.sendError(WebdavStatus.SC_METHOD_NOT_ALLOWED); +sendNotAllowed(req, resp); return; } @@ -742
[tomcat] branch 8.5.x updated (bcb0e5b -> 8f9fdb0)
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 bcb0e5b Aligning o.a.c.servlets between 9.0.x and 8.5.x. No functional change. new 00a302f Align use of Allow header and HTTP 405 status code new 8f9fdb0 Correct sub-section order 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: .../apache/catalina/servlets/DefaultServlet.java | 37 +++-- .../apache/catalina/servlets/WebdavServlet.java| 75 +- .../catalina/servlets/ServletOptionsBaseTest.java | 161 + .../servlets/TestDefaultServletOptions.java| 61 .../servlets/TestWebdavServletOptions.java | 62 .../apache/catalina/startup/SimpleHttpClient.java | 5 + .../apache/catalina/startup/TomcatBaseTest.java| 2 +- webapps/docs/changelog.xml | 30 +++- 8 files changed, 375 insertions(+), 58 deletions(-) create mode 100644 test/org/apache/catalina/servlets/ServletOptionsBaseTest.java create mode 100644 test/org/apache/catalina/servlets/TestDefaultServletOptions.java create mode 100644 test/org/apache/catalina/servlets/TestWebdavServletOptions.java - 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 (8f9fdb0 -> 41ea849)
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 8f9fdb0 Correct sub-section order new 4ec3d26 Back-port spotbugs fixes new 41ea849 When using WebDAV to copy a file resource to a destination that requires a collection to be overwritten, ensure that the operation succeeds rather than fails (with a 500 response). This enables Tomcat to pass two additional tests from the Litmus WebDAV test suite. 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: java/org/apache/catalina/servlets/WebdavServlet.java | 19 +-- webapps/docs/changelog.xml | 6 ++ 2 files changed, 23 insertions(+), 2 deletions(-) - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] 02/02: When using WebDAV to copy a file resource to a destination that requires a collection to be overwritten, ensure that the operation succeeds rather than fails (with a 500 response). Thi
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 41ea8490b92499e32cc1392e9d53aa7db18ef1fc Author: Mark Thomas AuthorDate: Mon Jan 8 15:52:15 2018 + When using WebDAV to copy a file resource to a destination that requires a collection to be overwritten, ensure that the operation succeeds rather than fails (with a 500 response). This enables Tomcat to pass two additional tests from the Litmus WebDAV test suite. git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1820576 13f79535-47bb-0310-9956-ffa450edef68 --- java/org/apache/catalina/servlets/WebdavServlet.java | 7 +++ webapps/docs/changelog.xml | 6 ++ 2 files changed, 13 insertions(+) diff --git a/java/org/apache/catalina/servlets/WebdavServlet.java b/java/org/apache/catalina/servlets/WebdavServlet.java index 1ad0f97..f820e7e 100644 --- a/java/org/apache/catalina/servlets/WebdavServlet.java +++ b/java/org/apache/catalina/servlets/WebdavServlet.java @@ -1735,6 +1735,13 @@ public class WebdavServlet extends DefaultServlet { } } } +// WebDAV Litmus test attempts to copy/move a file over a collection +// Need to remove trailing / from destination to enable test to pass +if (!destResource.exists() && dest.endsWith("/") && dest.length() > 1) { +// Convert destination name from collection (with trailing '/') +// to file (without trailing '/') +dest = dest.substring(0, dest.length() - 1); +} try (InputStream is = sourceResource.getInputStream()) { if (!resources.write(dest, is, false)) { errorList.put(source, Integer.valueOf(WebdavStatus.SC_INTERNAL_SERVER_ERROR)); diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 793eb19..67ffece 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -59,6 +59,12 @@ Allow header and a method listed in the Allow header will not return a 405 status code. (markt) + +When using WebDAV to copy a file resource to a destination that requires +a collection to be overwritten, ensure that the operation succeeds +rather than fails (with a 500 response). This enables Tomcat to pass two +additional tests from the Litmus WebDAV test suite. (markt) + - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] 01/02: Back-port spotbugs fixes
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 4ec3d26396e4d8804629d31fa2459eb1401bcf44 Author: Mark Thomas AuthorDate: Mon Jun 24 10:54:54 2019 +0100 Back-port spotbugs fixes --- java/org/apache/catalina/servlets/WebdavServlet.java | 12 ++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/java/org/apache/catalina/servlets/WebdavServlet.java b/java/org/apache/catalina/servlets/WebdavServlet.java index 5ce1678..1ad0f97 100644 --- a/java/org/apache/catalina/servlets/WebdavServlet.java +++ b/java/org/apache/catalina/servlets/WebdavServlet.java @@ -18,6 +18,7 @@ package org.apache.catalina.servlets; import java.io.IOException; import java.io.InputStream; +import java.io.Serializable; import java.io.StringReader; import java.io.StringWriter; import java.io.Writer; @@ -909,7 +910,7 @@ public class WebdavServlet extends DefaultServlet { return; } -LockInfo lock = new LockInfo(); +LockInfo lock = new LockInfo(maxDepth); // Parsing lock request @@ -2357,11 +2358,18 @@ public class WebdavServlet extends DefaultServlet { /** * Holds a lock information. */ -private class LockInfo { +private static class LockInfo implements Serializable { + +private static final long serialVersionUID = 1L; + +public LockInfo(int maxDepth) { +this.maxDepth = maxDepth; +} // - Instance Variables +private final int maxDepth; String path = "/"; String type = "write"; - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch master updated: Add version info to deprecation markers
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 3fd38c0 Add version info to deprecation markers 3fd38c0 is described below commit 3fd38c06efdb0e3c405c5d6e124617d852838282 Author: Mark Thomas AuthorDate: Mon Jun 24 11:12:05 2019 +0100 Add version info to deprecation markers --- java/org/apache/catalina/servlets/DefaultServlet.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/java/org/apache/catalina/servlets/DefaultServlet.java b/java/org/apache/catalina/servlets/DefaultServlet.java index 16eb297..ceba5d3 100644 --- a/java/org/apache/catalina/servlets/DefaultServlet.java +++ b/java/org/apache/catalina/servlets/DefaultServlet.java @@ -1630,6 +1630,7 @@ public class DefaultServlet extends HttpServlet { * * @throws IOException an IO error occurred * @throws ServletException rendering error + * @deprecated Unused. Will be removed in Tomcat 10 * @deprecated Use {@link #render(HttpServletRequest, String, WebResource, String)} instead */ @Deprecated @@ -1785,6 +1786,7 @@ public class DefaultServlet extends HttpServlet { * * @throws IOException an IO error occurred * + * @deprecated Unused. Will be removed in Tomcat 10 * @deprecated Use {@link #renderHtml(HttpServletRequest, String, WebResource, String)} instead */ @Deprecated - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch master updated: Correct test parameter labels
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 8af9e90 Correct test parameter labels 8af9e90 is described below commit 8af9e90786bbc9c62c21053014747da1f67a3733 Author: Mark Thomas AuthorDate: Mon Jun 24 11:31:16 2019 +0100 Correct test parameter labels --- test/org/apache/catalina/servlets/DefaultServletEncodingBaseTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/org/apache/catalina/servlets/DefaultServletEncodingBaseTest.java b/test/org/apache/catalina/servlets/DefaultServletEncodingBaseTest.java index eee66c5..6ff4849 100644 --- a/test/org/apache/catalina/servlets/DefaultServletEncodingBaseTest.java +++ b/test/org/apache/catalina/servlets/DefaultServletEncodingBaseTest.java @@ -57,8 +57,8 @@ import org.apache.tomcat.util.http.parser.MediaType; @RunWith(Parameterized.class) public abstract class DefaultServletEncodingBaseTest extends TomcatBaseTest { -@Parameterized.Parameters(name = "{index}: contextEnc[{0}], fileEnc[{1}], target[{4}]," + -" useInclude[{5}], outputEnc[{6}], callSetCharacterEnc[{8}], useWriter[{7}]") +@Parameterized.Parameters(name = "{index}: contextEnc[{0}], fileEnc[{1}], target[{2}]," + +" useInclude[{3}], outputEnc[{4}], callSetCharacterEnc[{5}], useWriter[{6}]") public static Collection parameters() { String[] encodings = new String[] { - 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 (41ea849 -> 486e49e)
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 41ea849 When using WebDAV to copy a file resource to a destination that requires a collection to be overwritten, ensure that the operation succeeds rather than fails (with a 500 response). This enables Tomcat to pass two additional tests from the Litmus WebDAV test suite. new 806b2f9 Add version info to deprecation markers new 486e49e Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=49464 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: conf/web.xml | 5 + java/org/apache/catalina/core/StandardContext.java | 12 +- .../apache/catalina/servlets/DefaultServlet.java | 249 +++--- .../servlets/DefaultServletEncodingBaseTest.java | 284 + .../catalina/servlets/TestDefaultServlet.java | 48 ++-- .../TestDefaultServletEncodingWithBom.java | 11 +- .../TestDefaultServletEncodingWithoutBom.java | 11 +- test/webapp/404.html | 1 + test/webapp/bug49nnn/bug49464-cp1252.txt | 1 + test/webapp/bug49nnn/bug49464-ibm850.txt | 1 + test/webapp/bug49nnn/bug49464-iso-8859-1.txt | 1 + test/webapp/bug49nnn/bug49464-utf-8-bom.txt| 1 + test/webapp/bug49nnn/bug49464-utf-8.txt| 1 + webapps/docs/changelog.xml | 5 + 14 files changed, 549 insertions(+), 82 deletions(-) create mode 100644 test/org/apache/catalina/servlets/DefaultServletEncodingBaseTest.java copy java/org/apache/catalina/servlets/Constants.java => test/org/apache/catalina/servlets/TestDefaultServletEncodingWithBom.java (83%) copy java/org/apache/catalina/servlets/Constants.java => test/org/apache/catalina/servlets/TestDefaultServletEncodingWithoutBom.java (83%) create mode 100644 test/webapp/404.html create mode 100644 test/webapp/bug49nnn/bug49464-cp1252.txt create mode 100644 test/webapp/bug49nnn/bug49464-ibm850.txt create mode 100644 test/webapp/bug49nnn/bug49464-iso-8859-1.txt create mode 100644 test/webapp/bug49nnn/bug49464-utf-8-bom.txt create mode 100644 test/webapp/bug49nnn/bug49464-utf-8.txt - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] 01/02: Add version info to deprecation markers
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 806b2f9ae3cf4ff3767d47def59b3db3abdf0a73 Author: Mark Thomas AuthorDate: Mon Jun 24 11:10:45 2019 +0100 Add version info to deprecation markers --- java/org/apache/catalina/servlets/DefaultServlet.java | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/java/org/apache/catalina/servlets/DefaultServlet.java b/java/org/apache/catalina/servlets/DefaultServlet.java index 87860f0..dd0bfbc 100644 --- a/java/org/apache/catalina/servlets/DefaultServlet.java +++ b/java/org/apache/catalina/servlets/DefaultServlet.java @@ -1481,8 +1481,8 @@ public class DefaultServlet extends HttpServlet { * directory. * * @param contextPath Context path to which our internal paths are relative - * @param resource The associated resource - * @param xsltSource The XSL stylesheet + * @param resourceThe associated resource + * @param xsltSource The XSL stylesheet * * @return the XML data * @@ -1503,15 +1503,15 @@ public class DefaultServlet extends HttpServlet { * directory. * * @param contextPath Context path to which our internal paths are relative - * @param resource The associated resource - * @param xsltSource The XSL stylesheet + * @param resourceThe associated resource + * @param xsltSource The XSL stylesheet * @param encodingThe encoding to use to process the readme (if any) * * @return the XML data * * @throws IOException an IO error occurred * @throws ServletException rendering error - * @deprecated Unused. Will be removed in Tomcat 9 + * @deprecated Unused. Will be removed in Tomcat 10 * @deprecated Use {@link #render(HttpServletRequest, String, WebResource, String)} instead */ @Deprecated @@ -1686,7 +1686,7 @@ public class DefaultServlet extends HttpServlet { * * @throws IOException an IO error occurred * - * @deprecated Unused. Will be removed in Tomcat 9 + * @deprecated Unused. Will be removed in Tomcat 10 * @deprecated Use {@link #renderHtml(HttpServletRequest, String, WebResource, String)} instead */ @Deprecated - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] 02/02: Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=49464
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 486e49e7c9e36c3adb93f1ec684c7d3d4a59fe69 Author: Mark Thomas AuthorDate: Mon Jun 24 13:38:12 2019 +0100 Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=49464 Improve the Default Servlet's handling of static files when the file encoding is not compatible with the required response encoding. --- conf/web.xml | 5 + java/org/apache/catalina/core/StandardContext.java | 12 +- .../apache/catalina/servlets/DefaultServlet.java | 237 ++--- .../servlets/DefaultServletEncodingBaseTest.java | 284 + .../catalina/servlets/TestDefaultServlet.java | 48 ++-- .../TestDefaultServletEncodingWithBom.java | 26 ++ .../TestDefaultServletEncodingWithoutBom.java | 26 ++ test/webapp/404.html | 1 + test/webapp/bug49nnn/bug49464-cp1252.txt | 1 + test/webapp/bug49nnn/bug49464-ibm850.txt | 1 + test/webapp/bug49nnn/bug49464-iso-8859-1.txt | 1 + test/webapp/bug49nnn/bug49464-utf-8-bom.txt| 1 + test/webapp/bug49nnn/bug49464-utf-8.txt| 1 + webapps/docs/changelog.xml | 5 + 14 files changed, 585 insertions(+), 64 deletions(-) diff --git a/conf/web.xml b/conf/web.xml index 0a34838..4d207ee 100644 --- a/conf/web.xml +++ b/conf/web.xml @@ -48,6 +48,11 @@ + + + + + diff --git a/java/org/apache/catalina/core/StandardContext.java b/java/org/apache/catalina/core/StandardContext.java index e425076..c7803f2 100644 --- a/java/org/apache/catalina/core/StandardContext.java +++ b/java/org/apache/catalina/core/StandardContext.java @@ -882,7 +882,17 @@ public class StandardContext extends ContainerBase @Override public void setResponseCharacterEncoding(String responseEncoding) { -this.responseEncoding = responseEncoding; +/* + * This ensures that the context response encoding is represented by a + * unique String object. This enables the Default Servlet to + * differentiate between a Response using this default encoding and one + * that has been explicitly configured. + */ +if (responseEncoding == null) { +this.responseEncoding = null; +} else { +this.responseEncoding = new String(responseEncoding); +} } diff --git a/java/org/apache/catalina/servlets/DefaultServlet.java b/java/org/apache/catalina/servlets/DefaultServlet.java index dd0bfbc..c99afe1 100644 --- a/java/org/apache/catalina/servlets/DefaultServlet.java +++ b/java/org/apache/catalina/servlets/DefaultServlet.java @@ -32,6 +32,8 @@ import java.io.Reader; import java.io.Serializable; import java.io.StringReader; import java.io.StringWriter; +import java.io.UnsupportedEncodingException; +import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; import java.security.AccessController; import java.util.ArrayList; @@ -76,6 +78,7 @@ import org.apache.catalina.util.IOTools; import org.apache.catalina.util.ServerInfo; import org.apache.catalina.util.URLEncoder; import org.apache.catalina.webresources.CachedResource; +import org.apache.tomcat.util.buf.B2CConverter; import org.apache.tomcat.util.http.ResponseUtil; import org.apache.tomcat.util.res.StringManager; import org.apache.tomcat.util.security.Escape; @@ -242,6 +245,12 @@ public class DefaultServlet extends HttpServlet { * the platform default is used. */ protected String fileEncoding = null; +private transient Charset fileEncodingCharset = null; + +/** + * If a file has a BOM, should that be used in preference to fileEncoding? + */ +private boolean useBomIfPresent = true; /** * Minimum size for sendfile usage in bytes. @@ -308,6 +317,20 @@ public class DefaultServlet extends HttpServlet { Integer.parseInt(getServletConfig().getInitParameter("sendfileSize")) * 1024; fileEncoding = getServletConfig().getInitParameter("fileEncoding"); +if (fileEncoding == null) { +fileEncodingCharset = Charset.defaultCharset(); +fileEncoding = fileEncodingCharset.name(); +} else { +try { +fileEncodingCharset = B2CConverter.getCharset(fileEncoding); +} catch (UnsupportedEncodingException e) { +throw new ServletException(e); +} +} + +if (getServletConfig().getInitParameter("useBomIfPresent") != null) +useBomIfPresent = Boolean.parseBoolean( +getServletConfig().getInitParameter("useBomIfPresent")); globalXsltFile = getServletConfig().getInitParameter("globalXsltFile"); contextXsltFile = getServletConfig().getInitParamete
[Bug 49464] DefaultServlet and CharacterEncoding
https://bz.apache.org/bugzilla/show_bug.cgi?id=49464 --- Comment #9 from Mark Thomas --- It has been almost 2 years without further regressions so I have back-ported this to 8.5.x for 8.5.43 onwards. -- 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 8.5.x updated (486e49e -> 41db6c8)
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 486e49e Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=49464 new cda33ce Fix charset name for UTF-32LE in bom detection. new 41db6c8 Remove mappings provided by the JVM 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: .../apache/tomcat/util/http/fileupload/util/mime/MimeUtility.java | 7 --- webapps/docs/changelog.xml | 3 +++ 2 files changed, 3 insertions(+), 7 deletions(-) - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] 02/02: Remove mappings provided by the JVM
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 41db6c85dfb6f704e2911fb2e41a72e6944852ae Author: Mark Thomas AuthorDate: Mon Jun 24 10:09:55 2019 +0100 Remove mappings provided by the JVM --- .../apache/tomcat/util/http/fileupload/util/mime/MimeUtility.java | 7 --- 1 file changed, 7 deletions(-) diff --git a/java/org/apache/tomcat/util/http/fileupload/util/mime/MimeUtility.java b/java/org/apache/tomcat/util/http/fileupload/util/mime/MimeUtility.java index b5b4cdd..a6200ca 100644 --- a/java/org/apache/tomcat/util/http/fileupload/util/mime/MimeUtility.java +++ b/java/org/apache/tomcat/util/http/fileupload/util/mime/MimeUtility.java @@ -68,15 +68,8 @@ public final class MimeUtility { private static final Map MIME2JAVA = new HashMap<>(); static { -MIME2JAVA.put("iso-2022-cn", "ISO2022CN"); -MIME2JAVA.put("iso-2022-kr", "ISO2022KR"); -MIME2JAVA.put("utf-8", "UTF8"); -MIME2JAVA.put("utf8", "UTF8"); MIME2JAVA.put("ja_jp.iso2022-7", "ISO2022JP"); MIME2JAVA.put("ja_jp.eucjp", "EUCJIS"); -MIME2JAVA.put("euc-kr", "KSC5601"); -MIME2JAVA.put("euckr", "KSC5601"); -MIME2JAVA.put("us-ascii", "ISO-8859-1"); MIME2JAVA.put("x-us-ascii", "ISO-8859-1"); } - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] 01/02: Fix charset name for UTF-32LE in bom detection.
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 cda33ce11b0a354b39861016bee440ad5af03c9b Author: zhanhb <6323014+zha...@users.noreply.github.com> AuthorDate: Fri Jun 21 20:42:45 2019 +0800 Fix charset name for UTF-32LE in bom detection. Patch by zhanhb vi Github. Closes #173 on Github --- webapps/docs/changelog.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 8328fb2..32c49c4 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -70,6 +70,9 @@ when the file encoding is not compatible with the required response encoding. (markt) + Fix typo in UTF-32LE charset name. Patch by zhanhb vi Github. +(fschumacher) + - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: [tomcat] 02/02: Remove mappings provided by the JVM
пн, 24 июн. 2019 г. в 15:51, : > > 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 41db6c85dfb6f704e2911fb2e41a72e6944852ae > Author: Mark Thomas > AuthorDate: Mon Jun 24 10:09:55 2019 +0100 > > Remove mappings provided by the JVM There are different JVM implementations out there. Are you sure of this change? > --- > .../apache/tomcat/util/http/fileupload/util/mime/MimeUtility.java | 7 > --- > 1 file changed, 7 deletions(-) > > diff --git > a/java/org/apache/tomcat/util/http/fileupload/util/mime/MimeUtility.java > b/java/org/apache/tomcat/util/http/fileupload/util/mime/MimeUtility.java > index b5b4cdd..a6200ca 100644 > --- a/java/org/apache/tomcat/util/http/fileupload/util/mime/MimeUtility.java > +++ b/java/org/apache/tomcat/util/http/fileupload/util/mime/MimeUtility.java > @@ -68,15 +68,8 @@ public final class MimeUtility { > private static final Map MIME2JAVA = new HashMap<>(); > > static { > -MIME2JAVA.put("iso-2022-cn", "ISO2022CN"); > -MIME2JAVA.put("iso-2022-kr", "ISO2022KR"); > -MIME2JAVA.put("utf-8", "UTF8"); > -MIME2JAVA.put("utf8", "UTF8"); > MIME2JAVA.put("ja_jp.iso2022-7", "ISO2022JP"); > MIME2JAVA.put("ja_jp.eucjp", "EUCJIS"); > -MIME2JAVA.put("euc-kr", "KSC5601"); > -MIME2JAVA.put("euckr", "KSC5601"); > -MIME2JAVA.put("us-ascii", "ISO-8859-1"); > MIME2JAVA.put("x-us-ascii", "ISO-8859-1"); > } > > > > - > To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org > For additional commands, e-mail: dev-h...@tomcat.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: Clean-up to align 8.5.x with 9.0.x
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 4b45d66 Clean-up to align 8.5.x with 9.0.x 4b45d66 is described below commit 4b45d66f423e9a7adc9aaa967e6d780813ce5fde Author: Mark Thomas AuthorDate: Mon Jun 24 14:17:35 2019 +0100 Clean-up to align 8.5.x with 9.0.x --- java/org/apache/catalina/users/MemoryGroup.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/java/org/apache/catalina/users/MemoryGroup.java b/java/org/apache/catalina/users/MemoryGroup.java index 859214b..59262c2 100644 --- a/java/org/apache/catalina/users/MemoryGroup.java +++ b/java/org/apache/catalina/users/MemoryGroup.java @@ -21,6 +21,7 @@ package org.apache.catalina.users; import java.util.ArrayList; import java.util.Iterator; +import java.util.List; import org.apache.catalina.Role; import org.apache.catalina.User; @@ -104,7 +105,7 @@ public class MemoryGroup extends AbstractGroup { */ @Override public Iterator getUsers() { -ArrayList results = new ArrayList<>(); +List results = new ArrayList<>(); Iterator users = database.getUsers(); while (users.hasNext()) { User user = users.next(); - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch master updated: Unnecessary space
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 f9ffd5b Unnecessary space f9ffd5b is described below commit f9ffd5bd26a5f864f65084169f08ebf49be59b50 Author: Mark Thomas AuthorDate: Mon Jun 24 14:27:12 2019 +0100 Unnecessary space --- java/org/apache/catalina/users/MemoryUserDatabase.java | 1 - 1 file changed, 1 deletion(-) diff --git a/java/org/apache/catalina/users/MemoryUserDatabase.java b/java/org/apache/catalina/users/MemoryUserDatabase.java index 28856b4..778a1a2 100644 --- a/java/org/apache/catalina/users/MemoryUserDatabase.java +++ b/java/org/apache/catalina/users/MemoryUserDatabase.java @@ -172,7 +172,6 @@ public class MemoryUserDatabase implements UserDatabase { } - /** * @return the unique global identifier of this user database. */ - 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: 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 The following commit(s) were added to refs/heads/8.5.x by this push: new 912d12f Clean-up. No functional change. 912d12f is described below commit 912d12fe1c49e8ba9027f5480cfbeadb523f6162 Author: Mark Thomas AuthorDate: Mon Jun 24 14:27:42 2019 +0100 Clean-up. No functional change. --- .../apache/catalina/users/MemoryUserDatabase.java | 90 +++--- 1 file changed, 26 insertions(+), 64 deletions(-) diff --git a/java/org/apache/catalina/users/MemoryUserDatabase.java b/java/org/apache/catalina/users/MemoryUserDatabase.java index 4730173..ea99d6d 100644 --- a/java/org/apache/catalina/users/MemoryUserDatabase.java +++ b/java/org/apache/catalina/users/MemoryUserDatabase.java @@ -39,20 +39,20 @@ import org.apache.tomcat.util.res.StringManager; import org.xml.sax.Attributes; /** - * Concrete implementation of {@link UserDatabase} that loads all - * defined users, groups, and roles into an in-memory data structure, - * and uses a specified XML file for its persistent storage. + * Concrete implementation of {@link UserDatabase} that loads all defined users, + * groups, and roles into an in-memory data structure, and uses a specified XML + * file for its persistent storage. * * @author Craig R. McClanahan * @since 4.1 */ public class MemoryUserDatabase implements UserDatabase { - private static final Log log = LogFactory.getLog(MemoryUserDatabase.class); +private static final StringManager sm = StringManager.getManager(MemoryUserDatabase.class); -// --- Constructors +// --- Constructors /** * Create a new instance with default values. @@ -71,73 +71,55 @@ public class MemoryUserDatabase implements UserDatabase { this.id = id; } - // - Instance Variables - /** - * The set of {@link Group}s defined in this database, keyed by - * group name. + * The set of {@link Group}s defined in this database, keyed by group name. */ -protected final HashMap groups = new HashMap<>(); - +protected final HashMap groups = new HashMap<>(); /** * The unique global identifier of this user database. */ protected final String id; - /** - * The relative (to catalina.base) or absolute pathname to - * the XML file in which we will save our persistent information. + * The relative (to catalina.base) or absolute pathname to the + * XML file in which we will save our persistent information. */ protected String pathname = "conf/tomcat-users.xml"; - /** * The relative or absolute pathname to the file in which our old * information is stored while renaming is in progress. */ protected String pathnameOld = pathname + ".old"; - /** - * The relative or absolute pathname of the file in which we write - * our new information prior to renaming. + * The relative or absolute pathname of the file in which we write our new + * information prior to renaming. */ protected String pathnameNew = pathname + ".new"; - /** * A flag, indicating if the user database is read only. */ protected boolean readonly = true; /** - * The set of {@link Role}s defined in this database, keyed by - * role name. + * The set of {@link Role}s defined in this database, keyed by role name. */ -protected final HashMap roles = new HashMap<>(); +protected final HashMap roles = new HashMap<>(); /** - * The string manager for this package. - */ -private static final StringManager sm = -StringManager.getManager(Constants.Package); - - -/** - * The set of {@link User}s defined in this database, keyed by - * user name. + * The set of {@link User}s defined in this database, keyed by user name. */ protected final HashMap users = new HashMap<>(); // - Properties - /** * @return the set of {@link Group}s defined in this user database. */ @@ -172,11 +154,9 @@ public class MemoryUserDatabase implements UserDatabase { * @param pathname The new pathname */ public void setPathname(String pathname) { - this.pathname = pathname; this.pathnameOld = pathname + ".old"; this.pathnameNew = pathname + ".new"; - } @@ -194,9 +174,7 @@ public class MemoryUserDatabase implements UserDatabase { * @param readonly the new status */ public void setReadonly(boolean readonly) { - this.readonly = readonly; - } @@ -222,10 +200,8 @@ public class MemoryUserDatab
Re: [tomcat] 02/02: Remove mappings provided by the JVM
On 24/06/2019 13:56, Konstantin Kolinko wrote: > пн, 24 июн. 2019 г. в 15:51, : >> >> 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 41db6c85dfb6f704e2911fb2e41a72e6944852ae >> Author: Mark Thomas >> AuthorDate: Mon Jun 24 10:09:55 2019 +0100 >> >> Remove mappings provided by the JVM > > There are different JVM implementations out there. Are you sure of this > change? As I can be. The mapping was created because older Sun JREs didn't support "iso-2022-cn" (the first one I tested). Not because some vendors hadn't implemented them. The original file dates back over 12 years: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-spec-javamail-1.4/src/main/java/javax/mail/internet/MimeUtility.java?annotate=421852&pathrev=421852 If you go back to Java 5 they are all known. Java 1.4 only iso-2022-cn is unknown. I'm having trouble testing with Java 1.3 (looks like a JRE install issue - not unreasonable given its age) Mark > >> --- >> .../apache/tomcat/util/http/fileupload/util/mime/MimeUtility.java | 7 >> --- >> 1 file changed, 7 deletions(-) >> >> diff --git >> a/java/org/apache/tomcat/util/http/fileupload/util/mime/MimeUtility.java >> b/java/org/apache/tomcat/util/http/fileupload/util/mime/MimeUtility.java >> index b5b4cdd..a6200ca 100644 >> --- a/java/org/apache/tomcat/util/http/fileupload/util/mime/MimeUtility.java >> +++ b/java/org/apache/tomcat/util/http/fileupload/util/mime/MimeUtility.java >> @@ -68,15 +68,8 @@ public final class MimeUtility { >> private static final Map MIME2JAVA = new HashMap<>(); >> >> static { >> -MIME2JAVA.put("iso-2022-cn", "ISO2022CN"); >> -MIME2JAVA.put("iso-2022-kr", "ISO2022KR"); >> -MIME2JAVA.put("utf-8", "UTF8"); >> -MIME2JAVA.put("utf8", "UTF8"); >> MIME2JAVA.put("ja_jp.iso2022-7", "ISO2022JP"); >> MIME2JAVA.put("ja_jp.eucjp", "EUCJIS"); >> -MIME2JAVA.put("euc-kr", "KSC5601"); >> -MIME2JAVA.put("euckr", "KSC5601"); >> -MIME2JAVA.put("us-ascii", "ISO-8859-1"); >> MIME2JAVA.put("x-us-ascii", "ISO-8859-1"); >> } >> >> >> >> - >> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org >> For additional commands, e-mail: dev-h...@tomcat.apache.org >> > > - > To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org > For additional commands, e-mail: dev-h...@tomcat.apache.org > - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: [tomcat] 02/02: Remove mappings provided by the JVM
On 24/06/2019 15:27, Mark Thomas wrote: > On 24/06/2019 13:56, Konstantin Kolinko wrote: >> пн, 24 июн. 2019 г. в 15:51, : >>> >>> 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 41db6c85dfb6f704e2911fb2e41a72e6944852ae >>> Author: Mark Thomas >>> AuthorDate: Mon Jun 24 10:09:55 2019 +0100 >>> >>> Remove mappings provided by the JVM >> >> There are different JVM implementations out there. Are you sure of this >> change? > > As I can be. The mapping was created because older Sun JREs didn't > support "iso-2022-cn" (the first one I tested). Not because some vendors > hadn't implemented them. > > The original file dates back over 12 years: > > http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-spec-javamail-1.4/src/main/java/javax/mail/internet/MimeUtility.java?annotate=421852&pathrev=421852 > > If you go back to Java 5 they are all known. > > Java 1.4 only iso-2022-cn is unknown. > > I'm having trouble testing with Java 1.3 (looks like a JRE install issue > - not unreasonable given its age) With thanks to Microsoft for providing an MSDN license so I could switch to Windows... On Java 1.3.1: iso-2022-cn - UNKNOWN iso-2022-kr - UNKNOWN utf8 - UNKNOWN Travelling even further down memory lane... On Java 1.2.2 is the same as 1.3.1 Keep in mind I am testing the latest versions of these. Earlier point releases may have had other issues. I did try 1.1.8 but that won't install on 64-bit Windows 7. But you get the idea. Mark - 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 (912d12f -> f83eae6)
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 912d12f Clean-up. No functional change. new 5090469 Clean-up. No functional change. new 0c86919 Review thread-safety Document locking strategy new f83eae6 Clean-up. No functional change. 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: .../apache/catalina/realm/UserDatabaseRealm.java | 95 .../apache/catalina/users/MemoryUserDatabase.java | 252 ++--- 2 files changed, 203 insertions(+), 144 deletions(-) - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] 01/03: 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 50904699381831df6ea6bede68f56ee288dede34 Author: Mark Thomas AuthorDate: Fri Sep 14 07:27:09 2018 + Clean-up. No functional change. --- .../apache/catalina/users/MemoryUserDatabase.java | 32 ++ 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/java/org/apache/catalina/users/MemoryUserDatabase.java b/java/org/apache/catalina/users/MemoryUserDatabase.java index ea99d6d..95fdb2f 100644 --- a/java/org/apache/catalina/users/MemoryUserDatabase.java +++ b/java/org/apache/catalina/users/MemoryUserDatabase.java @@ -111,11 +111,10 @@ public class MemoryUserDatabase implements UserDatabase { */ protected final HashMap roles = new HashMap<>(); - /** * The set of {@link User}s defined in this database, keyed by user name. */ -protected final HashMap users = new HashMap<>(); +protected final HashMap users = new HashMap<>(); // - Properties @@ -304,8 +303,8 @@ public class MemoryUserDatabase implements UserDatabase { /** - * Return the {@link Role} with the specified role name, if any; - * otherwise return null. + * Return the {@link Role} with the specified role name, if any; otherwise + * return null. * * @param rolename Name of the role to return */ @@ -318,8 +317,8 @@ public class MemoryUserDatabase implements UserDatabase { /** - * Return the {@link User} with the specified user name, if any; - * otherwise return null. + * Return the {@link User} with the specified user name, if any; otherwise + * return null. * * @param username Name of the user to return */ @@ -480,8 +479,10 @@ public class MemoryUserDatabase implements UserDatabase { // Print the file prolog writer.println(""); writer.println("http://tomcat.apache.org/xml\"";); -writer.println(" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"";); -writer.println(" xsi:schemaLocation=\"http://tomcat.apache.org/xml tomcat-users.xsd\""); +writer.print(" "); + writer.println("xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"";); +writer.print(" "); +writer.println("xsi:schemaLocation=\"http://tomcat.apache.org/xml tomcat-users.xsd\""); writer.println(" version=\"1.0\">"); // Print entries for each defined role, group, and user @@ -509,9 +510,8 @@ public class MemoryUserDatabase implements UserDatabase { if (writer.checkError()) { writer.close(); fileNew.delete(); -throw new IOException -(sm.getString("memoryUserDatabase.writeException", - fileNew.getAbsolutePath())); +throw new IOException(sm.getString("memoryUserDatabase.writeException", +fileNew.getAbsolutePath())); } writer.close(); } catch (IOException e) { @@ -536,18 +536,16 @@ public class MemoryUserDatabase implements UserDatabase { if (fileOrig.exists()) { fileOld.delete(); if (!fileOrig.renameTo(fileOld)) { -throw new IOException -(sm.getString("memoryUserDatabase.renameOld", - fileOld.getAbsolutePath())); +throw new IOException(sm.getString("memoryUserDatabase.renameOld", +fileOld.getAbsolutePath())); } } if (!fileNew.renameTo(fileOrig)) { if (fileOld.exists()) { fileOld.renameTo(fileOrig); } -throw new IOException -(sm.getString("memoryUserDatabase.renameNew", - fileOrig.getAbsolutePath())); +throw new IOException(sm.getString("memoryUserDatabase.renameNew", +fileOrig.getAbsolutePath())); } fileOld.delete(); - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] 02/03: Review thread-safety Document locking strategy
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 0c86919128fd90a4904597403c6ffe24469f78d0 Author: Mark Thomas AuthorDate: Fri Sep 14 08:41:02 2018 + Review thread-safety Document locking strategy Fix a few issues: - Iterators could throw ConcurrentModificationException - Syncs on open/save didn't lock roles Map Update with a view to supporting runtime reloading (BZ 58590) --- .../apache/catalina/users/MemoryUserDatabase.java | 222 ++--- 1 file changed, 150 insertions(+), 72 deletions(-) diff --git a/java/org/apache/catalina/users/MemoryUserDatabase.java b/java/org/apache/catalina/users/MemoryUserDatabase.java index 95fdb2f..dccfff0 100644 --- a/java/org/apache/catalina/users/MemoryUserDatabase.java +++ b/java/org/apache/catalina/users/MemoryUserDatabase.java @@ -22,8 +22,12 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStreamWriter; import java.io.PrintWriter; -import java.util.HashMap; +import java.util.ArrayList; import java.util.Iterator; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.locks.Lock; +import java.util.concurrent.locks.ReentrantReadWriteLock; import org.apache.catalina.Globals; import org.apache.catalina.Group; @@ -42,10 +46,34 @@ import org.xml.sax.Attributes; * Concrete implementation of {@link UserDatabase} that loads all defined users, * groups, and roles into an in-memory data structure, and uses a specified XML * file for its persistent storage. + * + * This class is thread-safe. + * + * This class does not enforce what, in an RDBMS, would be called referential + * integrity. Concurrent modifications may result in inconsistent data such as + * a User retaining a reference to a Role that has been removed from the + * database. * * @author Craig R. McClanahan * @since 4.1 */ +/* + * Implementation notes: + * + * Any operation that acts on a single element of the database (e.g. operations + * that create, read, update or delete a user, role or group) must first obtain + * the read lock. Operations that return iterators for users, roles or groups + * also fall into this category. + * + * Iterators must always be created from copies of the data to prevent possible + * corruption of the iterator due to the remove of all elements from the + * underlying Map that would occur during a subsequent re-loading of the + * database. + * + * Any operation that acts on multiple elements and expects the database to + * remain consistent during the operation (e.g. saving or loading the database) + * must first obtain the write lock. + */ public class MemoryUserDatabase implements UserDatabase { private static final Log log = LogFactory.getLog(MemoryUserDatabase.class); @@ -76,7 +104,7 @@ public class MemoryUserDatabase implements UserDatabase { /** * The set of {@link Group}s defined in this database, keyed by group name. */ -protected final HashMap groups = new HashMap<>(); +protected final Map groups = new ConcurrentHashMap<>(); /** * The unique global identifier of this user database. @@ -109,12 +137,16 @@ public class MemoryUserDatabase implements UserDatabase { /** * The set of {@link Role}s defined in this database, keyed by role name. */ -protected final HashMap roles = new HashMap<>(); +protected final Map roles = new ConcurrentHashMap<>(); /** * The set of {@link User}s defined in this database, keyed by user name. */ -protected final HashMap users = new HashMap<>(); +protected final Map users = new ConcurrentHashMap<>(); + +private final ReentrantReadWriteLock dbLock = new ReentrantReadWriteLock(); +private final Lock readLock = dbLock.readLock(); +private final Lock writeLock = dbLock.writeLock(); // - Properties @@ -124,8 +156,11 @@ public class MemoryUserDatabase implements UserDatabase { */ @Override public Iterator getGroups() { -synchronized (groups) { -return groups.values().iterator(); +readLock.lock(); +try { +return new ArrayList<>(groups.values()).iterator(); +} finally { +readLock.unlock(); } } @@ -182,8 +217,11 @@ public class MemoryUserDatabase implements UserDatabase { */ @Override public Iterator getRoles() { -synchronized (roles) { -return roles.values().iterator(); +readLock.lock(); +try { +return new ArrayList<>(roles.values()).iterator(); +} finally { +readLock.unlock(); } } @@ -193,8 +231,11 @@ public class MemoryUserDatabase implements UserDatabase { */ @Override public Iterator getUsers() { -
[tomcat] 03/03: 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 f83eae67d88224c05b780255b832f68ae6531ad6 Author: Mark Thomas AuthorDate: Mon Jun 24 16:42:28 2019 +0100 Clean-up. No functional change. --- .../apache/catalina/realm/UserDatabaseRealm.java | 95 +- 1 file changed, 39 insertions(+), 56 deletions(-) diff --git a/java/org/apache/catalina/realm/UserDatabaseRealm.java b/java/org/apache/catalina/realm/UserDatabaseRealm.java index 9ec96af..064ac59 100644 --- a/java/org/apache/catalina/realm/UserDatabaseRealm.java +++ b/java/org/apache/catalina/realm/UserDatabaseRealm.java @@ -14,11 +14,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - - package org.apache.catalina.realm; - import java.security.Principal; import java.util.ArrayList; import java.util.Iterator; @@ -34,31 +31,26 @@ import org.apache.catalina.UserDatabase; import org.apache.catalina.Wrapper; import org.apache.tomcat.util.ExceptionUtils; - /** - * Implementation of {@link org.apache.catalina.Realm} that is based on an implementation of - * {@link UserDatabase} made available through the global JNDI resources - * configured for this instance of Catalina. Set the resourceName - * parameter to the global JNDI resources name for the configured instance - * of UserDatabase that we should consult. + * Implementation of {@link org.apache.catalina.Realm} that is based on an + * implementation of {@link UserDatabase} made available through the global JNDI + * resources configured for this instance of Catalina. Set the + * resourceName parameter to the global JNDI resources name for the + * configured instance of UserDatabase that we should consult. * * @author Craig R. McClanahan * @since 4.1 */ -public class UserDatabaseRealm -extends RealmBase { - +public class UserDatabaseRealm extends RealmBase { // - Instance Variables - /** - * The UserDatabase we will use to authenticate users - * and identify associated roles. + * The UserDatabase we will use to authenticate users and + * identify associated roles. */ protected UserDatabase database = null; - /** * Descriptive information about this Realm implementation. * @deprecated This will be removed in Tomcat 9 onwards. @@ -68,8 +60,8 @@ public class UserDatabaseRealm /** - * The global JNDI name of the UserDatabase resource - * we will be utilizing. + * The global JNDI name of the UserDatabase resource we will be + * utilizing. */ protected String resourceName = "UserDatabase"; @@ -77,38 +69,33 @@ public class UserDatabaseRealm // - Properties /** - * @return the global JNDI name of the UserDatabase resource - * we will be using. + * @return the global JNDI name of the UserDatabase resource we + * will be using. */ public String getResourceName() { - return resourceName; - } /** - * Set the global JNDI name of the UserDatabase resource - * we will be using. + * Set the global JNDI name of the UserDatabase resource we + * will be using. * * @param resourceName The new global JNDI name */ public void setResourceName(String resourceName) { - this.resourceName = resourceName; - } // - Public Methods - /** * Return true if the specified Principal has the specified * security role, within the context of this Realm; otherwise return - * false. This implementation returns true - * if the User has the role, or if any Group - * that the User is a member of has the role. + * false. This implementation returns true if the + * User has the role, or if any Group that the + * User is a member of has the role. * * @param principal Principal for whom the role is to be checked * @param role Security role to be checked @@ -121,41 +108,41 @@ public class UserDatabaseRealm if (realRole != null) role = realRole; } -if( principal instanceof GenericPrincipal) { -GenericPrincipal gp = (GenericPrincipal)principal; -if(gp.getUserPrincipal() instanceof User) { +if (principal instanceof GenericPrincipal) { +GenericPrincipal gp = (GenericPrincipal) principal; +if (gp.getUserPrincipal() instanceof User) { principal = gp.getUserPrincipal(); } } -if(! (principal instanceof User) ) { -//Play nice with SSO and mixed Realms +if (!(principal instanceof User)) { +// Play n
[tomcat] branch 8.5.x updated (f83eae6 -> f2dfcb0)
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 f83eae6 Clean-up. No functional change. new 6901b49 Skip checkstyle for test files without ALv2 header new f2dfcb0 Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=58590 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: build.xml | 1 + .../apache/catalina/realm/UserDatabaseRealm.java | 9 ++ .../apache/catalina/users/LocalStrings.properties | 5 + .../catalina/users/LocalStrings_es.properties | 2 + .../catalina/users/LocalStrings_fr.properties | 14 +- .../catalina/users/LocalStrings_ja.properties | 12 ++ .../apache/catalina/users/MemoryUserDatabase.java | 156 +++-- .../catalina/users/MemoryUserDatabaseFactory.java | 5 + webapps/docs/changelog.xml | 7 + webapps/docs/jndi-resources-howto.xml | 8 +- 10 files changed, 177 insertions(+), 42 deletions(-) - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] 02/02: Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=58590
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 f2dfcb07f3aa00676f97e9a9da9ed4f1349e2ab2 Author: Mark Thomas AuthorDate: Mon Jun 24 18:01:31 2019 +0100 Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=58590 Add the ability for a MemoryUserDatabase to monitor the backing XML file for changes and reload the source file if a change in the last modified time is detected. This is enabled by default meaning that changes to $CATALINA_BASE/conf/tomcat-users.xml will now take effect a short time after the file is saved. --- .../apache/catalina/realm/UserDatabaseRealm.java | 9 ++ .../apache/catalina/users/LocalStrings.properties | 5 + .../catalina/users/LocalStrings_es.properties | 2 + .../catalina/users/LocalStrings_fr.properties | 14 +- .../catalina/users/LocalStrings_ja.properties | 12 ++ .../apache/catalina/users/MemoryUserDatabase.java | 156 +++-- .../catalina/users/MemoryUserDatabaseFactory.java | 5 + webapps/docs/changelog.xml | 7 + webapps/docs/jndi-resources-howto.xml | 8 +- 9 files changed, 176 insertions(+), 42 deletions(-) diff --git a/java/org/apache/catalina/realm/UserDatabaseRealm.java b/java/org/apache/catalina/realm/UserDatabaseRealm.java index 064ac59..38f8822 100644 --- a/java/org/apache/catalina/realm/UserDatabaseRealm.java +++ b/java/org/apache/catalina/realm/UserDatabaseRealm.java @@ -29,6 +29,7 @@ import org.apache.catalina.Role; import org.apache.catalina.User; import org.apache.catalina.UserDatabase; import org.apache.catalina.Wrapper; +import org.apache.catalina.users.MemoryUserDatabase; import org.apache.tomcat.util.ExceptionUtils; /** @@ -151,6 +152,14 @@ public class UserDatabaseRealm extends RealmBase { } +@Override +public void backgroundProcess() { +if (database instanceof MemoryUserDatabase) { +((MemoryUserDatabase) database).backgroundProcess(); +} +} + + /** * Return the password associated with the given principal's user name. */ diff --git a/java/org/apache/catalina/users/LocalStrings.properties b/java/org/apache/catalina/users/LocalStrings.properties index 7b76a1d..84d2754 100644 --- a/java/org/apache/catalina/users/LocalStrings.properties +++ b/java/org/apache/catalina/users/LocalStrings.properties @@ -13,13 +13,18 @@ # See the License for the specific language governing permissions and # limitations under the License. +memoryUserDatabase.fileClose=Failed to close [{0}] +memoryUserDatabase.fileDelete=Failed to delete [{0}] memoryUserDatabase.fileNotFound=The specified user database [{0}] could not be found memoryUserDatabase.notPersistable=User database is not persistable - no write permissions on directory memoryUserDatabase.nullGroup=Null or zero length group name specified. The group will be ignored. memoryUserDatabase.nullRole=Null or zero length role name specified. The role will be ignored. memoryUserDatabase.nullUser=Null or zero length user name specified. The user will be ignored. memoryUserDatabase.readOnly=User database has been configured to be read only. Changes cannot be saved +memoryUserDatabase.reload=Reloading memory user database [{0}] from updated source [{1}] +memoryUserDatabase.reloadError=Error reloading memory user database [{0}] from updated source [{1}] memoryUserDatabase.renameNew=Cannot rename new file to [{0}] memoryUserDatabase.renameOld=Cannot rename original file to [{0}] +memoryUserDatabase.restoreOrig=Cannot restore [{0}] to original file memoryUserDatabase.writeException=IOException writing to [{0}] memoryUserDatabase.xmlFeatureEncoding=Exception configuring digester to permit java encoding names in XML files. Only IANA encoding names will be supported. diff --git a/java/org/apache/catalina/users/LocalStrings_es.properties b/java/org/apache/catalina/users/LocalStrings_es.properties index 40d5426..e9ab723 100644 --- a/java/org/apache/catalina/users/LocalStrings_es.properties +++ b/java/org/apache/catalina/users/LocalStrings_es.properties @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +memoryUserDatabase.fileNotFound=El usuario de base de datos especificado [{0}] no pudo ser encontrado memoryUserDatabase.notPersistable=La base de datos de usuario no es persistible - no hay permisos de grabación sobre el directorio memoryUserDatabase.nullGroup=Se ha especificado un nombre de grupo nulo o de tamaño cero. Se ignora el grupo. memoryUserDatabase.nullRole=Se ha especificado un nombre rol nulo o de tamaño cero. Se ignora el rol. @@ -20,5 +21,6 @@ memoryUserDatabase.nullUser=Se ha especificado un nombre de usuario nulo o de ta memoryUserDatabase.readOnly=User database has been configured to be read only. Changes cann
[tomcat] 01/02: Skip checkstyle for test files without ALv2 header
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 6901b494980a02b269923fa68d5211363a018e38 Author: Mark Thomas AuthorDate: Mon Jun 24 18:04:23 2019 +0100 Skip checkstyle for test files without ALv2 header --- build.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/build.xml b/build.xml index e15d57c..ead9834 100644 --- a/build.xml +++ b/build.xml @@ -579,6 +579,7 @@ + - 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 (f2dfcb0 -> 30e983d)
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 f2dfcb0 Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=58590 new ecf9143 Use standard charset rather than (non-standard) name for UTF-8 new 30e983d Use standard form to reference UTF-8 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: java/org/apache/catalina/servlets/DefaultServlet.java | 4 ++-- java/org/apache/catalina/storeconfig/StoreLoader.java | 2 +- java/org/apache/jasper/EmbeddedServletOptions.java| 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] 02/02: Use standard form to reference UTF-8
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 30e983d787eced738330a0063dee6beb6b1ef5b2 Author: Mark Thomas AuthorDate: Mon Jun 24 10:11:29 2019 +0100 Use standard form to reference UTF-8 --- java/org/apache/catalina/storeconfig/StoreLoader.java | 2 +- java/org/apache/jasper/EmbeddedServletOptions.java| 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/java/org/apache/catalina/storeconfig/StoreLoader.java b/java/org/apache/catalina/storeconfig/StoreLoader.java index 1bf1546..5a535e1 100644 --- a/java/org/apache/catalina/storeconfig/StoreLoader.java +++ b/java/org/apache/catalina/storeconfig/StoreLoader.java @@ -32,7 +32,7 @@ import org.xml.sax.SAXException; * * * {@code - * + * *
[tomcat] 01/02: Use standard charset rather than (non-standard) name for UTF-8
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 ecf9143103b184bd996d519c4d8e454257b1cd30 Author: Mark Thomas AuthorDate: Mon Jun 24 10:11:08 2019 +0100 Use standard charset rather than (non-standard) name for UTF-8 --- java/org/apache/catalina/servlets/DefaultServlet.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/java/org/apache/catalina/servlets/DefaultServlet.java b/java/org/apache/catalina/servlets/DefaultServlet.java index c99afe1..d7fde267 100644 --- a/java/org/apache/catalina/servlets/DefaultServlet.java +++ b/java/org/apache/catalina/servlets/DefaultServlet.java @@ -1805,7 +1805,7 @@ public class DefaultServlet extends HttpServlet { Transformer transformer = tFactory.newTransformer(xsltSource); ByteArrayOutputStream stream = new ByteArrayOutputStream(); -OutputStreamWriter osWriter = new OutputStreamWriter(stream, "UTF8"); +OutputStreamWriter osWriter = new OutputStreamWriter(stream, StandardCharsets.UTF_8); StreamResult out = new StreamResult(osWriter); transformer.transform(xmlSource, out); osWriter.flush(); @@ -1880,7 +1880,7 @@ public class DefaultServlet extends HttpServlet { // Prepare a writer to a buffered area ByteArrayOutputStream stream = new ByteArrayOutputStream(); -OutputStreamWriter osWriter = new OutputStreamWriter(stream, "UTF8"); +OutputStreamWriter osWriter = new OutputStreamWriter(stream, StandardCharsets.UTF_8); PrintWriter writer = new PrintWriter(osWriter); StringBuilder sb = new StringBuilder(); - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch 7.0.x updated: Reduce the diff to 8.5.x. No functional change.
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 7.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/7.0.x by this push: new c73ad29 Reduce the diff to 8.5.x. No functional change. c73ad29 is described below commit c73ad29741b5fdaa13d7a79b9795f22108649320 Author: Mark Thomas AuthorDate: Mon Jun 24 19:41:53 2019 +0100 Reduce the diff to 8.5.x. No functional change. --- java/org/apache/catalina/servlets/CGIServlet.java | 10 +-- .../apache/catalina/servlets/DefaultServlet.java | 90 -- 2 files changed, 38 insertions(+), 62 deletions(-) diff --git a/java/org/apache/catalina/servlets/CGIServlet.java b/java/org/apache/catalina/servlets/CGIServlet.java index e64f66b..691f5ae 100644 --- a/java/org/apache/catalina/servlets/CGIServlet.java +++ b/java/org/apache/catalina/servlets/CGIServlet.java @@ -626,7 +626,7 @@ public final class CGIServlet extends HttpServlet { */ @Override protected void doGet(HttpServletRequest req, HttpServletResponse res) -throws ServletException, IOException { +throws ServletException, IOException { CGIEnvironment cgiEnv = new CGIEnvironment(req, getServletContext()); @@ -653,7 +653,7 @@ public final class CGIServlet extends HttpServlet { printServletEnvironment(req); } -} +} @Override @@ -1641,9 +1641,9 @@ public final class CGIServlet extends HttpServlet { log.debug("envp: [" + env + "], command: [" + command + "]"); } -if ((command.indexOf(File.separator + "." + File.separator) >= 0) -|| (command.indexOf(File.separator + "..") >= 0) -|| (command.indexOf(".." + File.separator) >= 0)) { +if ((command.contains(File.separator + "." + File.separator)) +|| (command.contains(File.separator + "..")) +|| (command.contains(".." + File.separator))) { throw new IOException(this.getClass().getName() + "Illegal Character in CGI command " + "path ('.' or '..') detected. Not " diff --git a/java/org/apache/catalina/servlets/DefaultServlet.java b/java/org/apache/catalina/servlets/DefaultServlet.java index 16ba71d..2ae7460 100644 --- a/java/org/apache/catalina/servlets/DefaultServlet.java +++ b/java/org/apache/catalina/servlets/DefaultServlet.java @@ -16,7 +16,6 @@ */ package org.apache.catalina.servlets; - import java.io.BufferedInputStream; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -99,7 +98,7 @@ import org.xml.sax.ext.EntityResolver2; * * * It can be mapped to sub-paths, however in all cases resources are served - * from the web appplication resource root using the full path from the root + * from the web application resource root using the full path from the root * of the web application context. * e.g. given a web application structure: * @@ -127,11 +126,15 @@ import org.xml.sax.ext.EntityResolver2; * @author Craig R. McClanahan * @author Remy Maucherat */ -public class DefaultServlet -extends HttpServlet { +public class DefaultServlet extends HttpServlet { private static final long serialVersionUID = 1L; +/** + * The string manager for this package. + */ +protected static final StringManager sm = StringManager.getManager(Constants.Package); + private static final DocumentBuilderFactory factory; private static final SecureEntityResolver secureEntityResolver; @@ -144,19 +147,16 @@ public class DefaultServlet */ protected int debug = 0; - /** * The input buffer size to use when serving resources. */ protected int input = 2048; - /** * Should we generate directory listings? */ protected boolean listings = false; - /** * Read only flag. By default, it's set to true. */ @@ -180,25 +180,21 @@ public class DefaultServlet */ protected String localXsltFile = null; - /** * Allow customized directory listing per context. */ protected String contextXsltFile = null; - /** * Allow customized directory listing per instance. */ protected String globalXsltFile = null; - /** * Allow a readme file to be included. */ protected String readmeFile = null; - /** * Proxy directory context. */ @@ -272,13 +268,6 @@ public class DefaultServlet /** - * The string manager for this package. - */ -protected static final StringManager sm = -StringManager.getManager(Constants.Package); - - -/** * Size of file transfer buffer in bytes. */ protected static final int BUFFER_SIZE = 4096; @@ -287,7 +276,6 @@ public class DefaultSe
[tomcat] branch 7.0.x updated: Use standard Java name for UTF-8
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 7.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/7.0.x by this push: new 8550ae9 Use standard Java name for UTF-8 8550ae9 is described below commit 8550ae9ae6de62d570c781f3bc9cd6095c55f4bd Author: Mark Thomas AuthorDate: Mon Jun 24 20:09:20 2019 +0100 Use standard Java name for UTF-8 --- java/org/apache/catalina/servlets/DefaultServlet.java | 4 ++-- java/org/apache/catalina/servlets/WebdavServlet.java | 2 +- java/org/apache/catalina/users/MemoryUserDatabase.java | 2 +- java/org/apache/jasper/EmbeddedServletOptions.java | 2 +- java/org/apache/tomcat/util/buf/UEncoder.java | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/java/org/apache/catalina/servlets/DefaultServlet.java b/java/org/apache/catalina/servlets/DefaultServlet.java index 2ae7460..2deb1dd 100644 --- a/java/org/apache/catalina/servlets/DefaultServlet.java +++ b/java/org/apache/catalina/servlets/DefaultServlet.java @@ -1432,7 +1432,7 @@ public class DefaultServlet extends HttpServlet { Transformer transformer = tFactory.newTransformer(xsltSource); ByteArrayOutputStream stream = new ByteArrayOutputStream(); -OutputStreamWriter osWriter = new OutputStreamWriter(stream, "UTF8"); +OutputStreamWriter osWriter = new OutputStreamWriter(stream, "UTF-8"); StreamResult out = new StreamResult(osWriter); transformer.transform(xmlSource, out); osWriter.flush(); @@ -1463,7 +1463,7 @@ public class DefaultServlet extends HttpServlet { // Prepare a writer to a buffered area ByteArrayOutputStream stream = new ByteArrayOutputStream(); -OutputStreamWriter osWriter = new OutputStreamWriter(stream, "UTF8"); +OutputStreamWriter osWriter = new OutputStreamWriter(stream, "UTF-8"); PrintWriter writer = new PrintWriter(osWriter); StringBuilder sb = new StringBuilder(); diff --git a/java/org/apache/catalina/servlets/WebdavServlet.java b/java/org/apache/catalina/servlets/WebdavServlet.java index 0a5df26..ffda8f7 100644 --- a/java/org/apache/catalina/servlets/WebdavServlet.java +++ b/java/org/apache/catalina/servlets/WebdavServlet.java @@ -1618,7 +1618,7 @@ public class WebdavServlet extends DefaultServlet { // Remove url encoding from destination destinationPath = org.apache.catalina.util.RequestUtil.URLDecode( -destinationPath, "UTF8"); +destinationPath, "UTF-8"); int protocolIndex = destinationPath.indexOf("://"); if (protocolIndex >= 0) { diff --git a/java/org/apache/catalina/users/MemoryUserDatabase.java b/java/org/apache/catalina/users/MemoryUserDatabase.java index 097954f..8e5ae25 100644 --- a/java/org/apache/catalina/users/MemoryUserDatabase.java +++ b/java/org/apache/catalina/users/MemoryUserDatabase.java @@ -547,7 +547,7 @@ public class MemoryUserDatabase implements UserDatabase { // Configure our PrintWriter FileOutputStream fos = new FileOutputStream(fileNew); -OutputStreamWriter osw = new OutputStreamWriter(fos, "UTF8"); +OutputStreamWriter osw = new OutputStreamWriter(fos, "UTF-8"); writer = new PrintWriter(osw); // Print the file prolog diff --git a/java/org/apache/jasper/EmbeddedServletOptions.java b/java/org/apache/jasper/EmbeddedServletOptions.java index 917afb3..49e798c 100644 --- a/java/org/apache/jasper/EmbeddedServletOptions.java +++ b/java/org/apache/jasper/EmbeddedServletOptions.java @@ -163,7 +163,7 @@ public final class EmbeddedServletOptions implements Options { * Java platform encoding to generate the JSP * page servlet. */ -private String javaEncoding = "UTF8"; +private String javaEncoding = "UTF-8"; /** * Modification test interval. diff --git a/java/org/apache/tomcat/util/buf/UEncoder.java b/java/org/apache/tomcat/util/buf/UEncoder.java index bad7e9e..307d50f 100644 --- a/java/org/apache/tomcat/util/buf/UEncoder.java +++ b/java/org/apache/tomcat/util/buf/UEncoder.java @@ -56,7 +56,7 @@ public final class UEncoder { private CharChunk output=null; private final boolean readOnlySafeChars; -private String encoding="UTF8"; +private String encoding="UTF-8"; public UEncoder() { this.safeChars = initialSafeChars(); - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch master updated: Fix typo
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 4aacc21 Fix typo 4aacc21 is described below commit 4aacc216938e105a49c9af6acf6ee791006d9ffc Author: Mark Thomas AuthorDate: Mon Jun 24 20:09:36 2019 +0100 Fix typo --- 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 ceba5d3..5c7275d 100644 --- a/java/org/apache/catalina/servlets/DefaultServlet.java +++ b/java/org/apache/catalina/servlets/DefaultServlet.java @@ -1372,7 +1372,7 @@ public class DefaultServlet extends HttpServlet { /** * Parse the content-range header. * - * @param request The servlet request we a)re processing + * @param request The servlet request we are processing * @param response The servlet response we are creating * @return the range object * @throws IOException an IO error occurred - 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 typo
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 c73c16e Fix typo c73c16e is described below commit c73c16e15ff20aa120c88c77d79e4ee05d8d7cdd Author: Mark Thomas AuthorDate: Mon Jun 24 20:09:44 2019 +0100 Fix typo --- 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 d7fde267..f404973 100644 --- a/java/org/apache/catalina/servlets/DefaultServlet.java +++ b/java/org/apache/catalina/servlets/DefaultServlet.java @@ -1379,7 +1379,7 @@ public class DefaultServlet extends HttpServlet { /** * Parse the content-range header. * - * @param request The servlet request we a)re processing + * @param request The servlet request we are processing * @param response The servlet response we are creating * @return the range object * @throws IOException an IO error occurred - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch master updated: Switch the check for terminal availability to test for stdin
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 988d7cc Switch the check for terminal availability to test for stdin 988d7cc is described below commit 988d7cc66ac91694dc3f804379e5537b254c3ac9 Author: Mark Thomas AuthorDate: Mon Jun 24 22:17:36 2019 +0100 Switch the check for terminal availability to test for stdin Using stdout does not work when output is piped to another process. Patch provided by Radosław Józwik. --- bin/catalina.sh| 2 +- webapps/docs/changelog.xml | 9 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/bin/catalina.sh b/bin/catalina.sh index 55fd90b..4f84d57 100755 --- a/bin/catalina.sh +++ b/bin/catalina.sh @@ -228,7 +228,7 @@ fi # Bugzilla 37848: When no TTY is available, don't output to console have_tty=0 -if [ -t 1 ]; then +if [ -t 0 ]; then have_tty=1 fi diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index d1d9477..67799fb 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -79,6 +79,15 @@ + + + +Switch the check for terminal availability to test for stdin as using +stdout does not work when output is piped to another process. Patch +provided by Radosław Józwik. (markt) + + + - 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: Switch the check for terminal availability to test for stdin
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 04bfd19 Switch the check for terminal availability to test for stdin 04bfd19 is described below commit 04bfd191d54e28199b43444867778de4348a73de Author: Mark Thomas AuthorDate: Mon Jun 24 22:17:36 2019 +0100 Switch the check for terminal availability to test for stdin Using stdout does not work when output is piped to another process. Patch provided by Radosław Józwik. --- bin/catalina.sh| 2 +- webapps/docs/changelog.xml | 5 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/bin/catalina.sh b/bin/catalina.sh index 55fd90b..4f84d57 100755 --- a/bin/catalina.sh +++ b/bin/catalina.sh @@ -228,7 +228,7 @@ fi # Bugzilla 37848: When no TTY is available, don't output to console have_tty=0 -if [ -t 1 ]; then +if [ -t 0 ]; then have_tty=1 fi diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 2385a68..6266e79 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -110,6 +110,11 @@ 63523: Restore SSLUtilBase methods as protected to preserve compatibility. (remm) + +Switch the check for terminal availability to test for stdin as using +stdout does not work when output is piped to another process. Patch +provided by Radosław Józwik. (markt) + - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch master updated: Add missing title
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 853656a Add missing title 853656a is described below commit 853656a486309009271d01a20857bce37bc5f2f8 Author: Mark Thomas AuthorDate: Mon Jun 24 22:19:58 2019 +0100 Add missing title --- webapps/docs/changelog.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 67799fb..2f77315 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -79,7 +79,7 @@ - + Switch the check for terminal availability to test for stdin as using - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch 7.0.x updated: Switch the check for terminal availability to test for stdin
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 7.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/7.0.x by this push: new 5456eab Switch the check for terminal availability to test for stdin 5456eab is described below commit 5456eab8ef2f998b86a7062a6627fadf4b2d2952 Author: Mark Thomas AuthorDate: Mon Jun 24 22:17:36 2019 +0100 Switch the check for terminal availability to test for stdin Using stdout does not work when output is piped to another process. Patch provided by Radosław Józwik. --- bin/catalina.sh| 2 +- webapps/docs/changelog.xml | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/bin/catalina.sh b/bin/catalina.sh index d479c8e..2ff3f28 100755 --- a/bin/catalina.sh +++ b/bin/catalina.sh @@ -212,7 +212,7 @@ fi # Bugzilla 37848: When no TTY is available, don't output to console have_tty=0 -if [ -t 1 ]; then +if [ -t 0 ]; then have_tty=1 fi diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index b7723c1..64db49f 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -194,7 +194,8 @@ Use the test command to check for terminal availability rather than the tty command since the tty -based test fails on non-English locales. (markt) +based test fails on non-English locales. Patch provided by Radosław +Józwik. (markt) - 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 issue #169: Use STDIN for terminal availability check
markt-asf commented on issue #169: Use STDIN for terminal availability check URL: https://github.com/apache/tomcat/pull/169#issuecomment-505186984 Thanks for catching this and providing the fix. I applied to manually so I could include a changelog entry. 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 With regards, Apache Git Services - 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 #169: Use STDIN for terminal availability check
markt-asf closed pull request #169: Use STDIN for terminal availability check URL: https://github.com/apache/tomcat/pull/169 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 With regards, Apache Git Services - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch master updated: Start a unit test for Range requests and the Default servlet
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 d4509f4 Start a unit test for Range requests and the Default servlet d4509f4 is described below commit d4509f41994473adaa8d82317c810a3c1af5b0b0 Author: Mark Thomas AuthorDate: Mon Jun 24 22:58:12 2019 +0100 Start a unit test for Range requests and the Default servlet --- .../servlets/TestDefaultServletRangeRequests.java | 92 ++ 1 file changed, 92 insertions(+) diff --git a/test/org/apache/catalina/servlets/TestDefaultServletRangeRequests.java b/test/org/apache/catalina/servlets/TestDefaultServletRangeRequests.java new file mode 100644 index 000..8459570 --- /dev/null +++ b/test/org/apache/catalina/servlets/TestDefaultServletRangeRequests.java @@ -0,0 +1,92 @@ +/* + * 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.servlets; + +import java.io.File; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameter; + +import org.apache.catalina.Context; +import org.apache.catalina.startup.Tomcat; +import org.apache.catalina.startup.TomcatBaseTest; +import org.apache.tomcat.util.buf.ByteChunk; + +@RunWith(Parameterized.class) +public class TestDefaultServletRangeRequests extends TomcatBaseTest { + +@Parameterized.Parameters +public static Collection parameters() { +List parameterSets = new ArrayList<>(); + +parameterSets.add(new Object[] { null, Integer.valueOf(200)}); +// Invalid +// Commented out as these tests currently fail +//parameterSets.add(new Object[] { buildRangeHeader("bytes"), Integer.valueOf(416)}); +//parameterSets.add(new Object[] { buildRangeHeader("bytes="), Integer.valueOf(416)}); +return parameterSets; +} + +@Parameter(0) +public Map> requestHeaders; +@Parameter(1) +public int responseCodeExpected; + +@Test +public void testRange() throws Exception { + +Tomcat tomcat = getTomcatInstance(); + +File appDir = new File("test/webapp"); +Context ctxt = tomcat.addContext("", appDir.getAbsolutePath()); + +Tomcat.addServlet(ctxt, "default", DefaultServlet.class.getName()); +ctxt.addServletMappingDecoded("/", "default"); + +tomcat.start(); + +// Set up parameters +String path = "http://localhost:"; + getPort() + "/index.html"; +ByteChunk responseBody = new ByteChunk(); +Map> responseHeaders = new HashMap<>(); + +int rc = getUrl(path, responseBody, requestHeaders, responseHeaders); + +// Check the result +Assert.assertEquals(responseCodeExpected, rc); +} + + +private static Map> buildRangeHeader(String... headerValues) { +Map> requestHeaders = new HashMap<>(); +List values = new ArrayList<>(); +for (String headerValue : headerValues) { +values.add(headerValue); +} +requestHeaders.put("range", values); + +return requestHeaders; +} +} - 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 issue #174: Clean method parseRange
markt-asf commented on issue #174: Clean method parseRange URL: https://github.com/apache/tomcat/pull/174#issuecomment-505198902 I've started to put together a unit test for this. I've committed an initial version. It is parameterised so adding additional tests should be simple. I've taken a quick look at the range parsing and I am wondering about adding a new parser to org.apache.tomcat.util.http.parser for Range headers. MediaType looks to be a reaosnable class to bse it on. 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 With regards, Apache Git Services - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[GitHub] [tomcat] zhanhb commented on issue #174: Clean method parseRange
zhanhb commented on issue #174: Clean method parseRange URL: https://github.com/apache/tomcat/pull/174#issuecomment-505220224 It's not easy for me to run a single test case now. I execute curl instead. I'll try to run single test case instead of execute command curl. 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 With regards, Apache Git Services - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[GitHub] [tomcat] zhanhb commented on issue #174: Clean method parseRange
zhanhb commented on issue #174: Clean method parseRange URL: https://github.com/apache/tomcat/pull/174#issuecomment-505224327 https://github.com/apache/tomcat/blob/54ea770e6213a7bed64ac9d90d7cfcf2dffc6a61/java/org/apache/catalina/servlets/DefaultServlet.java#L1391 How abouting chaning this line to ```java if (!rangeHeader.startsWith("bytes=")) { ``` 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 With regards, Apache Git Services - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[GitHub] [tomcat] zhanhb edited a comment on issue #174: Clean method parseRange
zhanhb edited a comment on issue #174: Clean method parseRange URL: https://github.com/apache/tomcat/pull/174#issuecomment-505224327 https://github.com/apache/tomcat/blob/54ea770e6213a7bed64ac9d90d7cfcf2dffc6a61/java/org/apache/catalina/servlets/DefaultServlet.java#L1390-L1394 How abouting chaning Line 1391 to ```java if (!rangeHeader.startsWith("bytes=")) { ``` 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 With regards, Apache Git Services - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[GitHub] [tomcat] zhanhb edited a comment on issue #174: Clean method parseRange
zhanhb edited a comment on issue #174: Clean method parseRange URL: https://github.com/apache/tomcat/pull/174#issuecomment-505224327 https://github.com/apache/tomcat/blob/54ea770e6213a7bed64ac9d90d7cfcf2dffc6a61/java/org/apache/catalina/servlets/DefaultServlet.java#L1390-L1394 How abouting chaning Line 1391 to ```java if (!rangeHeader.startsWith("bytes=")) { ``` Definition in rfc 2068 and rfc 7233 are same, syntax of request header 'Range' will always begin with that. Client should not send malformed such as 'Range: bytes 1-2' or even 'Range: bytes11-20'(we will parse that as if 'bytes=1-20' were parsed). 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 With regards, Apache Git Services - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[GitHub] [tomcat] zhanhb edited a comment on issue #174: Clean method parseRange
zhanhb edited a comment on issue #174: Clean method parseRange URL: https://github.com/apache/tomcat/pull/174#issuecomment-505224327 https://github.com/apache/tomcat/blob/54ea770e6213a7bed64ac9d90d7cfcf2dffc6a61/java/org/apache/catalina/servlets/DefaultServlet.java#L1390-L1394 How abouting chaning Line 1391 to ```java if (!rangeHeader.startsWith("bytes=")) { ``` Definition in rfc 2068 and rfc 7233 are same, syntax of request header 'Range' will always begin with that. Client should not send malformed such as 'Range: bytes 1-2' or even 'Range: bytes11-20'(we will parse that as if 'bytes=1-20'). 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 With regards, Apache Git Services - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[GitHub] [tomcat] zhanhb edited a comment on issue #174: Clean method parseRange
zhanhb edited a comment on issue #174: Clean method parseRange URL: https://github.com/apache/tomcat/pull/174#issuecomment-505224327 https://github.com/apache/tomcat/blob/54ea770e6213a7bed64ac9d90d7cfcf2dffc6a61/java/org/apache/catalina/servlets/DefaultServlet.java#L1390-L1394 How abouting chaning Line 1391 to ```java if (!rangeHeader.startsWith("bytes=")) { ``` Definition in rfc 2068 and rfc 7233 are same, syntax of request header 'Range' will always begin with that. Client should not send malformed such as 'Range: bytes 1-2' or even 'Range: bytes11-20'(we will parse that as if 'bytes=1-20' was parsed). 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 With regards, Apache Git Services - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[GitHub] [tomcat] zhanhb edited a comment on issue #174: Clean method parseRange
zhanhb edited a comment on issue #174: Clean method parseRange URL: https://github.com/apache/tomcat/pull/174#issuecomment-505224327 https://github.com/apache/tomcat/blob/54ea770e6213a7bed64ac9d90d7cfcf2dffc6a61/java/org/apache/catalina/servlets/DefaultServlet.java#L1390-L1394 How abouting chaning Line 1391 to ```java if (!rangeHeader.startsWith("bytes=")) { ``` Definition in rfc 2068 and rfc 7233 are same, syntax of request header 'Range' will always begin with that. Client should not send malformed range header such as `Range: bytes 1-2` or even `Range: bytes11-20`(we will parse that as if `bytes=1-20`). 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 With regards, Apache Git Services - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[GitHub] [tomcat] zhanhb edited a comment on issue #174: Clean method parseRange
zhanhb edited a comment on issue #174: Clean method parseRange URL: https://github.com/apache/tomcat/pull/174#issuecomment-505224327 https://github.com/apache/tomcat/blob/54ea770e6213a7bed64ac9d90d7cfcf2dffc6a61/java/org/apache/catalina/servlets/DefaultServlet.java#L1390-L1394 How abouting chaning Line 1391 to ```java if (!rangeHeader.startsWith("bytes=")) { ``` Definition in rfc 2068 and rfc 7233 are same, syntax of request header 'Range' will always begin with that. Client should not send malformed range header such as 'Range: bytes 1-2' or even 'Range: bytes11-20'(we will parse that as if 'bytes=1-20'). 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 With regards, Apache Git Services - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[GitHub] [tomcat] zhanhb edited a comment on issue #174: Clean method parseRange
zhanhb edited a comment on issue #174: Clean method parseRange URL: https://github.com/apache/tomcat/pull/174#issuecomment-505224327 https://github.com/apache/tomcat/blob/54ea770e6213a7bed64ac9d90d7cfcf2dffc6a61/java/org/apache/catalina/servlets/DefaultServlet.java#L1390-L1394 How abouting chaning Line 1391 to ```java if (!rangeHeader.startsWith("bytes=")) { ``` Definition in rfc 2068 and rfc 7233 are same, syntax of request header 'Range' will always start with that. Client should not send malformed range headers such as `Range: bytes 1-2` or even `Range: bytes11-20`(we will parse that as if `bytes=1-20`). 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 With regards, Apache Git Services - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org