[Bug 66665] New: Provide option to supply role mapping from a properties file
https://bz.apache.org/bugzilla/show_bug.cgi?id=5 Bug ID: 5 Summary: Provide option to supply role mapping from a properties file Product: Tomcat 9 Version: 9.0.76 Hardware: All OS: All Status: NEW Severity: enhancement Priority: P2 Component: Catalina Assignee: dev@tomcat.apache.org Reporter: micha...@apache.org Target Milestone: - Note: This applies to all Tomcat versions In enterprises you often use a centralized identity store where you do not have control over the group/roles names, but in your application you want to use friendly role names, e.g., 'admin', 'user', 'clerk', etc. Luckily realms utilize Context.findRoleMapping(String) indirectly, so we only need to populate those mappings. I have written such a mapping listener and would like to integrate it into upstream: https://mo-tomcat-ext.sourceforge.net/apidocs/net/sf/michaelo/tomcat/extras/listeners/PropertiesRoleMappingListener.html if there is a general interest, I guess there is. There code is straight forward: https://sourceforge.net/p/mo-tomcat-ext/code/HEAD/tree/trunk/src/main/java/net/sf/michaelo/tomcat/extras/listeners/PropertiesRoleMappingListener.java -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[Bug 66665] Provide option to supply role mapping from a properties file
https://bz.apache.org/bugzilla/show_bug.cgi?id=5 Michael Osipov changed: What|Removed |Added CC||micha...@apache.org -- 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-native] branch main updated: Replace tabs with spaces
This is an automated email from the ASF dual-hosted git repository. michaelo pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat-native.git The following commit(s) were added to refs/heads/main by this push: new f247f0af0 Replace tabs with spaces f247f0af0 is described below commit f247f0af00e17af194d183daf6239967d698e731 Author: Michael Osipov AuthorDate: Thu Jun 22 10:52:40 2023 +0200 Replace tabs with spaces --- native/include/ssl_private.h | 6 +++--- native/src/ssl.c | 4 ++-- native/src/sslcontext.c | 4 ++-- native/src/sslutils.c| 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/native/include/ssl_private.h b/native/include/ssl_private.h index 091634df2..be2397053 100644 --- a/native/include/ssl_private.h +++ b/native/include/ssl_private.h @@ -326,9 +326,9 @@ typedef struct { */ } reneg_state; enum { - PHA_NONE = 0, /* Before PHA */ - PHA_STARTED,/* PHA req sent to client but no response */ - PHA_COMPLETE/* Client has returned cert */ +PHA_NONE = 0, /* Before PHA */ +PHA_STARTED,/* PHA req sent to client but no response */ +PHA_COMPLETE/* Client has returned cert */ } pha_state; apr_socket_t *sock; apr_pollset_t *pollset; diff --git a/native/src/ssl.c b/native/src/ssl.c index a008ec44d..53ae4b4a9 100644 --- a/native/src/ssl.c +++ b/native/src/ssl.c @@ -538,7 +538,7 @@ TCN_IMPLEMENT_CALL(jint, SSL, initialize)(TCN_STDARGS, jstring engine) err = APR_ENOTIMPL; else { #ifdef ENGINE_CTRL_CHIL_SET_FORKCHECK - if (strcmp(J2S(engine), "chil") == 0) +if (strcmp(J2S(engine), "chil") == 0) ENGINE_ctrl(ee, ENGINE_CTRL_CHIL_SET_FORKCHECK, 1, 0, 0); #endif if (!ENGINE_set_default(ee, ENGINE_METHOD_ALL)) @@ -665,7 +665,7 @@ TCN_IMPLEMENT_CALL(jint, SSL, fipsModeGet)(TCN_STDARGS) if (strcmp("fips", name)) { return 0; } else { - return 1; +return 1; } #endif } diff --git a/native/src/sslcontext.c b/native/src/sslcontext.c index 9bd7e7657..7305d72ae 100644 --- a/native/src/sslcontext.c +++ b/native/src/sslcontext.c @@ -816,8 +816,8 @@ TCN_IMPLEMENT_CALL(void, SSLContext, setTmpECDHByCurveName)(TCN_STDARGS, jlong c EC_KEY_free(ecdh); TCN_FREE_CSTRING(curveName); #else - tcn_Throw(e, "Cant't configure elliptic curve: unsupported by this OpenSSL version"); - return; +tcn_Throw(e, "Cant't configure elliptic curve: unsupported by this OpenSSL version"); +return; #endif } diff --git a/native/src/sslutils.c b/native/src/sslutils.c index db4486212..2194aac11 100644 --- a/native/src/sslutils.c +++ b/native/src/sslutils.c @@ -718,7 +718,7 @@ static char **decode_OCSP_url(ASN1_OCTET_STRING *os, apr_pool_t *p) return NULL; } if (parse_ASN1_Sequence(ocsp_urls, &response, &numofresponses, p) || - numofresponses ==0) { +numofresponses ==0) { response = NULL; } return response; - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat-native] branch 1.2.x updated: Replace tabs with spaces
This is an automated email from the ASF dual-hosted git repository. michaelo pushed a commit to branch 1.2.x in repository https://gitbox.apache.org/repos/asf/tomcat-native.git The following commit(s) were added to refs/heads/1.2.x by this push: new df4c93e20 Replace tabs with spaces df4c93e20 is described below commit df4c93e205ca6f0341d54eec2d105f5400375c55 Author: Michael Osipov AuthorDate: Thu Jun 22 10:52:40 2023 +0200 Replace tabs with spaces --- native/include/ssl_private.h | 6 +++--- native/src/ssl.c | 4 ++-- native/src/sslcontext.c | 4 ++-- native/src/sslutils.c| 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/native/include/ssl_private.h b/native/include/ssl_private.h index 545022ba2..b48f7ca84 100644 --- a/native/include/ssl_private.h +++ b/native/include/ssl_private.h @@ -358,9 +358,9 @@ typedef struct { */ } reneg_state; enum { - PHA_NONE = 0, /* Before PHA */ - PHA_STARTED,/* PHA req sent to client but no response */ - PHA_COMPLETE/* Client has returned cert */ +PHA_NONE = 0, /* Before PHA */ +PHA_STARTED,/* PHA req sent to client but no response */ +PHA_COMPLETE/* Client has returned cert */ } pha_state; apr_socket_t *sock; apr_pollset_t *pollset; diff --git a/native/src/ssl.c b/native/src/ssl.c index 92414e611..31493e74f 100644 --- a/native/src/ssl.c +++ b/native/src/ssl.c @@ -817,7 +817,7 @@ TCN_IMPLEMENT_CALL(jint, SSL, initialize)(TCN_STDARGS, jstring engine) err = APR_ENOTIMPL; else { #ifdef ENGINE_CTRL_CHIL_SET_FORKCHECK - if (strcmp(J2S(engine), "chil") == 0) +if (strcmp(J2S(engine), "chil") == 0) ENGINE_ctrl(ee, ENGINE_CTRL_CHIL_SET_FORKCHECK, 1, 0, 0); #endif if (!ENGINE_set_default(ee, ENGINE_METHOD_ALL)) @@ -947,7 +947,7 @@ TCN_IMPLEMENT_CALL(jint, SSL, fipsModeGet)(TCN_STDARGS) if (strcmp("fips", name)) { return 0; } else { - return 1; +return 1; } #else UNREFERENCED(o); diff --git a/native/src/sslcontext.c b/native/src/sslcontext.c index 483446dd6..c0541bd72 100644 --- a/native/src/sslcontext.c +++ b/native/src/sslcontext.c @@ -923,8 +923,8 @@ TCN_IMPLEMENT_CALL(void, SSLContext, setTmpECDHByCurveName)(TCN_STDARGS, jlong c EC_KEY_free(ecdh); TCN_FREE_CSTRING(curveName); #else - tcn_Throw(e, "Cant't configure elliptic curve: unsupported by this OpenSSL version"); - return; +tcn_Throw(e, "Cant't configure elliptic curve: unsupported by this OpenSSL version"); +return; #endif } diff --git a/native/src/sslutils.c b/native/src/sslutils.c index c3bd41a45..619a6537e 100644 --- a/native/src/sslutils.c +++ b/native/src/sslutils.c @@ -741,7 +741,7 @@ static char **decode_OCSP_url(ASN1_OCTET_STRING *os, apr_pool_t *p) return NULL; } if (parse_ASN1_Sequence(ocsp_urls, &response, &numofresponses, p) || - numofresponses ==0) { +numofresponses ==0) { response = NULL; } return response; - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[Bug 66666] New: Remove non-reachable functions from ssl.c
https://bz.apache.org/bugzilla/show_bug.cgi?id=6 Bug ID: 6 Summary: Remove non-reachable functions from ssl.c Product: Tomcat Native Version: 2.0.2 Hardware: All OS: All Status: NEW Severity: normal Priority: P2 Component: Library Assignee: dev@tomcat.apache.org Reporter: micha...@apache.org Target Milestone: --- The following methods have been deprecated from its Java counterpart SSL.java, but have never been removed from ssl.c: @Deprecated public static native boolean randLoad(String filename); @Deprecated public static native boolean randSave(String filename); @Deprecated public static native boolean randMake(String filename, int len, boolean base64); @Deprecated public static native long newBIO(long pool, BIOCallback callback) throws Exception; @Deprecated public static native int closeBIO(long bio); @Deprecated public static native void setPasswordCallback(PasswordCallback callback); @Deprecated public static native void setPassword(String password); @Deprecated public static native String getLastError(); @Deprecated public static native boolean hasOp(int op); @Deprecated public static native void setBIO(long ssl, long rbio, long wbio); @Deprecated public static native int getError(long ssl, int ret); @Deprecated public static native void setShutdown(long ssl, int mode); @Deprecated public static native String getNextProtoNegotiated(long ssl); I believe we can safely remove the C code from ssl.c -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[Bug 66666] Remove non-reachable functions from ssl.c
https://bz.apache.org/bugzilla/show_bug.cgi?id=6 Michael Osipov changed: What|Removed |Added CC||micha...@apache.org -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[Bug 66666] Remove non-reachable functions from ssl.c
https://bz.apache.org/bugzilla/show_bug.cgi?id=6 --- Comment #1 from Michael Osipov --- As far as I can see, when setPasswordCallback() is gone typedef struct { charpassword[SSL_MAX_PASSWORD_LEN]; const char *prompt; tcn_callback_t cb; } tcn_pass_cb_t; can be reduced to typedef struct { charpassword[SSL_MAX_PASSWORD_LEN]; const char *prompt; } tcn_pass_cb_t; and the code associated with since no callback can be passed anymore from Java, the tcnative builtin callback will be used. -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch main updated: Refactor SimpleHTTPClient to read body as-is rather than via readLine()
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/main by this push: new 00e7d79d3b Refactor SimpleHTTPClient to read body as-is rather than via readLine() 00e7d79d3b is described below commit 00e7d79d3be7aedf195241a18ceca638cdb11692 Author: Mark Thomas AuthorDate: Thu Jun 22 17:08:02 2023 +0100 Refactor SimpleHTTPClient to read body as-is rather than via readLine() Update impacted tests so they still pass --- test/org/apache/catalina/core/TestStandardContext.java | 2 +- test/org/apache/catalina/startup/SimpleHttpClient.java | 16 test/org/apache/coyote/http11/TestHttp11InputBuffer.java | 2 +- test/org/apache/coyote/http11/TestHttp11Processor.java | 2 +- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/test/org/apache/catalina/core/TestStandardContext.java b/test/org/apache/catalina/core/TestStandardContext.java index cac76d1867..b35a5ad22f 100644 --- a/test/org/apache/catalina/core/TestStandardContext.java +++ b/test/org/apache/catalina/core/TestStandardContext.java @@ -704,7 +704,7 @@ public class TestStandardContext extends TomcatBaseTest { PrintWriter out = resp.getWriter(); -out.println("parts=" + (null == req.getParts() +out.print("parts=" + (null == req.getParts() ? "null" : Integer.valueOf(req.getParts().size(; } diff --git a/test/org/apache/catalina/startup/SimpleHttpClient.java b/test/org/apache/catalina/startup/SimpleHttpClient.java index bc47ada2b0..00943970d5 100644 --- a/test/org/apache/catalina/startup/SimpleHttpClient.java +++ b/test/org/apache/catalina/startup/SimpleHttpClient.java @@ -150,6 +150,13 @@ public abstract class SimpleHttpClient { return responseLine; } +public int getStatusCode() { +if (responseLine.length() < 13) { +throw new IllegalStateException(); +} +return Integer.parseInt(responseLine.substring(9, 12)); +} + public List getResponseHeaders() { return responseHeaders; } @@ -326,11 +333,12 @@ public abstract class SimpleHttpClient { builder.append(body, 0 , read); Assert.assertEquals(contentLength, builder.toString().getBytes(responseBodyEncoding).length); } else { -// not using content length, so just read it line by line -String line = null; +// Not using content length, so just read until EOF +char[] buf = new char[1024]; +int read; try { -while ((line = readLine()) != null) { -builder.append(line); +while ((read = reader.read(buf)) != -1) { +builder.append(buf, 0, read); } } catch (SocketException e) { // Ignore diff --git a/test/org/apache/coyote/http11/TestHttp11InputBuffer.java b/test/org/apache/coyote/http11/TestHttp11InputBuffer.java index 8bee3e1b2e..178b307f54 100644 --- a/test/org/apache/coyote/http11/TestHttp11InputBuffer.java +++ b/test/org/apache/coyote/http11/TestHttp11InputBuffer.java @@ -367,7 +367,7 @@ public class TestHttp11InputBuffer extends TomcatBaseTest { private void processHeaders(String header, HttpServletRequest req, PrintWriter out) { Enumeration values = req.getHeaders(header); while (values.hasMoreElements()) { -out.println(values.nextElement()); +out.print(values.nextElement()); } } } diff --git a/test/org/apache/coyote/http11/TestHttp11Processor.java b/test/org/apache/coyote/http11/TestHttp11Processor.java index b3ef4b4fa3..d2f07f7fc0 100644 --- a/test/org/apache/coyote/http11/TestHttp11Processor.java +++ b/test/org/apache/coyote/http11/TestHttp11Processor.java @@ -105,7 +105,7 @@ public class TestHttp11Processor extends TomcatBaseTest { // There should not be an end chunk Assert.assertFalse(client.getResponseBody().endsWith("0")); // The last portion of text should be there -Assert.assertTrue(client.getResponseBody().endsWith("line03")); +Assert.assertTrue(client.getResponseBody().endsWith("line03" + SimpleHttpClient.CRLF)); } private static class ResponseWithErrorServlet extends HttpServlet { - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: [tomcat] branch main updated: Refactor SimpleHTTPClient to read body as-is rather than via readLine()
On 22/06/2023 17:08, ma...@apache.org wrote: This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/main by this push: new 00e7d79d3b Refactor SimpleHTTPClient to read body as-is rather than via readLine() 00e7d79d3b is described below commit 00e7d79d3be7aedf195241a18ceca638cdb11692 Author: Mark Thomas AuthorDate: Thu Jun 22 17:08:02 2023 +0100 Refactor SimpleHTTPClient to read body as-is rather than via readLine() Update impacted tests so they still pass Tested on Linux and about to test on Windows to make sure that aren't any OS specific line ending issues. Mark - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Buildbot failure in on tomcat-11.0.x
Build status: BUILD FAILED: failed compile (failure) Worker used: bb_worker2_ubuntu URL: https://ci2.apache.org/#builders/112/builds/443 Blamelist: Mark Thomas Build Text: failed compile (failure) Status Detected: new failure Build Source Stamp: [branch main] 00e7d79d3be7aedf195241a18ceca638cdb11692 Steps: worker_preparation: 0 git: 0 shell: 0 shell_1: 0 shell_2: 0 shell_3: 0 shell_4: 0 shell_5: 0 compile: 1 shell_6: 0 shell_7: 0 shell_8: 0 shell_9: 0 Rsync docs to nightlies.apache.org: 0 shell_10: 0 Rsync RAT to nightlies.apache.org: 0 compile_1: 2 shell_11: 0 Rsync Logs to nightlies.apache.org: 0 -- ASF Buildbot - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch main updated: Fix multiple test failures on Windows.
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/main by this push: new 204afd2274 Fix multiple test failures on Windows. 204afd2274 is described below commit 204afd2274b920dcec67809580742ceceb067047 Author: Mark Thomas AuthorDate: Thu Jun 22 19:09:58 2023 +0100 Fix multiple test failures on Windows. --- java/org/apache/catalina/webresources/AbstractFileResourceSet.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/org/apache/catalina/webresources/AbstractFileResourceSet.java b/java/org/apache/catalina/webresources/AbstractFileResourceSet.java index 019bb908f4..6d7961c956 100644 --- a/java/org/apache/catalina/webresources/AbstractFileResourceSet.java +++ b/java/org/apache/catalina/webresources/AbstractFileResourceSet.java @@ -118,7 +118,7 @@ public abstract class AbstractFileResourceSet extends AbstractResourceSet { canPath = canPath.substring(canonicalBase.length()); // The remaining request path must start with '/' if it has non-zero length -if (canPath.length() > 0 && canPath.charAt(0) != '/') { +if (canPath.length() > 0 && canPath.charAt(0) != File.separatorChar) { return null; } - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch 10.1.x updated: Fix multiple test failures on Windows.
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 10.1.x in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/10.1.x by this push: new 9ea5636640 Fix multiple test failures on Windows. 9ea5636640 is described below commit 9ea5636640047ffbfdf0587b811e4e68afa28030 Author: Mark Thomas AuthorDate: Thu Jun 22 19:09:58 2023 +0100 Fix multiple test failures on Windows. --- java/org/apache/catalina/webresources/AbstractFileResourceSet.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/org/apache/catalina/webresources/AbstractFileResourceSet.java b/java/org/apache/catalina/webresources/AbstractFileResourceSet.java index 019bb908f4..6d7961c956 100644 --- a/java/org/apache/catalina/webresources/AbstractFileResourceSet.java +++ b/java/org/apache/catalina/webresources/AbstractFileResourceSet.java @@ -118,7 +118,7 @@ public abstract class AbstractFileResourceSet extends AbstractResourceSet { canPath = canPath.substring(canonicalBase.length()); // The remaining request path must start with '/' if it has non-zero length -if (canPath.length() > 0 && canPath.charAt(0) != '/') { +if (canPath.length() > 0 && canPath.charAt(0) != File.separatorChar) { return null; } - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch 9.0.x updated: Fix multiple test failures on Windows.
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/9.0.x by this push: new 3841ec8000 Fix multiple test failures on Windows. 3841ec8000 is described below commit 3841ec8000de78c527013c5d06cdb763c8fa23c7 Author: Mark Thomas AuthorDate: Thu Jun 22 19:09:58 2023 +0100 Fix multiple test failures on Windows. --- java/org/apache/catalina/webresources/AbstractFileResourceSet.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/org/apache/catalina/webresources/AbstractFileResourceSet.java b/java/org/apache/catalina/webresources/AbstractFileResourceSet.java index 019bb908f4..6d7961c956 100644 --- a/java/org/apache/catalina/webresources/AbstractFileResourceSet.java +++ b/java/org/apache/catalina/webresources/AbstractFileResourceSet.java @@ -118,7 +118,7 @@ public abstract class AbstractFileResourceSet extends AbstractResourceSet { canPath = canPath.substring(canonicalBase.length()); // The remaining request path must start with '/' if it has non-zero length -if (canPath.length() > 0 && canPath.charAt(0) != '/') { +if (canPath.length() > 0 && canPath.charAt(0) != File.separatorChar) { return null; } - 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 multiple test failures on Windows.
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 bd3844b001 Fix multiple test failures on Windows. bd3844b001 is described below commit bd3844b0014b8a79f9e0afe4372ef4867ca48957 Author: Mark Thomas AuthorDate: Thu Jun 22 19:09:58 2023 +0100 Fix multiple test failures on Windows. --- java/org/apache/catalina/webresources/AbstractFileResourceSet.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/org/apache/catalina/webresources/AbstractFileResourceSet.java b/java/org/apache/catalina/webresources/AbstractFileResourceSet.java index 019bb908f4..6d7961c956 100644 --- a/java/org/apache/catalina/webresources/AbstractFileResourceSet.java +++ b/java/org/apache/catalina/webresources/AbstractFileResourceSet.java @@ -118,7 +118,7 @@ public abstract class AbstractFileResourceSet extends AbstractResourceSet { canPath = canPath.substring(canonicalBase.length()); // The remaining request path must start with '/' if it has non-zero length -if (canPath.length() > 0 && canPath.charAt(0) != '/') { +if (canPath.length() > 0 && canPath.charAt(0) != File.separatorChar) { return null; } - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch tmp created (now e1875c1cae)
This is an automated email from the ASF dual-hosted git repository. markt pushed a change to branch tmp in repository https://gitbox.apache.org/repos/asf/tomcat.git at e1875c1cae Add tests for parsing query string parameters This branch includes the following new commits: new 944951302e Add control of byte decoding errors to ByteChunk and StringCache new 34d4ed59f5 Update Servlet API for parameter error handling changes new 61009deff1 First pass at implementing changes for parameter parsing new e1875c1cae Add tests for parsing query string parameters The 4 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. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] 04/04: Add tests for parsing query string parameters
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch tmp in repository https://gitbox.apache.org/repos/asf/tomcat.git commit e1875c1cae1c800855d738be574fa5a47d46f5d4 Author: Mark Thomas AuthorDate: Thu Jun 22 19:32:15 2023 +0100 Add tests for parsing query string parameters --- .../servlet/TestServletRequestQueryString.java | 205 + 1 file changed, 205 insertions(+) diff --git a/test/jakarta/servlet/TestServletRequestQueryString.java b/test/jakarta/servlet/TestServletRequestQueryString.java new file mode 100644 index 00..70f42d12bd --- /dev/null +++ b/test/jakarta/servlet/TestServletRequestQueryString.java @@ -0,0 +1,205 @@ +/* + * 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 jakarta.servlet; + +import java.io.IOException; +import java.io.PrintWriter; +import java.nio.charset.CodingErrorAction; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Enumeration; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import jakarta.servlet.http.HttpServlet; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; + +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 static org.apache.catalina.startup.SimpleHttpClient.CRLF; +import org.apache.catalina.core.StandardContext; +import org.apache.catalina.startup.SimpleHttpClient; +import org.apache.catalina.startup.Tomcat; +import org.apache.catalina.startup.TomcatBaseTest; + +@RunWith(Parameterized.class) +public class TestServletRequestQueryString extends TomcatBaseTest { + +private static final Integer SC_OK = Integer.valueOf(HttpServletResponse.SC_OK); +private static final Integer SC_BAD_REQUEST = Integer.valueOf(HttpServletResponse.SC_BAD_REQUEST); +private static final Integer ZERO = Integer.valueOf(0); +private static final Integer TWO = Integer.valueOf(2); +private static final Integer THREE = Integer.valueOf(3); + +@Parameterized.Parameters(name = "{index}: queryString[{1}], expectedStatusCode[{2}]") +public static Collection parameters() { +List parameterSets = new ArrayList<>(); +ParameterErrorHandlingConfiguration defaultConfig = new ParameterErrorHandlingConfiguration(); + +// Empty parameter +parameterSets.add(new Object[] { defaultConfig, "before=aaa&&after=zzz", SC_BAD_REQUEST, ZERO, null} ); +ParameterErrorHandlingConfiguration config = new ParameterErrorHandlingConfiguration(); +config.setSkipEmptyParameter(true); +parameterSets.add(new Object[] { config, "before=aaa&&after=zzz", SC_OK, TWO, null} ); + +// Invalid parameter +parameterSets.add(new Object[] { defaultConfig, "before=aaa&=value&after=zzz", SC_BAD_REQUEST, ZERO, null} ); +config = new ParameterErrorHandlingConfiguration(); +config.setSkipInvalidParameter(true); +parameterSets.add(new Object[] { config, "before=aaa&=value&after=zzz", SC_OK, TWO, null} ); + +// Invalid %nn encoding +parameterSets.add(new Object[] { defaultConfig, "before=aaa&test=val%GGue&after=zzz", SC_BAD_REQUEST, ZERO, null} ); +config = new ParameterErrorHandlingConfiguration(); +config.setSkipUrlDecodingError(true); +parameterSets.add(new Object[] { config, "before=aaa&test=val%GGue&after=zzz", SC_OK, TWO, null} ); + +// Invalid UTF-8 byte +parameterSets.add(new Object[] { defaultConfig, "before=aaa&test=val%FFue&after=zzz", SC_BAD_REQUEST, ZERO, null} ); +config = new ParameterErrorHandlingConfiguration(); +config.setSkipDecodingError(true); +config.onMalformedInput(CodingErrorAction.IGNORE); +parameterSets.add(new Object[] { config, "before=aaa&test=val%FFue&after=zzz", SC_OK, THREE, "value"} ); +config = new ParameterErrorHandlingConfiguration(); +config.setSkipDecodingError(true); +config.onMalformedInput(CodingErrorAction.REPLACE); +parameterSe
[tomcat] 01/04: Add control of byte decoding errors to ByteChunk and StringCache
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch tmp in repository https://gitbox.apache.org/repos/asf/tomcat.git commit 944951302e2f478879411dbff353f5818ad44121 Author: Mark Thomas AuthorDate: Wed Jun 14 12:25:21 2023 +0100 Add control of byte decoding errors to ByteChunk and StringCache --- java/org/apache/tomcat/util/buf/ByteChunk.java | 47 +- java/org/apache/tomcat/util/buf/StringCache.java | 66 +++--- test/org/apache/jasper/compiler/TestGenerator.java | 3 +- .../apache/tomcat/util/buf/TestStringCache.java| 100 + 4 files changed, 203 insertions(+), 13 deletions(-) diff --git a/java/org/apache/tomcat/util/buf/ByteChunk.java b/java/org/apache/tomcat/util/buf/ByteChunk.java index 101f9c0eaa..ff00f55774 100644 --- a/java/org/apache/tomcat/util/buf/ByteChunk.java +++ b/java/org/apache/tomcat/util/buf/ByteChunk.java @@ -21,7 +21,9 @@ import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.nio.ByteBuffer; import java.nio.CharBuffer; +import java.nio.charset.CharacterCodingException; import java.nio.charset.Charset; +import java.nio.charset.CodingErrorAction; import java.nio.charset.StandardCharsets; /* @@ -521,23 +523,64 @@ public final class ByteChunk extends AbstractChunk { @Override public String toString() { +try { +return toString(CodingErrorAction.REPLACE, CodingErrorAction.REPLACE); +} catch (CharacterCodingException e) { +// Unreachable code. Use of REPLACE above means the exception will never be thrown. +throw new IllegalStateException(e); +} +} + + +public String toString(CodingErrorAction malformedInputAction, CodingErrorAction unmappableCharacterAction) +throws CharacterCodingException { if (isNull()) { return null; } else if (end - start == 0) { return ""; } -return StringCache.toString(this); +return StringCache.toString(this, malformedInputAction, unmappableCharacterAction); } +/** + * Converts the current content of the byte buffer to a String using the configured character set. + * + * @return The result of converting the bytes to a String + * + * @deprecated Unused. This method will be removed in Tomcat 11 onwards. + */ +@Deprecated public String toStringInternal() { +try { +return toStringInternal(CodingErrorAction.REPLACE, CodingErrorAction.REPLACE); +} catch (CharacterCodingException e) { +// Unreachable code. Use of REPLACE above means the exception will never be thrown. +throw new IllegalStateException(e); +} +} + + +/** + * Converts the current content of the byte buffer to a String using the configured character set. + * + * @param malformedInputAction Action to take if the input is malformed + * @param unmappableCharacterAction Action to take if a byte sequence can't be mapped to a character + * + * @return The result of converting the bytes to a String + * + * @throws CharacterCodingException If an error occurs during the conversion + */ +public String toStringInternal(CodingErrorAction malformedInputAction, CodingErrorAction unmappableCharacterAction) +throws CharacterCodingException { if (charset == null) { charset = DEFAULT_CHARSET; } // new String(byte[], int, int, Charset) takes a defensive copy of the // entire byte array. This is expensive if only a small subset of the // bytes will be used. The code below is from Apache Harmony. -CharBuffer cb = charset.decode(ByteBuffer.wrap(buff, start, end - start)); +CharBuffer cb = charset.newDecoder().onMalformedInput(malformedInputAction) + .onUnmappableCharacter(unmappableCharacterAction).decode(ByteBuffer.wrap(buff, start, end - start)); return new String(cb.array(), cb.arrayOffset(), cb.length()); } diff --git a/java/org/apache/tomcat/util/buf/StringCache.java b/java/org/apache/tomcat/util/buf/StringCache.java index d39de93cfa..5b82e44f74 100644 --- a/java/org/apache/tomcat/util/buf/StringCache.java +++ b/java/org/apache/tomcat/util/buf/StringCache.java @@ -16,10 +16,13 @@ */ package org.apache.tomcat.util.buf; +import java.nio.charset.CharacterCodingException; import java.nio.charset.Charset; +import java.nio.charset.CodingErrorAction; import java.util.ArrayList; import java.util.HashMap; import java.util.Map.Entry; +import java.util.Objects; import java.util.TreeMap; import org.apache.juli.logging.Log; @@ -208,11 +211,22 @@ public class StringCache { public static String toString(ByteChunk bc) { +try { +return toString(bc, CodingErrorAction.REPLACE, CodingErrorAction.REPLACE); +} catch (C
[tomcat] 02/04: Update Servlet API for parameter error handling changes
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch tmp in repository https://gitbox.apache.org/repos/asf/tomcat.git commit 34d4ed59f50fa1eb4b373730e20bdb821f30a353 Author: Mark Thomas AuthorDate: Thu Jun 15 12:15:08 2023 +0100 Update Servlet API for parameter error handling changes --- java/jakarta/servlet/ServletRequest.java | 56 1 file changed, 56 insertions(+) diff --git a/java/jakarta/servlet/ServletRequest.java b/java/jakarta/servlet/ServletRequest.java index 795502f3b4..1e700dd900 100644 --- a/java/jakarta/servlet/ServletRequest.java +++ b/java/jakarta/servlet/ServletRequest.java @@ -162,11 +162,25 @@ public interface ServletRequest { * * If the parameter data was sent in the request body, such as occurs with an HTTP POST request, then reading the * body directly via {@link #getInputStream} or {@link #getReader} can interfere with the execution of this method. + * + * If not already parsed, calling this method will trigger the parsing of the query string, POSTed form data where + * the request body has content type is application/x-www-form-urlencoded and POSTed form data where + * the request body has content-type multipart/form-data and the Servlet is configured with a + * {@link jakarta.servlet.annotation.MultipartConfig} annotation or a multipart-config element in the + * deployment descriptor. * * @param name a String specifying the name of the parameter * * @return a String representing the single value of the parameter * + * @throws IllegalStateException if parameter parsing is triggered and a problem is encountered parsing the + * parameters including, but not limited to: invalid percent (%nn) encoding; + * invalid byte sequence for the specified character set; I/O errors reading the + * request body; and triggering a container defined limit related to parameter + * parsing. Containers may provide container specific options to handle some or + * all of these errors in an alternative manner that may include not throwing an + * exception. + * * @see #getParameterValues */ String getParameter(String name); @@ -175,9 +189,23 @@ public interface ServletRequest { * Returns an Enumeration of String objects containing the names of the parameters * contained in this request. If the request has no parameters, the method returns an empty * Enumeration. + * + * If not already parsed, calling this method will trigger the parsing of the query string, POSTed form data where + * the request body has content type is application/x-www-form-urlencoded and POSTed form data where + * the request body has content-type multipart/form-data and the Servlet is configured with a + * {@link jakarta.servlet.annotation.MultipartConfig} annotation or a multipart-config element in the + * deployment descriptor. * * @return an Enumeration of String objects, each String containing the name * of a request parameter; or an empty Enumeration if the request has no parameters + * + * @throws IllegalStateException if parameter parsing is triggered and a problem is encountered parsing the + * parameters including, but not limited to: invalid percent (%nn) encoding; + * invalid byte sequence for the specified character set; I/O errors reading the + * request body; and triggering a container defined limit related to parameter + * parsing. Containers may provide container specific options to handle some or + * all of these errors in an alternative manner that may include not throwing an + * exception. */ Enumeration getParameterNames(); @@ -186,11 +214,25 @@ public interface ServletRequest { * null if the parameter does not exist. * * If the parameter has a single value, the array has a length of 1. + * + * If not already parsed, calling this method will trigger the parsing of the query string, POSTed form data where + * the request body has content type is application/x-www-form-urlencoded and POSTed form data where + * the request body has content-type multipart/form-data and the Servlet is configured with a + * {@link jakarta.servlet.annotation.MultipartConfig} annotation or a multipart-config element in the + * deployment descriptor. * * @param name a String containing the name of the parameter whose value is request
[tomcat] 03/04: First pass at implementing changes for parameter parsing
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch tmp in repository https://gitbox.apache.org/repos/asf/tomcat.git commit 61009deff1cf542b6c555121e6af4a6baf7851b6 Author: Mark Thomas AuthorDate: Thu Jun 15 12:15:46 2023 +0100 First pass at implementing changes for parameter parsing --- java/org/apache/catalina/connector/Request.java| 31 +-- .../apache/catalina/core/StandardHostValve.java| 3 +- .../apache/catalina/core/StandardWrapperValve.java | 18 +- .../util/http/InvalidParameterException.java | 56 + .../tomcat/util/http/LocalStrings.properties | 7 +- .../tomcat/util/http/ParameterErrorHandling.java | 100 + java/org/apache/tomcat/util/http/Parameters.java | 241 ++--- 7 files changed, 313 insertions(+), 143 deletions(-) diff --git a/java/org/apache/catalina/connector/Request.java b/java/org/apache/catalina/connector/Request.java index 312b3f4e81..c0afb7553c 100644 --- a/java/org/apache/catalina/connector/Request.java +++ b/java/org/apache/catalina/connector/Request.java @@ -103,7 +103,6 @@ import org.apache.tomcat.util.buf.UDecoder; import org.apache.tomcat.util.http.CookieProcessor; import org.apache.tomcat.util.http.FastHttpDateFormat; import org.apache.tomcat.util.http.Parameters; -import org.apache.tomcat.util.http.Parameters.FailReason; import org.apache.tomcat.util.http.Rfc6265CookieProcessor; import org.apache.tomcat.util.http.ServerCookie; import org.apache.tomcat.util.http.ServerCookies; @@ -2723,7 +2722,7 @@ public class Request implements HttpServletRequest { } if (!location.isDirectory()) { - parameters.setParseFailedReason(FailReason.MULTIPART_CONFIG_INVALID); +// TODO parameters.setParseFailedReason(FailReason.MULTIPART_CONFIG_INVALID); partsParseException = new IOException(sm.getString("coyoteRequest.uploadLocationInvalid", location)); return; } @@ -2734,7 +2733,7 @@ public class Request implements HttpServletRequest { try { factory.setRepository(location.getCanonicalFile()); } catch (IOException ioe) { -parameters.setParseFailedReason(FailReason.IO_ERROR); + // TODO parameters.setParseFailedReason(FailReason.IO_ERROR); partsParseException = ioe; return; } @@ -2774,7 +2773,7 @@ public class Request implements HttpServletRequest { // Value separator postSize++; if (postSize > maxPostSize) { - parameters.setParseFailedReason(FailReason.POST_TOO_LARGE); + // TODO parameters.setParseFailedReason(FailReason.POST_TOO_LARGE); throw new IllegalStateException(sm.getString("coyoteRequest.maxPostSizeExceeded")); } } @@ -2790,14 +2789,14 @@ public class Request implements HttpServletRequest { success = true; } catch (InvalidContentTypeException e) { - parameters.setParseFailedReason(FailReason.INVALID_CONTENT_TYPE); + // TODO parameters.setParseFailedReason(FailReason.INVALID_CONTENT_TYPE); partsParseException = new ServletException(e); } catch (SizeException e) { -parameters.setParseFailedReason(FailReason.POST_TOO_LARGE); + // TODO parameters.setParseFailedReason(FailReason.POST_TOO_LARGE); checkSwallowInput(); partsParseException = new IllegalStateException(e); } catch (IOException e) { -parameters.setParseFailedReason(FailReason.IO_ERROR); + // TODO parameters.setParseFailedReason(FailReason.IO_ERROR); partsParseException = new IOException(e); } catch (IllegalStateException e) { // addParameters() will set parseFailedReason @@ -2810,7 +2809,7 @@ public class Request implements HttpServletRequest { // be more efficient but it is written this way to be robust with // respect to changes in the remainder of the method. if (partsParseException != null || !success) { -parameters.setParseFailedReason(FailReason.UNKNOWN); + // TODO parameters.setParseFailedReason(FailReason.UNKNOWN); } } } @@ -3102,7 +3101,7 @@ public class Request implements HttpServletRequest { context.getLogger().debug(sm.getString("coyoteRequest.postTooLarge")); } checkSwallowInput(); -parameters.setParseFailedReason(FailReason.POST_TOO_LARGE); + // TODO parameters.setParseFailedReason(FailReason.POST_TOO_LARGE);
[tomcat] branch tmp deleted (was e1875c1cae)
This is an automated email from the ASF dual-hosted git repository. markt pushed a change to branch tmp in repository https://gitbox.apache.org/repos/asf/tomcat.git was e1875c1cae Add tests for parsing query string parameters This change permanently discards the following revisions: discard e1875c1cae Add tests for parsing query string parameters discard 61009deff1 First pass at implementing changes for parameter parsing discard 34d4ed59f5 Update Servlet API for parameter error handling changes discard 944951302e Add control of byte decoding errors to ByteChunk and StringCache - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: [tomcat] branch tmp created (now e1875c1cae)
On 22/06/2023 19:32, ma...@apache.org wrote: This is an automated email from the ASF dual-hosted git repository. markt pushed a change to branch tmp Sorry for the noise. Pressed the wrong button in my IDE. Mark - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch main updated: Add control of byte decoding errors to ByteChunk and StringCache
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/main by this push: new 944951302e Add control of byte decoding errors to ByteChunk and StringCache 944951302e is described below commit 944951302e2f478879411dbff353f5818ad44121 Author: Mark Thomas AuthorDate: Wed Jun 14 12:25:21 2023 +0100 Add control of byte decoding errors to ByteChunk and StringCache --- java/org/apache/tomcat/util/buf/ByteChunk.java | 47 +- java/org/apache/tomcat/util/buf/StringCache.java | 66 +++--- test/org/apache/jasper/compiler/TestGenerator.java | 3 +- .../apache/tomcat/util/buf/TestStringCache.java| 100 + 4 files changed, 203 insertions(+), 13 deletions(-) diff --git a/java/org/apache/tomcat/util/buf/ByteChunk.java b/java/org/apache/tomcat/util/buf/ByteChunk.java index 101f9c0eaa..ff00f55774 100644 --- a/java/org/apache/tomcat/util/buf/ByteChunk.java +++ b/java/org/apache/tomcat/util/buf/ByteChunk.java @@ -21,7 +21,9 @@ import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.nio.ByteBuffer; import java.nio.CharBuffer; +import java.nio.charset.CharacterCodingException; import java.nio.charset.Charset; +import java.nio.charset.CodingErrorAction; import java.nio.charset.StandardCharsets; /* @@ -521,23 +523,64 @@ public final class ByteChunk extends AbstractChunk { @Override public String toString() { +try { +return toString(CodingErrorAction.REPLACE, CodingErrorAction.REPLACE); +} catch (CharacterCodingException e) { +// Unreachable code. Use of REPLACE above means the exception will never be thrown. +throw new IllegalStateException(e); +} +} + + +public String toString(CodingErrorAction malformedInputAction, CodingErrorAction unmappableCharacterAction) +throws CharacterCodingException { if (isNull()) { return null; } else if (end - start == 0) { return ""; } -return StringCache.toString(this); +return StringCache.toString(this, malformedInputAction, unmappableCharacterAction); } +/** + * Converts the current content of the byte buffer to a String using the configured character set. + * + * @return The result of converting the bytes to a String + * + * @deprecated Unused. This method will be removed in Tomcat 11 onwards. + */ +@Deprecated public String toStringInternal() { +try { +return toStringInternal(CodingErrorAction.REPLACE, CodingErrorAction.REPLACE); +} catch (CharacterCodingException e) { +// Unreachable code. Use of REPLACE above means the exception will never be thrown. +throw new IllegalStateException(e); +} +} + + +/** + * Converts the current content of the byte buffer to a String using the configured character set. + * + * @param malformedInputAction Action to take if the input is malformed + * @param unmappableCharacterAction Action to take if a byte sequence can't be mapped to a character + * + * @return The result of converting the bytes to a String + * + * @throws CharacterCodingException If an error occurs during the conversion + */ +public String toStringInternal(CodingErrorAction malformedInputAction, CodingErrorAction unmappableCharacterAction) +throws CharacterCodingException { if (charset == null) { charset = DEFAULT_CHARSET; } // new String(byte[], int, int, Charset) takes a defensive copy of the // entire byte array. This is expensive if only a small subset of the // bytes will be used. The code below is from Apache Harmony. -CharBuffer cb = charset.decode(ByteBuffer.wrap(buff, start, end - start)); +CharBuffer cb = charset.newDecoder().onMalformedInput(malformedInputAction) + .onUnmappableCharacter(unmappableCharacterAction).decode(ByteBuffer.wrap(buff, start, end - start)); return new String(cb.array(), cb.arrayOffset(), cb.length()); } diff --git a/java/org/apache/tomcat/util/buf/StringCache.java b/java/org/apache/tomcat/util/buf/StringCache.java index d39de93cfa..5b82e44f74 100644 --- a/java/org/apache/tomcat/util/buf/StringCache.java +++ b/java/org/apache/tomcat/util/buf/StringCache.java @@ -16,10 +16,13 @@ */ package org.apache.tomcat.util.buf; +import java.nio.charset.CharacterCodingException; import java.nio.charset.Charset; +import java.nio.charset.CodingErrorAction; import java.util.ArrayList; import java.util.HashMap; import java.util.Map.Entry; +import java.util.Objects; import java.util.TreeMap; import org.apache.juli.logging.Log; @@ -208,11 +211,22 @@ public class Strin
Buildbot success in on tomcat-11.0.x
Build status: Build succeeded! Worker used: bb_worker2_ubuntu URL: https://ci2.apache.org/#builders/112/builds/444 Blamelist: Mark Thomas Build Text: build successful Status Detected: restored build Build Source Stamp: [branch main] 204afd2274b920dcec67809580742ceceb067047 Steps: worker_preparation: 0 git: 0 shell: 0 shell_1: 0 shell_2: 0 shell_3: 0 shell_4: 0 shell_5: 0 compile: 1 shell_6: 0 shell_7: 0 shell_8: 0 shell_9: 0 Rsync docs to nightlies.apache.org: 0 shell_10: 0 Rsync RAT to nightlies.apache.org: 0 compile_1: 1 shell_11: 0 Rsync Logs to nightlies.apache.org: 0 -- ASF Buildbot - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: [tomcat] branch main updated: Add control of byte decoding errors to ByteChunk and StringCache
On 22/06/2023 19:55, ma...@apache.org wrote: This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/main by this push: new 944951302e Add control of byte decoding errors to ByteChunk and StringCache 944951302e is described below commit 944951302e2f478879411dbff353f5818ad44121 Author: Mark Thomas AuthorDate: Wed Jun 14 12:25:21 2023 +0100 Add control of byte decoding errors to ByteChunk and StringCache Hi all, This is the first commit in a series that I am working on that will implement a change for Servlet 6.1 that allows getParameter() and friends to throw exceptions for invalid parameters. The default for Tomcat 11 will be to throw an exception. The spec change also allows containers to provide container specific configuration to control this and what I am working on is a ParameterErrorHandlingConfiguration class that is similar to the cookie configuration that allows individual control for each of the different errors. Because this change touches ByteChunk and StringCache which are fundamental low-level classes in Tomcat's request handling I wanted to give folks plenty of time to review these changes before I backport. I plan to back-port the parameter changes as well, but with different defaults so exceptions are not thrown. Thanks, Mark - 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 a diff in pull request #628: Change style
markt-asf commented on code in PR #628: URL: https://github.com/apache/tomcat/pull/628#discussion_r1238933690 ## webapps/host-manager/css/manager.css: ## @@ -125,6 +132,16 @@ TD { vertical-align: middle; font-family : sans-serif, Tahoma, Arial; color : black; +padding : 5px; +color : #636363; Review Comment: Switching from Black to Grey reduces the contrast and makes it harder to read. I think it would be better left as black. It is also odd to have the titles stand out less than the content. ## webapps/host-manager/css/manager.css: ## @@ -138,4 +155,59 @@ form.inline { img.tomcat-logo { height: 92px; float : left; -} \ No newline at end of file +} + +input[type="submit" i] { +appearance: none; +background-color: #FAFBFC; +border: 1px solid rgba(27, 31, 35, 0.15); +border-radius: 6px; +box-shadow: rgba(27, 31, 35, 0.04) 0 1px 0, rgba(255, 255, 255, 0.25) 0 1px 0 inset; +box-sizing: border-box; +color: #24292E; +cursor: pointer; +display: inline-block; +font-size: 14px; +font-weight: 500; +line-height: 20px; +list-style: none; +padding: 6px 16px; +position: relative; +transition: background-color 0.2s cubic-bezier(0.3, 0, 0.5, 1); +user-select: none; +-webkit-user-select: none; +touch-action: manipulation; +vertical-align: middle; +white-space: nowrap; +word-wrap: break-word; +} + +input[type="submit" i]:hover { +background-color: #F3F4F6; +text-decoration: none; +transition-duration: 0.1s; +} + +input[type="submit" i]:active { +background-color: #EDEFF2; +box-shadow: rgba(225, 228, 232, 0.2) 0 1px 0 inset; +transition: none 0s; +} + Review Comment: You have trailing spaces on this line that need to be removed. If you run the build with Checkstyle enabled it will find any issues like this. ## webapps/manager/css/manager.css: ## @@ -125,6 +132,16 @@ TD { vertical-align: middle; font-family : sans-serif, Tahoma, Arial; color : black; +padding : 5px; +color : #636363; Review Comment: Same as above. ## webapps/manager/css/manager.css: ## @@ -138,4 +155,59 @@ form.inline { img.tomcat-logo { height: 92px; float : left; -} \ No newline at end of file +} + +input[type="submit" i] { +appearance: none; +background-color: #FAFBFC; +border: 1px solid rgba(27, 31, 35, 0.15); +border-radius: 6px; +box-shadow: rgba(27, 31, 35, 0.04) 0 1px 0, rgba(255, 255, 255, 0.25) 0 1px 0 inset; +box-sizing: border-box; +color: #24292E; +cursor: pointer; +display: inline-block; +font-size: 14px; +font-weight: 500; +line-height: 20px; +list-style: none; +padding: 6px 16px; +position: relative; +transition: background-color 0.2s cubic-bezier(0.3, 0, 0.5, 1); +user-select: none; +-webkit-user-select: none; +touch-action: manipulation; +vertical-align: middle; +white-space: nowrap; +word-wrap: break-word; +} + +input[type="submit" i]:hover { +background-color: #F3F4F6; +text-decoration: none; +transition-duration: 0.1s; +} + +input[type="submit" i]:active { +background-color: #EDEFF2; +box-shadow: rgba(225, 228, 232, 0.2) 0 1px 0 inset; +transition: none 0s; +} + Review Comment: Same as above -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch main updated: Code cleanup - formatting. No functional change.
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/main by this push: new 6190b10148 Code cleanup - formatting. No functional change. 6190b10148 is described below commit 6190b10148c7076eb97f2fec73849e98f5e1fb87 Author: Mark Thomas AuthorDate: Thu Jun 22 20:21:32 2023 +0100 Code cleanup - formatting. No functional change. --- .../catalina/deploy/NamingResourcesImpl.java | 235 - 1 file changed, 90 insertions(+), 145 deletions(-) diff --git a/java/org/apache/catalina/deploy/NamingResourcesImpl.java b/java/org/apache/catalina/deploy/NamingResourcesImpl.java index 37f90217e2..39fcb2853b 100644 --- a/java/org/apache/catalina/deploy/NamingResourcesImpl.java +++ b/java/org/apache/catalina/deploy/NamingResourcesImpl.java @@ -60,13 +60,11 @@ import org.apache.tomcat.util.res.StringManager; /** - * Holds and manages the naming resources defined in the Jakarta EE - * Naming Context and their associated JNDI context. + * Holds and manages the naming resources defined in the Jakarta EE Naming Context and their associated JNDI context. * * @author Remy Maucherat */ -public class NamingResourcesImpl extends LifecycleMBeanBase -implements Serializable, NamingResources { +public class NamingResourcesImpl extends LifecycleMBeanBase implements Serializable, NamingResources { private static final long serialVersionUID = 1L; @@ -105,56 +103,49 @@ public class NamingResourcesImpl extends LifecycleMBeanBase /** * The EJB resource references for this web application, keyed by name. */ -private final Map ejbs = new HashMap<>(); +private final Map ejbs = new HashMap<>(); /** * The environment entries for this web application, keyed by name. */ -private final Map envs = new HashMap<>(); +private final Map envs = new HashMap<>(); /** - * The local EJB resource references for this web application, keyed by - * name. + * The local EJB resource references for this web application, keyed by name. */ -private final Map localEjbs = new HashMap<>(); +private final Map localEjbs = new HashMap<>(); /** - * The message destination references for this web application, - * keyed by name. + * The message destination references for this web application, keyed by name. */ -private final Map mdrs = new HashMap<>(); +private final Map mdrs = new HashMap<>(); /** - * The resource environment references for this web application, - * keyed by name. + * The resource environment references for this web application, keyed by name. */ -private final HashMap resourceEnvRefs = -new HashMap<>(); +private final HashMap resourceEnvRefs = new HashMap<>(); /** * The resource references for this web application, keyed by name. */ -private final HashMap resources = -new HashMap<>(); +private final HashMap resources = new HashMap<>(); /** * The resource links for this web application, keyed by name. */ -private final HashMap resourceLinks = -new HashMap<>(); +private final HashMap resourceLinks = new HashMap<>(); /** * The web service references for this web application, keyed by name. */ -private final HashMap services = -new HashMap<>(); +private final HashMap services = new HashMap<>(); /** @@ -166,8 +157,7 @@ public class NamingResourcesImpl extends LifecycleMBeanBase /** * The property change support for this component. */ -protected final PropertyChangeSupport support = -new PropertyChangeSupport(this); +protected final PropertyChangeSupport support = new PropertyChangeSupport(this); // - Properties @@ -184,6 +174,7 @@ public class NamingResourcesImpl extends LifecycleMBeanBase /** * Set the container with which the naming resources are associated. + * * @param container the associated with the resources */ public void setContainer(Object container) { @@ -193,6 +184,7 @@ public class NamingResourcesImpl extends LifecycleMBeanBase /** * Set the transaction object. + * * @param transaction the transaction descriptor */ public void setTransaction(ContextTransaction transaction) { @@ -220,8 +212,7 @@ public class NamingResourcesImpl extends LifecycleMBeanBase String lookupName = ejb.getLookupName(); if (ejbLink != null && ejbLink.length() > 0 && lookupName != null && lookupName.length() > 0) { -throw new IllegalArgumentException( -sm.getString("namingResources.ejbLookupLink", ejb.getName())); +throw new I
[tomcat] branch 9.0.x updated: Code cleanup - formatting. No functional change.
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/9.0.x by this push: new 6eeece67ab Code cleanup - formatting. No functional change. 6eeece67ab is described below commit 6eeece67ab6f72f9fef54ab34c0de8d5037c Author: Mark Thomas AuthorDate: Thu Jun 22 20:23:17 2023 +0100 Code cleanup - formatting. No functional change. --- .../catalina/deploy/NamingResourcesImpl.java | 236 - 1 file changed, 91 insertions(+), 145 deletions(-) diff --git a/java/org/apache/catalina/deploy/NamingResourcesImpl.java b/java/org/apache/catalina/deploy/NamingResourcesImpl.java index 45c38991bf..258eb2bbd1 100644 --- a/java/org/apache/catalina/deploy/NamingResourcesImpl.java +++ b/java/org/apache/catalina/deploy/NamingResourcesImpl.java @@ -60,13 +60,12 @@ import org.apache.tomcat.util.res.StringManager; /** - * Holds and manages the naming resources defined in the J2EE Enterprise - * Naming Context and their associated JNDI context. + * Holds and manages the naming resources defined in the J2EE Enterprise Naming Context and their associated JNDI + * context. * * @author Remy Maucherat */ -public class NamingResourcesImpl extends LifecycleMBeanBase -implements Serializable, NamingResources { +public class NamingResourcesImpl extends LifecycleMBeanBase implements Serializable, NamingResources { private static final long serialVersionUID = 1L; @@ -105,56 +104,49 @@ public class NamingResourcesImpl extends LifecycleMBeanBase /** * The EJB resource references for this web application, keyed by name. */ -private final Map ejbs = new HashMap<>(); +private final Map ejbs = new HashMap<>(); /** * The environment entries for this web application, keyed by name. */ -private final Map envs = new HashMap<>(); +private final Map envs = new HashMap<>(); /** - * The local EJB resource references for this web application, keyed by - * name. + * The local EJB resource references for this web application, keyed by name. */ -private final Map localEjbs = new HashMap<>(); +private final Map localEjbs = new HashMap<>(); /** - * The message destination references for this web application, - * keyed by name. + * The message destination references for this web application, keyed by name. */ -private final Map mdrs = new HashMap<>(); +private final Map mdrs = new HashMap<>(); /** - * The resource environment references for this web application, - * keyed by name. + * The resource environment references for this web application, keyed by name. */ -private final HashMap resourceEnvRefs = -new HashMap<>(); +private final HashMap resourceEnvRefs = new HashMap<>(); /** * The resource references for this web application, keyed by name. */ -private final HashMap resources = -new HashMap<>(); +private final HashMap resources = new HashMap<>(); /** * The resource links for this web application, keyed by name. */ -private final HashMap resourceLinks = -new HashMap<>(); +private final HashMap resourceLinks = new HashMap<>(); /** * The web service references for this web application, keyed by name. */ -private final HashMap services = -new HashMap<>(); +private final HashMap services = new HashMap<>(); /** @@ -166,8 +158,7 @@ public class NamingResourcesImpl extends LifecycleMBeanBase /** * The property change support for this component. */ -protected final PropertyChangeSupport support = -new PropertyChangeSupport(this); +protected final PropertyChangeSupport support = new PropertyChangeSupport(this); // - Properties @@ -184,6 +175,7 @@ public class NamingResourcesImpl extends LifecycleMBeanBase /** * Set the container with which the naming resources are associated. + * * @param container the associated with the resources */ public void setContainer(Object container) { @@ -193,6 +185,7 @@ public class NamingResourcesImpl extends LifecycleMBeanBase /** * Set the transaction object. + * * @param transaction the transaction descriptor */ public void setTransaction(ContextTransaction transaction) { @@ -220,8 +213,7 @@ public class NamingResourcesImpl extends LifecycleMBeanBase String lookupName = ejb.getLookupName(); if (ejbLink != null && ejbLink.length() > 0 && lookupName != null && lookupName.length() > 0) { -throw new IllegalArgumentException( -sm.getString("namingResources.ejbLookupLink", ejb.getName())); +
[tomcat] branch 8.5.x updated: Code cleanup - formatting. 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 04139e7245 Code cleanup - formatting. No functional change. 04139e7245 is described below commit 04139e7245d88c33edc24bc6303901ebd28220ec Author: Mark Thomas AuthorDate: Thu Jun 22 20:23:34 2023 +0100 Code cleanup - formatting. No functional change. --- .../catalina/deploy/NamingResourcesImpl.java | 236 - 1 file changed, 91 insertions(+), 145 deletions(-) diff --git a/java/org/apache/catalina/deploy/NamingResourcesImpl.java b/java/org/apache/catalina/deploy/NamingResourcesImpl.java index 45c38991bf..258eb2bbd1 100644 --- a/java/org/apache/catalina/deploy/NamingResourcesImpl.java +++ b/java/org/apache/catalina/deploy/NamingResourcesImpl.java @@ -60,13 +60,12 @@ import org.apache.tomcat.util.res.StringManager; /** - * Holds and manages the naming resources defined in the J2EE Enterprise - * Naming Context and their associated JNDI context. + * Holds and manages the naming resources defined in the J2EE Enterprise Naming Context and their associated JNDI + * context. * * @author Remy Maucherat */ -public class NamingResourcesImpl extends LifecycleMBeanBase -implements Serializable, NamingResources { +public class NamingResourcesImpl extends LifecycleMBeanBase implements Serializable, NamingResources { private static final long serialVersionUID = 1L; @@ -105,56 +104,49 @@ public class NamingResourcesImpl extends LifecycleMBeanBase /** * The EJB resource references for this web application, keyed by name. */ -private final Map ejbs = new HashMap<>(); +private final Map ejbs = new HashMap<>(); /** * The environment entries for this web application, keyed by name. */ -private final Map envs = new HashMap<>(); +private final Map envs = new HashMap<>(); /** - * The local EJB resource references for this web application, keyed by - * name. + * The local EJB resource references for this web application, keyed by name. */ -private final Map localEjbs = new HashMap<>(); +private final Map localEjbs = new HashMap<>(); /** - * The message destination references for this web application, - * keyed by name. + * The message destination references for this web application, keyed by name. */ -private final Map mdrs = new HashMap<>(); +private final Map mdrs = new HashMap<>(); /** - * The resource environment references for this web application, - * keyed by name. + * The resource environment references for this web application, keyed by name. */ -private final HashMap resourceEnvRefs = -new HashMap<>(); +private final HashMap resourceEnvRefs = new HashMap<>(); /** * The resource references for this web application, keyed by name. */ -private final HashMap resources = -new HashMap<>(); +private final HashMap resources = new HashMap<>(); /** * The resource links for this web application, keyed by name. */ -private final HashMap resourceLinks = -new HashMap<>(); +private final HashMap resourceLinks = new HashMap<>(); /** * The web service references for this web application, keyed by name. */ -private final HashMap services = -new HashMap<>(); +private final HashMap services = new HashMap<>(); /** @@ -166,8 +158,7 @@ public class NamingResourcesImpl extends LifecycleMBeanBase /** * The property change support for this component. */ -protected final PropertyChangeSupport support = -new PropertyChangeSupport(this); +protected final PropertyChangeSupport support = new PropertyChangeSupport(this); // - Properties @@ -184,6 +175,7 @@ public class NamingResourcesImpl extends LifecycleMBeanBase /** * Set the container with which the naming resources are associated. + * * @param container the associated with the resources */ public void setContainer(Object container) { @@ -193,6 +185,7 @@ public class NamingResourcesImpl extends LifecycleMBeanBase /** * Set the transaction object. + * * @param transaction the transaction descriptor */ public void setTransaction(ContextTransaction transaction) { @@ -220,8 +213,7 @@ public class NamingResourcesImpl extends LifecycleMBeanBase String lookupName = ejb.getLookupName(); if (ejbLink != null && ejbLink.length() > 0 && lookupName != null && lookupName.length() > 0) { -throw new IllegalArgumentException( -sm.getString("namingResources.ejbLookupLink", ejb.getName())); +
[tomcat] branch 10.1.x updated: Code cleanup - formatting. No functional change.
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 10.1.x in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/10.1.x by this push: new 2ff35f2bc8 Code cleanup - formatting. No functional change. 2ff35f2bc8 is described below commit 2ff35f2bc8f52702ebbf85323714343cfd236e1c Author: Mark Thomas AuthorDate: Thu Jun 22 20:22:57 2023 +0100 Code cleanup - formatting. No functional change. --- .../catalina/deploy/NamingResourcesImpl.java | 235 - 1 file changed, 90 insertions(+), 145 deletions(-) diff --git a/java/org/apache/catalina/deploy/NamingResourcesImpl.java b/java/org/apache/catalina/deploy/NamingResourcesImpl.java index 1000fc5846..03c660db02 100644 --- a/java/org/apache/catalina/deploy/NamingResourcesImpl.java +++ b/java/org/apache/catalina/deploy/NamingResourcesImpl.java @@ -60,13 +60,11 @@ import org.apache.tomcat.util.res.StringManager; /** - * Holds and manages the naming resources defined in the Jakarta EE - * Naming Context and their associated JNDI context. + * Holds and manages the naming resources defined in the Jakarta EE Naming Context and their associated JNDI context. * * @author Remy Maucherat */ -public class NamingResourcesImpl extends LifecycleMBeanBase -implements Serializable, NamingResources { +public class NamingResourcesImpl extends LifecycleMBeanBase implements Serializable, NamingResources { private static final long serialVersionUID = 1L; @@ -105,56 +103,49 @@ public class NamingResourcesImpl extends LifecycleMBeanBase /** * The EJB resource references for this web application, keyed by name. */ -private final Map ejbs = new HashMap<>(); +private final Map ejbs = new HashMap<>(); /** * The environment entries for this web application, keyed by name. */ -private final Map envs = new HashMap<>(); +private final Map envs = new HashMap<>(); /** - * The local EJB resource references for this web application, keyed by - * name. + * The local EJB resource references for this web application, keyed by name. */ -private final Map localEjbs = new HashMap<>(); +private final Map localEjbs = new HashMap<>(); /** - * The message destination references for this web application, - * keyed by name. + * The message destination references for this web application, keyed by name. */ -private final Map mdrs = new HashMap<>(); +private final Map mdrs = new HashMap<>(); /** - * The resource environment references for this web application, - * keyed by name. + * The resource environment references for this web application, keyed by name. */ -private final HashMap resourceEnvRefs = -new HashMap<>(); +private final HashMap resourceEnvRefs = new HashMap<>(); /** * The resource references for this web application, keyed by name. */ -private final HashMap resources = -new HashMap<>(); +private final HashMap resources = new HashMap<>(); /** * The resource links for this web application, keyed by name. */ -private final HashMap resourceLinks = -new HashMap<>(); +private final HashMap resourceLinks = new HashMap<>(); /** * The web service references for this web application, keyed by name. */ -private final HashMap services = -new HashMap<>(); +private final HashMap services = new HashMap<>(); /** @@ -166,8 +157,7 @@ public class NamingResourcesImpl extends LifecycleMBeanBase /** * The property change support for this component. */ -protected final PropertyChangeSupport support = -new PropertyChangeSupport(this); +protected final PropertyChangeSupport support = new PropertyChangeSupport(this); // - Properties @@ -184,6 +174,7 @@ public class NamingResourcesImpl extends LifecycleMBeanBase /** * Set the container with which the naming resources are associated. + * * @param container the associated with the resources */ public void setContainer(Object container) { @@ -193,6 +184,7 @@ public class NamingResourcesImpl extends LifecycleMBeanBase /** * Set the transaction object. + * * @param transaction the transaction descriptor */ public void setTransaction(ContextTransaction transaction) { @@ -220,8 +212,7 @@ public class NamingResourcesImpl extends LifecycleMBeanBase String lookupName = ejb.getLookupName(); if (ejbLink != null && ejbLink.length() > 0 && lookupName != null && lookupName.length() > 0) { -throw new IllegalArgumentException( -sm.getString("namingResources.ejbLookupLink", ejb.getName())); +throw ne
[Bug 66666] Remove non-reachable functions from ssl.c
https://bz.apache.org/bugzilla/show_bug.cgi?id=6 Christopher Schultz changed: What|Removed |Added Status|NEW |NEEDINFO --- Comment #2 from Christopher Schultz --- We have been hesitant to remove things from tcnative even if they are not used by the Java components. Some (unspecified) downstream users may be relying on these "extraneous" functions. Are you proposing that these be removed from tcnative 2.x or also from 1.2.x? I would support removing them from 2.x but maybe not 1.2.x. -- 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
Re: [tomcat] branch main updated: Refactor SimpleHTTPClient to read body as-is rather than via readLine()
Mark, On 6/22/23 12:09, Mark Thomas wrote: On 22/06/2023 17:08, ma...@apache.org wrote: This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/main by this push: new 00e7d79d3b Refactor SimpleHTTPClient to read body as-is rather than via readLine() 00e7d79d3b is described below commit 00e7d79d3be7aedf195241a18ceca638cdb11692 Author: Mark Thomas AuthorDate: Thu Jun 22 17:08:02 2023 +0100 Refactor SimpleHTTPClient to read body as-is rather than via readLine() Update impacted tests so they still pass Tested on Linux and about to test on Windows to make sure that aren't any OS specific line ending issues. I would have expected this patch to /fix/ any OS-specific line-ending issues rather than introducing any new ones. +1 to not modifying the entity in any way. LGTM. --- a/test/org/apache/catalina/startup/SimpleHttpClient.java +++ b/test/org/apache/catalina/startup/SimpleHttpClient.java @@ -150,6 +150,13 @@ public abstract class SimpleHttpClient { return responseLine; } +public int getStatusCode() { +if (responseLine.length() < 13) { +throw new IllegalStateException(); +} +return Integer.parseInt(responseLine.substring(9, 12)); +} + This seems fragile. I know the only major versions of HTTP so far have been 0.9, 1.0, 1.1, and 2(.0) which doesn't use text-based status-lines, but a spec-compliant parser would have to grab everything in between the first and second spaces on the line. https://datatracker.ietf.org/doc/html/rfc2616#section-3.1 I'm perfectly happy to have you say "we'll fix it if it ever breaks" but I know sometimes you have to balance your desire to be spec-compliant with your desire to not have to do stupid things. :) -chris - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org