[Bug 65124] Inefficient generated JSP code

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

--- Comment #16 from Mark Thomas  ---
My expectation was that you'd use the plug-in mechanism to implement the
optimisation for  described in issue 1.

If you want to provide a generic optimisation to multiple/all tags then that
probably won't scale in your use case as you'd have to predefine the plugin
mapping for each tag class. I'm also not sure the current API exposes enough
information for a generic, rather than tag specific, solution.

I'll take another look at issue 1 but I'd like to check my understanding of the
generic problem first. Is this correct:

Where:
- multiple, non-pooled instances of the same tag are used in a JSP
- the tags do not have a body
- the tags have the same, single attribute set although the attribute may have
different values for each tag instance

then generate a single, parameterised method to be used for all tag instances
rather than 1 method per tag instance?

-- 
You are receiving this mail because:
You are the assignee for the bug.
-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[GitHub] [tomcat-jakartaee-migration] rmaucher commented on issue #20: Skipping files

2021-05-20 Thread GitBox


rmaucher commented on issue #20:
URL: 
https://github.com/apache/tomcat-jakartaee-migration/issues/20#issuecomment-844881012


   Since -zipInMemory worked as a workaround, I changed the default code path 
to use commons-compression instead of the Java code. It seems to me it has good 
results. Can you test the tool with the defaults again on your compressed war 
that caused the issue ? Can you also check if the performance is better (or 
worse) than before ?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



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



[GitHub] [tomcat-jakartaee-migration] ShamithaSIlva commented on issue #20: Skipping files

2021-05-20 Thread GitBox


ShamithaSIlva commented on issue #20:
URL: 
https://github.com/apache/tomcat-jakartaee-migration/issues/20#issuecomment-844891004


   > Since -zipInMemory worked as a workaround, I changed the default code path 
to use commons-compression instead of the Java code. It seems to me it has good 
results. Can you test the tool with the defaults again on your compressed war 
that caused the issue ? Can you also check if the performance is better (or 
worse) than before ?
   
   We are no longer migrating but I'm getting this exception now:
   Migration starting for archive [sm-api.war] using streaming
   Migration starting for archive [WEB-INF/lib/jdbc-4.1.0.jar] using streaming
   Drop cryptographic signature file [META-INF/MSFTSIG.SF]
   Drop cryptographic signature file [META-INF/MSFTSIG.RSA]
   Exception in thread "main" java.io.IOException: This archive contains 
unclosed entries.
   at 
org.apache.tomcat.jakartaee.commons.compress.archivers.zip.ZipArchiveOutputStream.finish(ZipArchiveOutputStream.java:521)
   at 
org.apache.tomcat.jakartaee.commons.compress.archivers.zip.ZipArchiveOutputStream.close(ZipArchiveOutputStream.java:1046)
   at 
org.apache.tomcat.jakartaee.commons.compress.archivers.zip.ZipArchiveOutputStream.destroy(ZipArchiveOutputStream.java:1844)
   at 
org.apache.tomcat.jakartaee.commons.compress.archivers.zip.ZipArchiveOutputStream.close(ZipArchiveOutputStream.java:1049)
   at 
org.apache.tomcat.jakartaee.Migration.migrateArchiveStreaming(Migration.java:228)
   at 
org.apache.tomcat.jakartaee.Migration.migrateStream(Migration.java:283)
   at 
org.apache.tomcat.jakartaee.Migration.migrateArchiveStreaming(Migration.java:225)
   at 
org.apache.tomcat.jakartaee.Migration.migrateStream(Migration.java:283)
   at 
org.apache.tomcat.jakartaee.Migration.migrateFile(Migration.java:195)
   at org.apache.tomcat.jakartaee.Migration.execute(Migration.java:161)
   at 
org.apache.tomcat.jakartaee.MigrationCLI.main(MigrationCLI.java:94)
   Suppressed: java.io.IOException: This archive contains unclosed 
entries.
   at 
org.apache.tomcat.jakartaee.commons.compress.archivers.zip.ZipArchiveOutputStream.finish(ZipArchiveOutputStream.java:521)
   at 
org.apache.tomcat.jakartaee.commons.compress.archivers.zip.ZipArchiveOutputStream.close(ZipArchiveOutputStream.java:1046)
   at 
org.apache.tomcat.jakartaee.Migration.migrateArchiveStreaming(Migration.java:228)
   ... 4 more


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



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



[GitHub] [tomcat-jakartaee-migration] rmaucher commented on issue #20: Skipping files

2021-05-20 Thread GitBox


rmaucher commented on issue #20:
URL: 
https://github.com/apache/tomcat-jakartaee-migration/issues/20#issuecomment-844905756


   Ok, all the entries are supposed to be properly closed (calling 
closeArchiveEntry). If I cannot figure it out, I'll revert but most likely 
migrateArchiveInMemory has the same problem (the code is too similar).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



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



[tomcat-jakartaee-migration] branch master updated: Fix handling of nested archives

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

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


The following commit(s) were added to refs/heads/master by this push:
 new eabb165  Fix handling of nested archives
eabb165 is described below

commit eabb165632163890a36db0c4369cda2dc7d9be9f
Author: remm 
AuthorDate: Thu May 20 11:43:20 2021 +0200

Fix handling of nested archives
---
 src/main/java/org/apache/tomcat/jakartaee/Migration.java | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/tomcat/jakartaee/Migration.java 
b/src/main/java/org/apache/tomcat/jakartaee/Migration.java
index 097c04e..f9a45c0 100644
--- a/src/main/java/org/apache/tomcat/jakartaee/Migration.java
+++ b/src/main/java/org/apache/tomcat/jakartaee/Migration.java
@@ -40,6 +40,8 @@ import 
org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream;
 import org.apache.commons.compress.archivers.zip.ZipFile;
 import org.apache.commons.compress.utils.SeekableInMemoryByteChannel;
 import org.apache.commons.io.IOUtils;
+import org.apache.commons.io.input.CloseShieldInputStream;
+import org.apache.commons.io.output.CloseShieldOutputStream;
 
 public class Migration {
 
@@ -209,8 +211,8 @@ public class Migration {
 
 
 private void migrateArchiveStreaming(String name, InputStream src, 
OutputStream dest) throws IOException {
-try (ZipArchiveInputStream srcZipStream = new 
ZipArchiveInputStream(src);
-ZipArchiveOutputStream destZipStream = new 
ZipArchiveOutputStream(dest)) {
+try (ZipArchiveInputStream srcZipStream = new 
ZipArchiveInputStream(new CloseShieldInputStream(src));
+ZipArchiveOutputStream destZipStream = new 
ZipArchiveOutputStream(new CloseShieldOutputStream(dest))) {
 ZipArchiveEntry srcZipEntry;
 while ((srcZipEntry = srcZipStream.getNextZipEntry()) != null) {
 String srcName = srcZipEntry.getName();

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



[GitHub] [tomcat-jakartaee-migration] rmaucher commented on issue #20: Skipping files

2021-05-20 Thread GitBox


rmaucher commented on issue #20:
URL: 
https://github.com/apache/tomcat-jakartaee-migration/issues/20#issuecomment-844946443


   This should now be fixed.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



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



[tomcat] branch master updated: Improve docs for maxConnections and acceptCount

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

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


The following commit(s) were added to refs/heads/master by this push:
 new d4b0576  Improve docs for maxConnections and acceptCount
d4b0576 is described below

commit d4b05768796b29fc25bf853b44fcf36bb04e114c
Author: Mark Thomas 
AuthorDate: Thu May 20 11:28:45 2021 +0100

Improve docs for maxConnections and acceptCount
---
 webapps/docs/changelog.xml   |  9 +
 webapps/docs/config/ajp.xml  |  8 +---
 webapps/docs/config/http.xml | 31 ++-
 3 files changed, 32 insertions(+), 16 deletions(-)

diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index d127949..c7e7cc9 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -152,6 +152,15 @@
   
 
   
+  
+
+  
+Improve the description of the maxConnections and
+acceptCount attributes in the Connector section of the
+documentation web application. (markt)
+  
+
+  
 
 
   
diff --git a/webapps/docs/config/ajp.xml b/webapps/docs/config/ajp.xml
index 2d9aec8..1b678cd 100644
--- a/webapps/docs/config/ajp.xml
+++ b/webapps/docs/config/ajp.xml
@@ -295,9 +295,11 @@
   
 
 
-  The maximum queue length for incoming connection requests when
-  all possible request processing threads are in use.  Any requests
-  received when the queue is full will be refused.  The default
+  The maximum length of the operating system provided queue for incoming
+  connection requests when maxConnections has been reached. 
The
+  operating system may ignore this setting and use a different size for the
+  queue. When this queue is full, the operating system may actively refuse
+  additional connections or those connections may time out. The default
   value is 100.
 
 
diff --git a/webapps/docs/config/http.xml b/webapps/docs/config/http.xml
index 93af99b..b51a0d0 100644
--- a/webapps/docs/config/http.xml
+++ b/webapps/docs/config/http.xml
@@ -54,16 +54,19 @@
   mod_jk 1.2.x connector for Apache 1.3), please refer to the
   AJP Connector documentation.
 
-  Each incoming request requires
-  a thread for the duration of that request.  If more simultaneous requests
-  are received than can be handled by the currently available request
-  processing threads, additional threads will be created up to the
-  configured maximum (the value of the maxThreads attribute).
-  If still more simultaneous requests are received, they are stacked up
-  inside the server socket created by the Connector, up to
-  the configured maximum (the value of the acceptCount
-  attribute).  Any further simultaneous requests will receive "connection
-  refused" errors, until resources are available to process them.
+  Each incoming, non-asynchronous request requires a thread for the duration
+  of that request.  If more simultaneous requests are received than can be
+  handled by the currently available request processing threads, additional
+  threads will be created up to the configured maximum (the value of the
+  maxThreads attribute). If still more simultaneous requests are
+  received, Tomcat will accept new connections until the current number of
+  connections reaches maxConnections. Connections are queued 
inside
+  the server socket created by the Connector until a thread
+  becomes avaialble to process the connection. Once maxConnections
+  has been reached the operating system will queue further connections. The 
size
+  of the  operating system provided connection queue may be controlled by the
+  acceptCount attribute. If the operating system queue fills,
+  further connection requests may be refused or may time out.
 
 
 
@@ -331,9 +334,11 @@
   
 
 
-  The maximum queue length for incoming connection requests when
-  all possible request processing threads are in use.  Any requests
-  received when the queue is full will be refused.  The default
+  The maximum length of the operating system provided queue for incoming
+  connection requests when maxConnections has been reached. 
The
+  operating system may ignore this setting and use a different size for the
+  queue. When this queue is full, the operating system may actively refuse
+  additional connections or those connections may time out. The default
   value is 100.
 
 

-
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: Improve docs for maxConnections and acceptCount

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

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


The following commit(s) were added to refs/heads/8.5.x by this push:
 new dc20584  Improve docs for maxConnections and acceptCount
dc20584 is described below

commit dc205847ed10aeac0d2defceefd986eb153a7bf0
Author: Mark Thomas 
AuthorDate: Thu May 20 11:28:45 2021 +0100

Improve docs for maxConnections and acceptCount
---
 webapps/docs/changelog.xml   |  9 +
 webapps/docs/config/ajp.xml  |  8 +---
 webapps/docs/config/http.xml | 31 ++-
 3 files changed, 32 insertions(+), 16 deletions(-)

diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index cf8fa0a..8863b76 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -152,6 +152,15 @@
   
 
   
+  
+
+  
+Improve the description of the maxConnections and
+acceptCount attributes in the Connector section of the
+documentation web application. (markt)
+  
+
+  
 
 
   
diff --git a/webapps/docs/config/ajp.xml b/webapps/docs/config/ajp.xml
index b7afdd4..de88e29 100644
--- a/webapps/docs/config/ajp.xml
+++ b/webapps/docs/config/ajp.xml
@@ -313,9 +313,11 @@
   
 
 
-  The maximum queue length for incoming connection requests when
-  all possible request processing threads are in use.  Any requests
-  received when the queue is full will be refused.  The default
+  The maximum length of the operating system provided queue for incoming
+  connection requests when maxConnections has been reached. 
The
+  operating system may ignore this setting and use a different size for the
+  queue. When this queue is full, the operating system may actively refuse
+  additional connections or those connections may time out. The default
   value is 100.
 
 
diff --git a/webapps/docs/config/http.xml b/webapps/docs/config/http.xml
index 5239a36..11ab1f1 100644
--- a/webapps/docs/config/http.xml
+++ b/webapps/docs/config/http.xml
@@ -51,16 +51,19 @@
   mod_jk 1.2.x connector for Apache 1.3), please refer to the
   AJP Connector documentation.
 
-  Each incoming request requires
-  a thread for the duration of that request.  If more simultaneous requests
-  are received than can be handled by the currently available request
-  processing threads, additional threads will be created up to the
-  configured maximum (the value of the maxThreads attribute).
-  If still more simultaneous requests are received, they are stacked up
-  inside the server socket created by the Connector, up to
-  the configured maximum (the value of the acceptCount
-  attribute).  Any further simultaneous requests will receive "connection
-  refused" errors, until resources are available to process them.
+  Each incoming, non-asynchronous request requires a thread for the duration
+  of that request.  If more simultaneous requests are received than can be
+  handled by the currently available request processing threads, additional
+  threads will be created up to the configured maximum (the value of the
+  maxThreads attribute). If still more simultaneous requests are
+  received, Tomcat will accept new connections until the current number of
+  connections reaches maxConnections. Connections are queued 
inside
+  the server socket created by the Connector until a thread
+  becomes avaialble to process the connection. Once maxConnections
+  has been reached the operating system will queue further connections. The 
size
+  of the  operating system provided connection queue may be controlled by the
+  acceptCount attribute. If the operating system queue fills,
+  further connection requests may be refused or may time out.
 
 
 
@@ -338,9 +341,11 @@
   
 
 
-  The maximum queue length for incoming connection requests when
-  all possible request processing threads are in use.  Any requests
-  received when the queue is full will be refused.  The default
+  The maximum length of the operating system provided queue for incoming
+  connection requests when maxConnections has been reached. 
The
+  operating system may ignore this setting and use a different size for the
+  queue. When this queue is full, the operating system may actively refuse
+  additional connections or those connections may time out. The default
   value is 100.
 
 

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



[tomcat] branch 9.0.x updated: Improve docs for maxConnections and acceptCount

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

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


The following commit(s) were added to refs/heads/9.0.x by this push:
 new 44beabf  Improve docs for maxConnections and acceptCount
44beabf is described below

commit 44beabf80fe15f87ba1301361c6f7e297d98e577
Author: Mark Thomas 
AuthorDate: Thu May 20 11:28:45 2021 +0100

Improve docs for maxConnections and acceptCount
---
 webapps/docs/changelog.xml   |  9 +
 webapps/docs/config/ajp.xml  |  8 +---
 webapps/docs/config/http.xml | 31 ++-
 3 files changed, 32 insertions(+), 16 deletions(-)

diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 1d0c4b2..68135bc 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -152,6 +152,15 @@
   
 
   
+  
+
+  
+Improve the description of the maxConnections and
+acceptCount attributes in the Connector section of the
+documentation web application. (markt)
+  
+
+  
 
 
   
diff --git a/webapps/docs/config/ajp.xml b/webapps/docs/config/ajp.xml
index 2d4fa42..2d57646 100644
--- a/webapps/docs/config/ajp.xml
+++ b/webapps/docs/config/ajp.xml
@@ -302,9 +302,11 @@
   
 
 
-  The maximum queue length for incoming connection requests when
-  all possible request processing threads are in use.  Any requests
-  received when the queue is full will be refused.  The default
+  The maximum length of the operating system provided queue for incoming
+  connection requests when maxConnections has been reached. 
The
+  operating system may ignore this setting and use a different size for the
+  queue. When this queue is full, the operating system may actively refuse
+  additional connections or those connections may time out. The default
   value is 100.
 
 
diff --git a/webapps/docs/config/http.xml b/webapps/docs/config/http.xml
index ee684eb..3fe8515 100644
--- a/webapps/docs/config/http.xml
+++ b/webapps/docs/config/http.xml
@@ -51,16 +51,19 @@
   mod_jk 1.2.x connector for Apache 1.3), please refer to the
   AJP Connector documentation.
 
-  Each incoming request requires
-  a thread for the duration of that request.  If more simultaneous requests
-  are received than can be handled by the currently available request
-  processing threads, additional threads will be created up to the
-  configured maximum (the value of the maxThreads attribute).
-  If still more simultaneous requests are received, they are stacked up
-  inside the server socket created by the Connector, up to
-  the configured maximum (the value of the acceptCount
-  attribute).  Any further simultaneous requests will receive "connection
-  refused" errors, until resources are available to process them.
+  Each incoming, non-asynchronous request requires a thread for the duration
+  of that request.  If more simultaneous requests are received than can be
+  handled by the currently available request processing threads, additional
+  threads will be created up to the configured maximum (the value of the
+  maxThreads attribute). If still more simultaneous requests are
+  received, Tomcat will accept new connections until the current number of
+  connections reaches maxConnections. Connections are queued 
inside
+  the server socket created by the Connector until a thread
+  becomes avaialble to process the connection. Once maxConnections
+  has been reached the operating system will queue further connections. The 
size
+  of the  operating system provided connection queue may be controlled by the
+  acceptCount attribute. If the operating system queue fills,
+  further connection requests may be refused or may time out.
 
 
 
@@ -327,9 +330,11 @@
   
 
 
-  The maximum queue length for incoming connection requests when
-  all possible request processing threads are in use.  Any requests
-  received when the queue is full will be refused.  The default
+  The maximum length of the operating system provided queue for incoming
+  connection requests when maxConnections has been reached. 
The
+  operating system may ignore this setting and use a different size for the
+  queue. When this queue is full, the operating system may actively refuse
+  additional connections or those connections may time out. The default
   value is 100.
 
 

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



[GitHub] [tomcat] markt-asf commented on pull request #419: part.getString will cause OOM without checking maxPostSize, checking maxPostSize first will avoid OOM caused by huge string

2021-05-20 Thread GitBox


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


   This report, and the proposed solution is invalid. `maxPostSize` does not, 
and should not, apply to a multi-part request explicitly parsed via 
`Request.getParts()` or `Request.getPart(String)`.
   Further advice is available from the Tomcat users mailing list: 
http://tomcat.apache.org/lists.html


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



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



[GitHub] [tomcat] markt-asf closed pull request #419: part.getString will cause OOM without checking maxPostSize, checking maxPostSize first will avoid OOM caused by huge string

2021-05-20 Thread GitBox


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


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



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



buildbot failure in on tomcat-trunk

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

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

Buildslave for this Build: asf946_ubuntu

Build Reason: The AnyBranchScheduler scheduler named 'on-tomcat-commit' 
triggered this build
Build Source Stamp: [branch master] d4b05768796b29fc25bf853b44fcf36bb04e114c
Blamelist: Mark Thomas 

BUILD FAILED: failed compile_1

Sincerely,
 -The Buildbot




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



[tomcat] branch master updated: Improve General IDE support

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

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


The following commit(s) were added to refs/heads/master by this push:
 new fb680e1  Improve General IDE support
fb680e1 is described below

commit fb680e1c95f12a105506a3bb26ea911a984b59f1
Author: Lars Grefer 
AuthorDate: Fri Apr 24 00:11:02 2020 +0200

Improve General IDE support
---
 .editorconfig   | 18 ++
 CONTRIBUTING.md | 23 +++
 2 files changed, 41 insertions(+)

diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 000..2301e96
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,18 @@
+root = true
+
+[*]
+end_of_line = lf
+indent_style = space
+trim_trailing_whitespace = true
+
+[*.java]
+indent_size = 4
+max_line_length = 100
+ij_java_block_brace_style = end_of_line
+ij_java_else_on_new_line = false
+
+[*.{txt,md}]
+max_line_length = 80
+
+[*.xml]
+indent_size = 2
\ No newline at end of file
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index c1fd639..0ffe20f 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -124,6 +124,29 @@ of time has lapsed since your submission, such as a couple 
of months, feel free
 to either update your BZ, PR, or email the dev list with a message to bump your
 issue. Sometimes things get lost in all the work and we need a reminder :smile:
 
+## IDE Support
+
+Special IDE support for
+[Eclipse](https://www.eclipse.org/ide/),
+[IntelliJ IDEA](https://www.jetbrains.com/idea/) and
+[NetBeans](https://netbeans.org/)
+is provided through special ant targets:
+
+```bash
+ant ide-eclipse
+```
+```bash
+ant ide-intellij
+```
+```bash
+ant ide-netbeans
+```
+
+Just execute the ant target for your IDE after checking out the sources
+to set up the appropriate configuration files.
+Also make sure to re-execute the target after switching branches or
+after pulling upstream changes in order to keep your IDE configurations in 
sync.
+
 ## Style Guide
 
 Apache Tomcat has very loosely defined coding conventions, but the following

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



[GitHub] [tomcat] markt-asf merged pull request #284: Improve General IDE support

2021-05-20 Thread GitBox


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


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



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



[GitHub] [tomcat] markt-asf commented on pull request #284: Improve General IDE support

2021-05-20 Thread GitBox


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


   Thanks for this. I want to do a few checks locally and then I'll back-port 
it.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



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



[tomcat] branch master updated: Tweak the settings

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

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


The following commit(s) were added to refs/heads/master by this push:
 new 8be11e3  Tweak the settings
8be11e3 is described below

commit 8be11e3838c90d6c25f36333714787b35f4b4d85
Author: Mark Thomas 
AuthorDate: Thu May 20 12:39:39 2021 +0100

Tweak the settings
---
 .editorconfig | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/.editorconfig b/.editorconfig
index 2301e96..1e839e0 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -1,13 +1,12 @@
 root = true
 
 [*]
-end_of_line = lf
 indent_style = space
 trim_trailing_whitespace = true
 
 [*.java]
 indent_size = 4
-max_line_length = 100
+max_line_length = 120
 ij_java_block_brace_style = end_of_line
 ij_java_else_on_new_line = false
 

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



[tomcat] branch 9.0.x updated: Improve General IDE support

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

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


The following commit(s) were added to refs/heads/9.0.x by this push:
 new 2631b37  Improve General IDE support
2631b37 is described below

commit 2631b37d8265550f28de5ecc5da5b34ac1c16397
Author: Lars Grefer 
AuthorDate: Fri Apr 24 00:11:02 2020 +0200

Improve General IDE support
---
 .editorconfig   | 17 +
 CONTRIBUTING.md | 23 +++
 2 files changed, 40 insertions(+)

diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 000..1e839e0
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,17 @@
+root = true
+
+[*]
+indent_style = space
+trim_trailing_whitespace = true
+
+[*.java]
+indent_size = 4
+max_line_length = 120
+ij_java_block_brace_style = end_of_line
+ij_java_else_on_new_line = false
+
+[*.{txt,md}]
+max_line_length = 80
+
+[*.xml]
+indent_size = 2
\ No newline at end of file
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index c1fd639..0ffe20f 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -124,6 +124,29 @@ of time has lapsed since your submission, such as a couple 
of months, feel free
 to either update your BZ, PR, or email the dev list with a message to bump your
 issue. Sometimes things get lost in all the work and we need a reminder :smile:
 
+## IDE Support
+
+Special IDE support for
+[Eclipse](https://www.eclipse.org/ide/),
+[IntelliJ IDEA](https://www.jetbrains.com/idea/) and
+[NetBeans](https://netbeans.org/)
+is provided through special ant targets:
+
+```bash
+ant ide-eclipse
+```
+```bash
+ant ide-intellij
+```
+```bash
+ant ide-netbeans
+```
+
+Just execute the ant target for your IDE after checking out the sources
+to set up the appropriate configuration files.
+Also make sure to re-execute the target after switching branches or
+after pulling upstream changes in order to keep your IDE configurations in 
sync.
+
 ## Style Guide
 
 Apache Tomcat has very loosely defined coding conventions, but the following

-
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: Improve General IDE support

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

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


The following commit(s) were added to refs/heads/8.5.x by this push:
 new ed5916c  Improve General IDE support
ed5916c is described below

commit ed5916ca2625d3e39e36566b5a98c817cfc6a687
Author: Lars Grefer 
AuthorDate: Fri Apr 24 00:11:02 2020 +0200

Improve General IDE support
---
 .editorconfig   | 17 +
 CONTRIBUTING.md | 23 +++
 2 files changed, 40 insertions(+)

diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 000..1e839e0
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,17 @@
+root = true
+
+[*]
+indent_style = space
+trim_trailing_whitespace = true
+
+[*.java]
+indent_size = 4
+max_line_length = 120
+ij_java_block_brace_style = end_of_line
+ij_java_else_on_new_line = false
+
+[*.{txt,md}]
+max_line_length = 80
+
+[*.xml]
+indent_size = 2
\ No newline at end of file
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index c1fd639..0ffe20f 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -124,6 +124,29 @@ of time has lapsed since your submission, such as a couple 
of months, feel free
 to either update your BZ, PR, or email the dev list with a message to bump your
 issue. Sometimes things get lost in all the work and we need a reminder :smile:
 
+## IDE Support
+
+Special IDE support for
+[Eclipse](https://www.eclipse.org/ide/),
+[IntelliJ IDEA](https://www.jetbrains.com/idea/) and
+[NetBeans](https://netbeans.org/)
+is provided through special ant targets:
+
+```bash
+ant ide-eclipse
+```
+```bash
+ant ide-intellij
+```
+```bash
+ant ide-netbeans
+```
+
+Just execute the ant target for your IDE after checking out the sources
+to set up the appropriate configuration files.
+Also make sure to re-execute the target after switching branches or
+after pulling upstream changes in order to keep your IDE configurations in 
sync.
+
 ## Style Guide
 
 Apache Tomcat has very loosely defined coding conventions, but the following

-
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: Align with 10.0.x: Add SSO cookieName configuration attribute

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

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


The following commit(s) were added to refs/heads/9.0.x by this push:
 new 2a39474  Align with 10.0.x: Add SSO cookieName configuration attribute
2a39474 is described below

commit 2a394740d7de325fbf9e21f59d24091ff06e03e8
Author: remm 
AuthorDate: Wed Apr 1 14:46:04 2020 +0200

Align with 10.0.x: Add SSO cookieName configuration attribute
---
 .../catalina/authenticator/AuthenticatorBase.java  |  2 +-
 .../apache/catalina/authenticator/Constants.java   |  1 +
 .../catalina/authenticator/SingleSignOn.java   | 23 +-
 webapps/docs/changelog.xml |  4 
 webapps/docs/config/valve.xml  |  5 +
 5 files changed, 33 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/catalina/authenticator/AuthenticatorBase.java 
b/java/org/apache/catalina/authenticator/AuthenticatorBase.java
index b1c3070..0e47bee 100644
--- a/java/org/apache/catalina/authenticator/AuthenticatorBase.java
+++ b/java/org/apache/catalina/authenticator/AuthenticatorBase.java
@@ -1212,7 +1212,7 @@ public abstract class AuthenticatorBase extends ValveBase
 if (ssoId == null) {
 // Construct a cookie to be returned to the client
 ssoId = sessionIdGenerator.generateSessionId();
-Cookie cookie = new Cookie(Constants.SINGLE_SIGN_ON_COOKIE, ssoId);
+Cookie cookie = new Cookie(sso.getCookieName(), ssoId);
 cookie.setMaxAge(-1);
 cookie.setPath("/");
 
diff --git a/java/org/apache/catalina/authenticator/Constants.java 
b/java/org/apache/catalina/authenticator/Constants.java
index a8e9a47..d748229 100644
--- a/java/org/apache/catalina/authenticator/Constants.java
+++ b/java/org/apache/catalina/authenticator/Constants.java
@@ -17,6 +17,7 @@
 package org.apache.catalina.authenticator;
 
 public class Constants {
+
 // Authentication methods for login configuration
 // Servlet spec schemes are defined in HttpServletRequest
 // Vendor specific schemes
diff --git a/java/org/apache/catalina/authenticator/SingleSignOn.java 
b/java/org/apache/catalina/authenticator/SingleSignOn.java
index 31fdb1f..9ce30fe 100644
--- a/java/org/apache/catalina/authenticator/SingleSignOn.java
+++ b/java/org/apache/catalina/authenticator/SingleSignOn.java
@@ -94,6 +94,10 @@ public class SingleSignOn extends ValveBase {
  */
 private String cookieDomain;
 
+/**
+ * SSO cookie name, the default value is JSESSIONIDSSO.
+ */
+private String cookieName = Constants.SINGLE_SIGN_ON_COOKIE;
 
 // - Properties
 
@@ -123,6 +127,23 @@ public class SingleSignOn extends ValveBase {
 
 
 /**
+ * @return the cookie name
+ */
+public String getCookieName() {
+return cookieName;
+}
+
+
+/**
+ * Set the cookie name that will be used for the SSO cookie.
+ * @param cookieName the cookieName to set
+ */
+public void setCookieName(String cookieName) {
+this.cookieName = cookieName;
+}
+
+
+/**
  * Gets whether each request needs to be reauthenticated (by an
  * Authenticator downstream in the pipeline) to the security
  * Realm, or if this Valve can itself bind security info
@@ -227,7 +248,7 @@ public class SingleSignOn extends ValveBase {
 Cookie cookies[] = request.getCookies();
 if (cookies != null) {
 for (Cookie value : cookies) {
-if (Constants.SINGLE_SIGN_ON_COOKIE.equals(value.getName())) {
+if (cookieName.equals(value.getName())) {
 cookie = value;
 break;
 }
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 68135bc..e1209f8 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -124,6 +124,10 @@
 encoding of the file. Based on a pull request by Jean-Louis Monteiro.
 (markt)
   
+  
+Add cookieName attribute to the SSO valve to configure the
+SSO cookie name. (remm)
+  
 
   
   
diff --git a/webapps/docs/config/valve.xml b/webapps/docs/config/valve.xml
index eea2cd5..85d5449 100644
--- a/webapps/docs/config/valve.xml
+++ b/webapps/docs/config/valve.xml
@@ -1295,6 +1295,11 @@
 Sets the host domain to be used for sso cookies.
   
 
+  
+Sets the cookie name to be used for sso cookies. The default value
+is JSESSIONIDSSO
+  
+
 
 
   

-
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: Align with 10.0.x: Add SSO cookieName configuration attribute

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

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


The following commit(s) were added to refs/heads/8.5.x by this push:
 new b04c1df  Align with 10.0.x: Add SSO cookieName configuration attribute
b04c1df is described below

commit b04c1df7f41926af0aa7cb93060166a9802008be
Author: remm 
AuthorDate: Wed Apr 1 14:46:04 2020 +0200

Align with 10.0.x: Add SSO cookieName configuration attribute
---
 .../catalina/authenticator/AuthenticatorBase.java  |  2 +-
 .../apache/catalina/authenticator/Constants.java   |  1 +
 .../catalina/authenticator/SingleSignOn.java   | 23 +-
 webapps/docs/changelog.xml |  4 
 webapps/docs/config/valve.xml  |  5 +
 5 files changed, 33 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/catalina/authenticator/AuthenticatorBase.java 
b/java/org/apache/catalina/authenticator/AuthenticatorBase.java
index b20b4b6..79b1bc5 100644
--- a/java/org/apache/catalina/authenticator/AuthenticatorBase.java
+++ b/java/org/apache/catalina/authenticator/AuthenticatorBase.java
@@ -1214,7 +1214,7 @@ public abstract class AuthenticatorBase extends ValveBase
 if (ssoId == null) {
 // Construct a cookie to be returned to the client
 ssoId = sessionIdGenerator.generateSessionId();
-Cookie cookie = new Cookie(Constants.SINGLE_SIGN_ON_COOKIE, ssoId);
+Cookie cookie = new Cookie(sso.getCookieName(), ssoId);
 cookie.setMaxAge(-1);
 cookie.setPath("/");
 
diff --git a/java/org/apache/catalina/authenticator/Constants.java 
b/java/org/apache/catalina/authenticator/Constants.java
index 66f2a49..5a316ef 100644
--- a/java/org/apache/catalina/authenticator/Constants.java
+++ b/java/org/apache/catalina/authenticator/Constants.java
@@ -17,6 +17,7 @@
 package org.apache.catalina.authenticator;
 
 public class Constants {
+
 // Authentication methods for login configuration
 // Servlet spec schemes are defined in HttpServletRequest
 // Vendor specific schemes
diff --git a/java/org/apache/catalina/authenticator/SingleSignOn.java 
b/java/org/apache/catalina/authenticator/SingleSignOn.java
index 31fdb1f..9ce30fe 100644
--- a/java/org/apache/catalina/authenticator/SingleSignOn.java
+++ b/java/org/apache/catalina/authenticator/SingleSignOn.java
@@ -94,6 +94,10 @@ public class SingleSignOn extends ValveBase {
  */
 private String cookieDomain;
 
+/**
+ * SSO cookie name, the default value is JSESSIONIDSSO.
+ */
+private String cookieName = Constants.SINGLE_SIGN_ON_COOKIE;
 
 // - Properties
 
@@ -123,6 +127,23 @@ public class SingleSignOn extends ValveBase {
 
 
 /**
+ * @return the cookie name
+ */
+public String getCookieName() {
+return cookieName;
+}
+
+
+/**
+ * Set the cookie name that will be used for the SSO cookie.
+ * @param cookieName the cookieName to set
+ */
+public void setCookieName(String cookieName) {
+this.cookieName = cookieName;
+}
+
+
+/**
  * Gets whether each request needs to be reauthenticated (by an
  * Authenticator downstream in the pipeline) to the security
  * Realm, or if this Valve can itself bind security info
@@ -227,7 +248,7 @@ public class SingleSignOn extends ValveBase {
 Cookie cookies[] = request.getCookies();
 if (cookies != null) {
 for (Cookie value : cookies) {
-if (Constants.SINGLE_SIGN_ON_COOKIE.equals(value.getName())) {
+if (cookieName.equals(value.getName())) {
 cookie = value;
 break;
 }
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 8863b76..8f8304c 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -124,6 +124,10 @@
 encoding of the file. Based on a pull request by Jean-Louis Monteiro.
 (markt)
   
+  
+Add cookieName attribute to the SSO valve to configure the
+SSO cookie name. (remm)
+  
 
   
   
diff --git a/webapps/docs/config/valve.xml b/webapps/docs/config/valve.xml
index 9b176f6..04760d9 100644
--- a/webapps/docs/config/valve.xml
+++ b/webapps/docs/config/valve.xml
@@ -1295,6 +1295,11 @@
 Sets the host domain to be used for sso cookies.
   
 
+  
+Sets the cookie name to be used for sso cookies. The default value
+is JSESSIONIDSSO
+  
+
 
 
   

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



[tomcat] 01/05: Better align with 10.0.x and 9.0.x

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

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

commit abf45df71342f7bed2112c689d607da07e6de72a
Author: Mark Thomas 
AuthorDate: Thu May 20 13:10:12 2021 +0100

Better align with 10.0.x and 9.0.x
---
 .../apache/catalina/session/StandardSession.java   | 57 ++
 1 file changed, 25 insertions(+), 32 deletions(-)

diff --git a/java/org/apache/catalina/session/StandardSession.java 
b/java/org/apache/catalina/session/StandardSession.java
index 9864946..effbc88 100644
--- a/java/org/apache/catalina/session/StandardSession.java
+++ b/java/org/apache/catalina/session/StandardSession.java
@@ -621,7 +621,6 @@ public class StandardSession implements HttpSession, 
Session, Serializable {
  */
 @Override
 public HttpSession getSession() {
-
 if (facade == null){
 if (SecurityUtil.isPackageProtectionEnabled()){
 final StandardSession fsession = this;
@@ -636,8 +635,7 @@ public class StandardSession implements HttpSession, 
Session, Serializable {
 facade = new StandardSessionFacade(this);
 }
 }
-return (facade);
-
+return facade;
 }
 
 
@@ -1375,6 +1373,8 @@ public class StandardSession implements HttpSession, 
Session, Serializable {
 public void setAttribute(String name, Object value) {
 setAttribute(name,value,true);
 }
+
+
 /**
  * Bind an object to this session, using the specified name.  If an object
  * of the same name is already bound to this session, the object is
@@ -1392,13 +1392,13 @@ public class StandardSession implements HttpSession, 
Session, Serializable {
  * @exception IllegalStateException if this method is called on an
  *  invalidated session
  */
-
 public void setAttribute(String name, Object value, boolean notify) {
 
 // Name cannot be null
-if (name == null)
-throw new IllegalArgumentException
-(sm.getString("standardSession.setAttribute.namenull"));
+if (name == null) {
+throw new IllegalArgumentException(
+sm.getString("standardSession.setAttribute.namenull"));
+}
 
 // Null value is the same as removeAttribute()
 if (value == null) {
@@ -1408,13 +1408,14 @@ public class StandardSession implements HttpSession, 
Session, Serializable {
 
 // Validate our current state
 if (!isValidInternal()) {
-throw new IllegalStateException(sm.getString(
-"standardSession.setAttribute.ise", getIdInternal()));
+throw new IllegalStateException(
+sm.getString("standardSession.setAttribute.ise", 
getIdInternal()));
 }
-if ((manager != null) && manager.getContext().getDistributable() &&
-!isAttributeDistributable(name, value) && !exclude(name, 
value)) {
-throw new IllegalArgumentException(sm.getString(
-"standardSession.setAttribute.iae", name));
+
+Context context = manager.getContext();
+
+if (context.getDistributable() && !isAttributeDistributable(name, 
value) && !exclude(name, value)) {
+throw new 
IllegalArgumentException(sm.getString("standardSession.setAttribute.iae", 
name));
 }
 // Construct an event with the new value
 HttpSessionBindingEvent event = null;
@@ -1428,8 +1429,8 @@ public class StandardSession implements HttpSession, 
Session, Serializable {
 try {
 ((HttpSessionBindingListener) value).valueBound(event);
 } catch (Throwable t){
-manager.getContext().getLogger().error
-(sm.getString("standardSession.bindingEvent"), t);
+manager.getContext().getLogger().error(
+sm.getString("standardSession.bindingEvent"), t);
 }
 }
 }
@@ -1450,10 +1451,11 @@ public class StandardSession implements HttpSession, 
Session, Serializable {
 }
 }
 
-if ( !notify ) return;
+if (!notify) {
+return;
+}
 
 // Notify interested application event listeners
-Context context = manager.getContext();
 Object listeners[] = context.getApplicationEventListeners();
 if (listeners == null) {
 return;
@@ -1475,15 +1477,12 @@ public class StandardSession implements HttpSession, 
Session, Serializable {
 context.fireContainerEvent("afterSessionAttributeReplaced",
 listener);
 } else {
-context.fireContainerEvent("beforeSessionAttributeAdded",
-listener);
+context.fireContainerEvent("beforeSessionAttributeAdded", 
listener);
  

[tomcat] branch 8.5.x updated (b04c1df -> 434d791)

2021-05-20 Thread markt
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 b04c1df  Align with 10.0.x: Add SSO cookieName configuration attribute
 new abf45df  Better align with 10.0.x and 9.0.x
 new 804ffa6  Better align with 10.0.x/9.0.x - use StringManager
 new 0610e67  Align with 10.0.x/9.0.x - avoid explicitly referenced 
anonymous classes
 new b7a736f  Align with 10.0.x/9.0.x - avoid explicitly referenced 
anonymous classes
 new 434d791  Align with 10.0.x/9.0.x - avoid explicitly referenced 
anonymous classes

The 5 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/connector/ResponseFacade.java  |  34 +++---
 .../catalina/core/DefaultInstanceManager.java  | 120 +
 .../apache/catalina/core/LocalStrings.properties   |   2 +
 .../catalina/core/LocalStrings_fr.properties   |   2 +
 .../catalina/core/LocalStrings_ja.properties   |   2 +
 .../catalina/core/LocalStrings_ko.properties   |   2 +
 .../catalina/core/LocalStrings_zh_CN.properties|   2 +
 .../catalina/security/SecurityClassLoad.java   |  10 +-
 .../apache/catalina/session/StandardSession.java   |  82 +++---
 9 files changed, 152 insertions(+), 104 deletions(-)

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



[tomcat] 02/05: Better align with 10.0.x/9.0.x - use StringManager

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

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

commit 804ffa6728e8b7db27d10a80a0acb1e587788bb5
Author: Mark Thomas 
AuthorDate: Thu May 20 13:16:49 2021 +0100

Better align with 10.0.x/9.0.x - use StringManager
---
 java/org/apache/catalina/core/DefaultInstanceManager.java   | 13 +
 java/org/apache/catalina/core/LocalStrings.properties   |  2 ++
 java/org/apache/catalina/core/LocalStrings_fr.properties|  2 ++
 java/org/apache/catalina/core/LocalStrings_ja.properties|  2 ++
 java/org/apache/catalina/core/LocalStrings_ko.properties|  2 ++
 java/org/apache/catalina/core/LocalStrings_zh_CN.properties |  2 ++
 6 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/java/org/apache/catalina/core/DefaultInstanceManager.java 
b/java/org/apache/catalina/core/DefaultInstanceManager.java
index f67179b..1ca25e3 100644
--- a/java/org/apache/catalina/core/DefaultInstanceManager.java
+++ b/java/org/apache/catalina/core/DefaultInstanceManager.java
@@ -382,9 +382,8 @@ public class DefaultInstanceManager implements 
InstanceManager {
 postConstruct.getParameterTypes(), null,
 AnnotationCacheEntryType.POST_CONSTRUCT));
 } else if (postConstructFromXml != null) {
-throw new IllegalArgumentException("Post construct method "
-+ postConstructFromXml + " for class " + 
clazz.getName()
-+ " is declared in deployment descriptor but cannot be 
found.");
+throw new 
IllegalArgumentException(sm.getString("defaultInstanceManager.postConstructNotFound",
+postConstructFromXml, clazz.getName()));
 }
 if (preDestroy != null) {
 annotations.add(new AnnotationCacheEntry(
@@ -392,9 +391,8 @@ public class DefaultInstanceManager implements 
InstanceManager {
 preDestroy.getParameterTypes(), null,
 AnnotationCacheEntryType.PRE_DESTROY));
 } else if (preDestroyFromXml != null) {
-throw new IllegalArgumentException("Pre destroy method "
-+ preDestroyFromXml + " for class " + clazz.getName()
-+ " is declared in deployment descriptor but cannot be 
found.");
+throw new 
IllegalArgumentException(sm.getString("defaultInstanceManager.preDestroyNotFound",
+preDestroyFromXml, clazz.getName()));
 }
 
 if (context != null) {
@@ -725,8 +723,7 @@ public class DefaultInstanceManager implements 
InstanceManager {
 });
 } else {
 try {
-result = clazz.getDeclaredField(
-entry.getAccessibleObjectName());
+result = 
clazz.getDeclaredField(entry.getAccessibleObjectName());
 } catch (NoSuchFieldException e) {
 // Should never happen. On that basis don't log it.
 }
diff --git a/java/org/apache/catalina/core/LocalStrings.properties 
b/java/org/apache/catalina/core/LocalStrings.properties
index 5bedad0..242bd7c 100644
--- a/java/org/apache/catalina/core/LocalStrings.properties
+++ b/java/org/apache/catalina/core/LocalStrings.properties
@@ -117,6 +117,8 @@ containerBase.threadedStartFailed=A child container failed 
during start
 containerBase.threadedStopFailed=A child container failed during stop
 
 defaultInstanceManager.invalidInjection=Invalid method resource injection 
annotation
+defaultInstanceManager.postConstructNotFound=Post construct method [{0}] for 
class [{1}] is declared in deployment descriptor but cannot be found
+defaultInstanceManager.preDestroyNotFound=Pre destroy method [{0}] for class 
[{1}] is declared in deployment descriptor but cannot be found
 defaultInstanceManager.restrictedClass=Access to class [{0}] is forbidden. It 
is a restricted class. A web application must be configured as privileged to be 
able to load it
 defaultInstanceManager.restrictedContainerServlet=Access to class [{0}] is 
forbidden. It is a restricted class (implements ContainerServlet interface). A 
web application must be configured as privileged to be able to load it
 defaultInstanceManager.restrictedFiltersResource=Restricted filters property 
file not found [{0}]
diff --git a/java/org/apache/catalina/core/LocalStrings_fr.properties 
b/java/org/apache/catalina/core/LocalStrings_fr.properties
index 2de7308..3d37d8d 100644
--- a/java/org/apache/catalina/core/LocalStrings_fr.properties
+++ b/java/org/apache/catalina/core/LocalStrings_fr.properties
@@ -116,6 +116,8 @@ containerBase.threadedStartFailed=Un conteneur fils a 
échoué pendant son déma
 containerBase.threadedStopFailed=Erreur lors de l'arrêt d'un conteneur fils
 
 defaultInstanceManage

[tomcat] 03/05: Align with 10.0.x/9.0.x - avoid explicitly referenced anonymous classes

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

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

commit 0610e67d41c77a961a064b6a50c9af67f9f253a3
Author: Mark Thomas 
AuthorDate: Thu May 20 13:19:01 2021 +0100

Align with 10.0.x/9.0.x - avoid explicitly referenced anonymous classes
---
 .../catalina/core/DefaultInstanceManager.java  | 107 +
 .../catalina/security/SecurityClassLoad.java   |   4 +-
 2 files changed, 72 insertions(+), 39 deletions(-)

diff --git a/java/org/apache/catalina/core/DefaultInstanceManager.java 
b/java/org/apache/catalina/core/DefaultInstanceManager.java
index 1ca25e3..7dc2ba1 100644
--- a/java/org/apache/catalina/core/DefaultInstanceManager.java
+++ b/java/org/apache/catalina/core/DefaultInstanceManager.java
@@ -506,13 +506,8 @@ public class DefaultInstanceManager implements 
InstanceManager {
 Class clazz;
 if (SecurityUtil.isPackageProtectionEnabled()) {
 try {
-clazz = AccessController.doPrivileged(new 
PrivilegedExceptionAction>() {
-
-@Override
-public Class run() throws Exception {
-return loadClass(className, classLoader);
-}
-});
+clazz = AccessController.doPrivileged(
+new PrivilegedLoadClass(className, classLoader));
 } catch (PrivilegedActionException e) {
 Throwable t = e.getCause();
 if (t instanceof ClassNotFoundException) {
@@ -675,22 +670,7 @@ public class DefaultInstanceManager implements 
InstanceManager {
 final AnnotationCacheEntry entry) {
 Method result = null;
 if (Globals.IS_SECURITY_ENABLED) {
-result = AccessController.doPrivileged(
-new PrivilegedAction() {
-@Override
-public Method run() {
-Method result = null;
-try {
-result = clazz.getDeclaredMethod(
-entry.getAccessibleObjectName(),
-entry.getParamTypes());
-} catch (NoSuchMethodException e) {
-// Should never happen. On that basis don't log
-// it.
-}
-return result;
-}
-});
+result = AccessController.doPrivileged(new 
PrivilegedGetMethod(clazz, entry));
 } else {
 try {
 result = clazz.getDeclaredMethod(
@@ -706,21 +686,7 @@ public class DefaultInstanceManager implements 
InstanceManager {
 final AnnotationCacheEntry entry) {
 Field result = null;
 if (Globals.IS_SECURITY_ENABLED) {
-result = AccessController.doPrivileged(
-new PrivilegedAction() {
-@Override
-public Field run() {
-Field result = null;
-try {
-result = clazz.getDeclaredField(
-entry.getAccessibleObjectName());
-} catch (NoSuchFieldException e) {
-// Should never happen. On that basis don't log
-// it.
-}
-return result;
-}
-});
+result = AccessController.doPrivileged(new 
PrivilegedGetField(clazz, entry));
 } else {
 try {
 result = 
clazz.getDeclaredField(entry.getAccessibleObjectName());
@@ -799,7 +765,72 @@ public class DefaultInstanceManager implements 
InstanceManager {
 }
 }
 
+
 private enum AnnotationCacheEntryType {
 FIELD, SETTER, POST_CONSTRUCT, PRE_DESTROY
 }
+
+
+private static class PrivilegedGetField implements PrivilegedAction 
{
+
+private final Class clazz;
+private final AnnotationCacheEntry entry;
+
+public PrivilegedGetField(Class clazz, AnnotationCacheEntry entry) {
+this.clazz = clazz;
+this.entry = entry;
+}
+
+@Override
+public Field run() {
+Field result = null;
+try {
+result = 
clazz.getDeclaredField(entry.getAccessibleObjectName());
+} catch (NoSuchFieldException e) {
+// Should never happen. On that basis don't log it.
+}
+return result;
+}
+}
+
+
+private static class PrivilegedGetMethod implements 
PrivilegedAction {
+
+private final Class clazz;
+private final AnnotationCacheEntry entry;
+
+   

[tomcat] 04/05: Align with 10.0.x/9.0.x - avoid explicitly referenced anonymous classes

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

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

commit b7a736fb12f5e4774c63fa20f6fc437315e1b0d0
Author: Mark Thomas 
AuthorDate: Thu May 20 13:21:25 2021 +0100

Align with 10.0.x/9.0.x - avoid explicitly referenced anonymous classes
---
 .../catalina/security/SecurityClassLoad.java   |  2 +-
 .../apache/catalina/session/StandardSession.java   | 29 ++
 2 files changed, 20 insertions(+), 11 deletions(-)

diff --git a/java/org/apache/catalina/security/SecurityClassLoad.java 
b/java/org/apache/catalina/security/SecurityClassLoad.java
index 2cc50bb..57abb5d 100644
--- a/java/org/apache/catalina/security/SecurityClassLoad.java
+++ b/java/org/apache/catalina/security/SecurityClassLoad.java
@@ -97,7 +97,7 @@ public final class SecurityClassLoad {
 private static final void loadSessionPackage(ClassLoader loader) throws 
Exception {
 final String basePackage = "org.apache.catalina.session.";
 loader.loadClass(basePackage + "StandardSession");
-loadAnonymousInnerClasses(loader, basePackage + "StandardSession");
+loader.loadClass(basePackage + 
"StandardSession$PrivilegedNewSessionFacade");
 loader.loadClass(basePackage + "StandardManager$PrivilegedDoUnload");
 }
 
diff --git a/java/org/apache/catalina/session/StandardSession.java 
b/java/org/apache/catalina/session/StandardSession.java
index effbc88..7ba0fcb 100644
--- a/java/org/apache/catalina/session/StandardSession.java
+++ b/java/org/apache/catalina/session/StandardSession.java
@@ -621,16 +621,9 @@ public class StandardSession implements HttpSession, 
Session, Serializable {
  */
 @Override
 public HttpSession getSession() {
-if (facade == null){
-if (SecurityUtil.isPackageProtectionEnabled()){
-final StandardSession fsession = this;
-facade = AccessController.doPrivileged(
-new PrivilegedAction(){
-@Override
-public StandardSessionFacade run(){
-return new StandardSessionFacade(fsession);
-}
-});
+if (facade == null) {
+if (SecurityUtil.isPackageProtectionEnabled()) {
+facade = AccessController.doPrivileged(new 
PrivilegedNewSessionFacade(this));
 } else {
 facade = new StandardSessionFacade(this);
 }
@@ -1861,6 +1854,22 @@ public class StandardSession implements HttpSession, 
Session, Serializable {
 }
 }
 }
+
+
+private static class PrivilegedNewSessionFacade implements
+PrivilegedAction {
+
+private final HttpSession session;
+
+public PrivilegedNewSessionFacade(HttpSession session) {
+this.session = session;
+}
+
+@Override
+public StandardSessionFacade run(){
+return new StandardSessionFacade(session);
+}
+}
 }
 
 

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



[tomcat] 05/05: Align with 10.0.x/9.0.x - avoid explicitly referenced anonymous classes

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

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

commit 434d791c0a0263d883b356ce7800eeed37295bc9
Author: Mark Thomas 
AuthorDate: Thu May 20 13:23:55 2021 +0100

Align with 10.0.x/9.0.x - avoid explicitly referenced anonymous classes
---
 .../apache/catalina/connector/ResponseFacade.java  | 34 +-
 .../catalina/security/SecurityClassLoad.java   |  4 +--
 2 files changed, 22 insertions(+), 16 deletions(-)

diff --git a/java/org/apache/catalina/connector/ResponseFacade.java 
b/java/org/apache/catalina/connector/ResponseFacade.java
index 252b990..4656076 100644
--- a/java/org/apache/catalina/connector/ResponseFacade.java
+++ b/java/org/apache/catalina/connector/ResponseFacade.java
@@ -84,6 +84,22 @@ public class ResponseFacade implements HttpServletResponse {
 }
 }
 
+private static class FlushBufferPrivilegedAction implements 
PrivilegedExceptionAction {
+
+private final Response response;
+
+public FlushBufferPrivilegedAction(Response response) {
+this.response = response;
+}
+
+@Override
+public Void run() throws IOException {
+response.setAppCommitted(true);
+response.flushBuffer();
+return null;
+}
+}
+
 
 // --- Constructors
 
@@ -280,22 +296,12 @@ public class ResponseFacade implements 
HttpServletResponse {
 return;
 }
 
-if (SecurityUtil.isPackageProtectionEnabled()){
+if (SecurityUtil.isPackageProtectionEnabled()) {
 try{
-AccessController.doPrivileged(
-new PrivilegedExceptionAction(){
-
-@Override
-public Void run() throws IOException{
-response.setAppCommitted(true);
-
-response.flushBuffer();
-return null;
-}
-});
-} catch(PrivilegedActionException e){
+AccessController.doPrivileged(new 
FlushBufferPrivilegedAction(response));
+} catch(PrivilegedActionException e) {
 Exception ex = e.getException();
-if (ex instanceof IOException){
+if (ex instanceof IOException) {
 throw (IOException)ex;
 }
 }
diff --git a/java/org/apache/catalina/security/SecurityClassLoad.java 
b/java/org/apache/catalina/security/SecurityClassLoad.java
index 57abb5d..144a869 100644
--- a/java/org/apache/catalina/security/SecurityClassLoad.java
+++ b/java/org/apache/catalina/security/SecurityClassLoad.java
@@ -127,7 +127,6 @@ public final class SecurityClassLoad {
 
 private static final void loadConnectorPackage(ClassLoader loader) throws 
Exception {
 final String basePackage = "org.apache.catalina.connector.";
-loader.loadClass(basePackage + "CoyoteOutputStream");
 loader.loadClass(basePackage + 
"RequestFacade$GetAttributePrivilegedAction");
 loader.loadClass(basePackage + 
"RequestFacade$GetParameterMapPrivilegedAction");
 loader.loadClass(basePackage + 
"RequestFacade$GetRequestDispatcherPrivilegedAction");
@@ -143,9 +142,10 @@ public final class SecurityClassLoad {
 loader.loadClass(basePackage + 
"ResponseFacade$SetContentTypePrivilegedAction");
 loader.loadClass(basePackage + 
"ResponseFacade$DateHeaderPrivilegedAction");
 loader.loadClass(basePackage + 
"RequestFacade$GetSessionPrivilegedAction");
-loadAnonymousInnerClasses(loader, basePackage + "ResponseFacade");
+loader.loadClass(basePackage + 
"ResponseFacade$FlushBufferPrivilegedAction");
 loadAnonymousInnerClasses(loader, basePackage + "OutputBuffer");
 loadAnonymousInnerClasses(loader, basePackage + "CoyoteInputStream");
+loader.loadClass(basePackage + "CoyoteOutputStream");
 loadAnonymousInnerClasses(loader, basePackage + "InputBuffer");
 loadAnonymousInnerClasses(loader, basePackage + "Response");
 }

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



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

2021-05-20 Thread Mark Thomas

Answering various points raised in this thread...

On 18/05/2021 13:10, Emmanuel Bourg wrote:
> I don't think the 7.0.x branch should be removed, there is no harm
> keeping it.

Ack. The idea was to try and provide a clear indication that the branch 
was not being developed whilst not losing any history. It is easily 
reversible. I'm leaning towards trying it and reversing it if there is 
an issue but we could just as easily leave it and see what happens. No 
rush to make a decision on this. We said we'd wait until 3 months after 
EOL to do this sort of clean-up (after 2021-06-30).



On 18/05/2021 13:16, Romain Manni-Bucau wrote:
and
On 19/05/2021 14:02, Martin Grigorov wrote:
> -0 to break all clones and related toolings/automotion for hypothetical
> reasons, didn't pay in all projects which did AFAIK

The reasons aren't hypothetical. My $dayjob is with a large 
multi-national company and the feedback there is that some employees do 
find the "master" terminology problematic. Costs and benefits are 
difficult to quantify but I think this relatively small change is worth 
it for the message it sends regarding Tomcat being a welcoming community 
for all.


I'll do the bulk of the work (actually GitHub and an Infra script will 
do most of it). Each committer will then need to run


git branch -m master main
git fetch origin
git branch -u origin/main main

for each clone.

PRs etc will get rebased automatically.

I'm currently planning on doing this late Friday my time. I'll post to 
dev@ before and after so everyone is aware of the change.


Mark



On 18/05/2021 12:18, Mark Thomas wrote:

All,

Things are starting to move forward for Jakarta EE 10 so I think it is 
time for us to create the 10.1.x branch. At the same time, I'd like to 
switch our primary development branches from master to main for all our 
repos.


We would, therefore, end up with the following for the Tomcat repo:

main   - 10.1.x development
10.0.x - 10.0.x development/maintenance
9.0.x  - 9.0.x development/maintenance
8.5.x  - 8.5.x development/maintenance
7.0.x  - 7.0.x development/maintenance

There are some git commands each committer will need to run locally for 
each repo to switch from master to main.


I have also been looking into how we can "retire" the 7.0.x branch when 
the time comes (after end of June). I'd like to suggest the following:

- tag the HEAD of the 7.0.x branch as "7.0.x-archive"
- delete the 7.0.x branch

That way it won't appear in the list of branches but it is trivial to 
recreate if we need it.


I'd like to get the master->main rename completed and the 10.1.x 
development branch created towards the end of this week (unless there 
are objections or things we need to discuss further).


Comments?

Mark

-
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



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

2021-05-20 Thread GitBox


tianshuang commented on pull request #419:
URL: https://github.com/apache/tomcat/pull/419#issuecomment-845112219


   I adjusted to check the maxPostSize first to avoid the OOM problem, 
part.getString will trigger OOM when the string is huge.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



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



buildbot success in on tomcat-trunk

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

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

Buildslave for this Build: asf946_ubuntu

Build Reason: The AnyBranchScheduler scheduler named 'on-tomcat-commit' 
triggered this build
Build Source Stamp: [branch master] 8be11e3838c90d6c25f36333714787b35f4b4d85
Blamelist: Lars Grefer ,Mark Thomas 

Build succeeded!

Sincerely,
 -The Buildbot




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



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

2021-05-20 Thread GitBox


tianshuang commented on pull request #419:
URL: https://github.com/apache/tomcat/pull/419#issuecomment-845114763


   If part.getString is called before checking maxPostSize, it may trigger OOM.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



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



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

2021-05-20 Thread GitBox


tianshuang commented on pull request #419:
URL: https://github.com/apache/tomcat/pull/419#issuecomment-845115322


   stack trace: 
   ```
 at java.lang.OutOfMemoryError.()V (OutOfMemoryError.java:48)
 at java.lang.StringCoding$StringDecoder.decode([BII)[C 
(StringCoding.java:149)
 at java.lang.StringCoding.decode(Ljava/lang/String;[BII)[C 
(StringCoding.java:193)
 at java.lang.String.([BIILjava/lang/String;)V (String.java:426)
 at java.lang.String.([BLjava/lang/String;)V (String.java:491)
 at 
org.apache.tomcat.util.http.fileupload.disk.DiskFileItem.getString(Ljava/lang/String;)Ljava/lang/String;
 (DiskFileItem.java:327)
 at 
org.apache.catalina.core.ApplicationPart.getString(Ljava/lang/String;)Ljava/lang/String;
 (ApplicationPart.java:127)
 at org.apache.catalina.connector.Request.parseParts(Z)V (Request.java:2919)
 at org.apache.catalina.connector.Request.getParts()Ljava/util/Collection; 
(Request.java:2810)
 at 
org.apache.catalina.connector.RequestFacade.getParts()Ljava/util/Collection; 
(RequestFacade.java:1084)
 at 
org.springframework.web.multipart.support.StandardMultipartHttpServletRequest.parseRequest(Ljavax/servlet/http/HttpServletRequest;)V
 (StandardMultipartHttpServletRequest.java:93)
 at 
org.springframework.web.multipart.support.StandardMultipartHttpServletRequest.(Ljavax/servlet/http/HttpServletRequest;Z)V
 (StandardMultipartHttpServletRequest.java:86)
 at 
org.springframework.web.multipart.support.StandardServletMultipartResolver.resolveMultipart(Ljavax/servlet/http/HttpServletRequest;)Lorg/springframework/web/multipart/MultipartHttpServletRequest;
 (StandardServletMultipartResolver.java:91)
 at 
org.springframework.web.servlet.DispatcherServlet.checkMultipart(Ljavax/servlet/http/HttpServletRequest;)Ljavax/servlet/http/HttpServletRequest;
 (DispatcherServlet.java:1128)
 at 
org.springframework.web.servlet.DispatcherServlet.doDispatch(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V
 (DispatcherServlet.java:960)
 at 
org.springframework.web.servlet.DispatcherServlet.doService(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V
 (DispatcherServlet.java:925)
 at 
org.springframework.web.servlet.FrameworkServlet.processRequest(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V
 (FrameworkServlet.java:974)
 at 
org.springframework.web.servlet.FrameworkServlet.doPost(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V
 (FrameworkServlet.java:877)
 at 
javax.servlet.http.HttpServlet.service(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V
 (HttpServlet.java:652)
 at 
org.springframework.web.servlet.FrameworkServlet.service(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V
 (FrameworkServlet.java:851)
 at 
javax.servlet.http.HttpServlet.service(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;)V
 (HttpServlet.java:733)
 at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;)V
 (ApplicationFilterChain.java:231)
 at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;)V
 (ApplicationFilterChain.java:166)
 at 
org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;Ljavax/servlet/FilterChain;)V
 (HttpPutFormContentFilter.java:109)
 at 
org.springframework.web.filter.OncePerRequestFilter.doFilter(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;Ljavax/servlet/FilterChain;)V
 (OncePerRequestFilter.java:107)
 at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;)V
 (ApplicationFilterChain.java:193)
 at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;)V
 (ApplicationFilterChain.java:166)
 at 
org.apache.tomcat.websocket.server.WsFilter.doFilter(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;Ljavax/servlet/FilterChain;)V
 (WsFilter.java:52)
 at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;)V
 (ApplicationFilterChain.java:193)
 at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;)V
 (ApplicationFilterChain.java:166)
 at 
org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;Ljavax/servlet/FilterChain;)V
 (CharacterEncodingFilter.java:200)
 at 
org.springframework.web.filter.OncePerRequestFilter.doFilter(Ljavax/servlet/ServletReque

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

2021-05-20 Thread GitBox


tianshuang commented on pull request #419:
URL: https://github.com/apache/tomcat/pull/419#issuecomment-845131930


   My solution did not change the original semantics. Please take a closer 
look. It just adjusted the calling order of part.getString to avoid the OOM 
problem of large strings. After I compiled tomcat locally and tested it, I 
solved the OOM problem when part.getString was called in advance for huge 
strings and insufficient memory.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



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



[tomcat] branch master updated: Avoid using local host name when not needed

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

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


The following commit(s) were added to refs/heads/master by this push:
 new a7511a7  Avoid using local host name when not needed
a7511a7 is described below

commit a7511a76e41269b842a8721ad729f8e54a2a8c8b
Author: remm 
AuthorDate: Thu May 20 16:13:34 2021 +0200

Avoid using local host name when not needed

BZ65301
---
 java/org/apache/catalina/valves/RemoteIpValve.java | 6 --
 webapps/docs/changelog.xml | 4 
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/catalina/valves/RemoteIpValve.java 
b/java/org/apache/catalina/valves/RemoteIpValve.java
index d9a52b1..61dcbfb 100644
--- a/java/org/apache/catalina/valves/RemoteIpValve.java
+++ b/java/org/apache/catalina/valves/RemoteIpValve.java
@@ -609,7 +609,7 @@ public class RemoteIpValve extends ValveBase {
 final String originalScheme = request.getScheme();
 final boolean originalSecure = request.isSecure();
 final String originalServerName = request.getServerName();
-final String originalLocalName = request.getLocalName();
+final String originalLocalName = isChangeLocalName() ? 
request.getLocalName() : null;
 final int originalServerPort = request.getServerPort();
 final int originalLocalPort = request.getLocalPort();
 final String originalProxiesHeader = request.getHeader(proxiesHeader);
@@ -768,7 +768,9 @@ public class RemoteIpValve extends ValveBase {
 request.setSecure(originalSecure);
 request.getCoyoteRequest().scheme().setString(originalScheme);
 
request.getCoyoteRequest().serverName().setString(originalServerName);
-
request.getCoyoteRequest().localName().setString(originalLocalName);
+if (isChangeLocalName()) {
+
request.getCoyoteRequest().localName().setString(originalLocalName);
+}
 request.setServerPort(originalServerPort);
 request.setLocalPort(originalLocalPort);
 
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index c7e7cc9..2cdab01 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -108,6 +108,10 @@
   
 
   
+65301: RemoteIpValve will now avoid getting
+the local host name when it is not needed. (remm)
+  
+  
 65308: NPE in JNDIRealm when no 
userRoleAttribute
 is given. (fschumacher)
   

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



[tomcat] branch master updated: Improve language

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

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


The following commit(s) were added to refs/heads/master by this push:
 new af16402  Improve language
af16402 is described below

commit af16402ace9f68fdf4294be337bc9e96d5dce660
Author: Mark Thomas 
AuthorDate: Thu May 20 15:20:22 2021 +0100

Improve language
---
 java/org/apache/catalina/User.java |  8 
 .../tribes/group/interceptors/TcpFailureDetector.java  |  2 +-
 java/org/apache/coyote/Response.java   |  2 +-
 java/org/apache/tomcat/util/buf/Utf8Decoder.java   |  2 +-
 .../apache/tomcat/util/net/openssl/OpenSSLEngine.java  |  6 +++---
 webapps/docs/appdev/build.xml.txt  |  4 ++--
 webapps/docs/appdev/deployment.xml |  4 ++--
 webapps/docs/appdev/processes.xml  |  2 +-
 webapps/docs/manager-howto.xml |  4 ++--
 webapps/docs/realm-howto.xml   | 18 +-
 .../WEB-INF/classes/websocket/drawboard/Room.java  |  2 +-
 11 files changed, 27 insertions(+), 27 deletions(-)

diff --git a/java/org/apache/catalina/User.java 
b/java/org/apache/catalina/User.java
index e50fd8f..7f1d1e5 100644
--- a/java/org/apache/catalina/User.java
+++ b/java/org/apache/catalina/User.java
@@ -24,10 +24,10 @@ import java.util.Iterator;
 
 
 /**
- * Abstract representation of a user in a {@link UserDatabase}.  Each user
- * is optionally associated with a set of {@link Group}s through which he or
- * she inherits additional security roles, and is optionally assigned a set
- * of specific {@link Role}s.
+ * Abstract representation of a user in a {@link UserDatabase}.  Each user is
+ * optionally associated with a set of {@link Group}s through which they 
inherit
+ * additional security roles, and is optionally assigned a set of specific
+ * {@link Role}s.
  *
  * @author Craig R. McClanahan
  * @since 4.1
diff --git 
a/java/org/apache/catalina/tribes/group/interceptors/TcpFailureDetector.java 
b/java/org/apache/catalina/tribes/group/interceptors/TcpFailureDetector.java
index 746786e..e493540 100644
--- a/java/org/apache/catalina/tribes/group/interceptors/TcpFailureDetector.java
+++ b/java/org/apache/catalina/tribes/group/interceptors/TcpFailureDetector.java
@@ -265,7 +265,7 @@ public class TcpFailureDetector extends 
ChannelInterceptorBase implements TcpFai
 continue;
 }
 if (membership.memberAlive(members[i])) {
-//we don't have this one in our membership, check to see if 
he/she is alive
+//we don't have this one in our membership, check to see if 
the member is alive
 if (memberAlive(members[i])) {
 
log.warn(sm.getString("tcpFailureDetector.performBasicCheck.memberAdded", 
members[i]));
 super.memberAdded(members[i]);
diff --git a/java/org/apache/coyote/Response.java 
b/java/org/apache/coyote/Response.java
index 99d3324..f46dfed 100644
--- a/java/org/apache/coyote/Response.java
+++ b/java/org/apache/coyote/Response.java
@@ -432,7 +432,7 @@ public final class Response {
 return true;
 } catch( NumberFormatException ex ) {
 // Do nothing - the spec doesn't have any "throws"
-// and the user might know what he's doing
+// and the user might know what they're doing
 return false;
 }
 }
diff --git a/java/org/apache/tomcat/util/buf/Utf8Decoder.java 
b/java/org/apache/tomcat/util/buf/Utf8Decoder.java
index ca819c42..932e88c 100644
--- a/java/org/apache/tomcat/util/buf/Utf8Decoder.java
+++ b/java/org/apache/tomcat/util/buf/Utf8Decoder.java
@@ -155,7 +155,7 @@ public class Utf8Decoder extends CharsetDecoder {
 int inIndex = pos + in.arrayOffset();
 int outIndex = out.position() + out.arrayOffset();
 // if someone would change the limit in process,
-// he would face consequences
+// they would face consequences
 for (; inIndex < inIndexLimit && outRemaining > 0; inIndex++) {
 int jchar = bArr[inIndex];
 if (jchar < 0) {
diff --git a/java/org/apache/tomcat/util/net/openssl/OpenSSLEngine.java 
b/java/org/apache/tomcat/util/net/openssl/OpenSSLEngine.java
index a12074a..0a9b463 100644
--- a/java/org/apache/tomcat/util/net/openssl/OpenSSLEngine.java
+++ b/java/org/apache/tomcat/util/net/openssl/OpenSSLEngine.java
@@ -903,11 +903,11 @@ public final class OpenSSLEngine extends SSLEngine 
implements SSLUtil.ProtocolIn
 accepted = Accepted.EXPLICIT;
 break;
 case IMPLICIT:
-// A user did not start handshake by calling this method by 
him/herself,
+// A user did not start handshake by calling this method by 
themselves,
 // but handsh

[tomcat] branch 9.0.x updated: Improve language

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

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


The following commit(s) were added to refs/heads/9.0.x by this push:
 new 6464db0  Improve language
6464db0 is described below

commit 6464db012f2f8a7eba0b46014ecfe78fc81621ff
Author: Mark Thomas 
AuthorDate: Thu May 20 15:20:22 2021 +0100

Improve language
---
 java/org/apache/catalina/User.java |  8 
 .../tribes/group/interceptors/TcpFailureDetector.java  |  2 +-
 java/org/apache/coyote/Response.java   |  2 +-
 java/org/apache/tomcat/util/buf/Utf8Decoder.java   |  2 +-
 .../apache/tomcat/util/net/openssl/OpenSSLEngine.java  |  6 +++---
 webapps/docs/appdev/build.xml.txt  |  4 ++--
 webapps/docs/appdev/deployment.xml |  4 ++--
 webapps/docs/appdev/processes.xml  |  2 +-
 webapps/docs/manager-howto.xml |  4 ++--
 webapps/docs/realm-howto.xml   | 18 +-
 .../WEB-INF/classes/websocket/drawboard/Room.java  |  2 +-
 11 files changed, 27 insertions(+), 27 deletions(-)

diff --git a/java/org/apache/catalina/User.java 
b/java/org/apache/catalina/User.java
index e50fd8f..7f1d1e5 100644
--- a/java/org/apache/catalina/User.java
+++ b/java/org/apache/catalina/User.java
@@ -24,10 +24,10 @@ import java.util.Iterator;
 
 
 /**
- * Abstract representation of a user in a {@link UserDatabase}.  Each user
- * is optionally associated with a set of {@link Group}s through which he or
- * she inherits additional security roles, and is optionally assigned a set
- * of specific {@link Role}s.
+ * Abstract representation of a user in a {@link UserDatabase}.  Each user is
+ * optionally associated with a set of {@link Group}s through which they 
inherit
+ * additional security roles, and is optionally assigned a set of specific
+ * {@link Role}s.
  *
  * @author Craig R. McClanahan
  * @since 4.1
diff --git 
a/java/org/apache/catalina/tribes/group/interceptors/TcpFailureDetector.java 
b/java/org/apache/catalina/tribes/group/interceptors/TcpFailureDetector.java
index 746786e..e493540 100644
--- a/java/org/apache/catalina/tribes/group/interceptors/TcpFailureDetector.java
+++ b/java/org/apache/catalina/tribes/group/interceptors/TcpFailureDetector.java
@@ -265,7 +265,7 @@ public class TcpFailureDetector extends 
ChannelInterceptorBase implements TcpFai
 continue;
 }
 if (membership.memberAlive(members[i])) {
-//we don't have this one in our membership, check to see if 
he/she is alive
+//we don't have this one in our membership, check to see if 
the member is alive
 if (memberAlive(members[i])) {
 
log.warn(sm.getString("tcpFailureDetector.performBasicCheck.memberAdded", 
members[i]));
 super.memberAdded(members[i]);
diff --git a/java/org/apache/coyote/Response.java 
b/java/org/apache/coyote/Response.java
index 1a0f0f9..5fb1476 100644
--- a/java/org/apache/coyote/Response.java
+++ b/java/org/apache/coyote/Response.java
@@ -422,7 +422,7 @@ public final class Response {
 return true;
 } catch( NumberFormatException ex ) {
 // Do nothing - the spec doesn't have any "throws"
-// and the user might know what he's doing
+// and the user might know what they're doing
 return false;
 }
 }
diff --git a/java/org/apache/tomcat/util/buf/Utf8Decoder.java 
b/java/org/apache/tomcat/util/buf/Utf8Decoder.java
index ca819c42..932e88c 100644
--- a/java/org/apache/tomcat/util/buf/Utf8Decoder.java
+++ b/java/org/apache/tomcat/util/buf/Utf8Decoder.java
@@ -155,7 +155,7 @@ public class Utf8Decoder extends CharsetDecoder {
 int inIndex = pos + in.arrayOffset();
 int outIndex = out.position() + out.arrayOffset();
 // if someone would change the limit in process,
-// he would face consequences
+// they would face consequences
 for (; inIndex < inIndexLimit && outRemaining > 0; inIndex++) {
 int jchar = bArr[inIndex];
 if (jchar < 0) {
diff --git a/java/org/apache/tomcat/util/net/openssl/OpenSSLEngine.java 
b/java/org/apache/tomcat/util/net/openssl/OpenSSLEngine.java
index a12074a..0a9b463 100644
--- a/java/org/apache/tomcat/util/net/openssl/OpenSSLEngine.java
+++ b/java/org/apache/tomcat/util/net/openssl/OpenSSLEngine.java
@@ -903,11 +903,11 @@ public final class OpenSSLEngine extends SSLEngine 
implements SSLUtil.ProtocolIn
 accepted = Accepted.EXPLICIT;
 break;
 case IMPLICIT:
-// A user did not start handshake by calling this method by 
him/herself,
+// A user did not start handshake by calling this method by 
themselves,
 // but handshak

[Bug 65124] Inefficient generated JSP code

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

--- Comment #17 from John Engebretson  ---
Our Tomcat8 implementation modified Generator.java along the following lines:

1. When a tag call is found (any tag!):
- generate a method name that uniquely identifies the tag class and the
provided attributes
- add the name/details to a list
- generate code that calls the named method
2. Near the end of the file (after all calls are processed):
- iterate through the loop
- generate each method

The sample code attachment includes the method generateOptimizedTagCall().  Let
me know if you'd like to see more snippets... sorry, I know it's hard to read
only pieces of the whole.

The end result is that all JSPs everywhere become smaller, with zero
application change or even activation required.  I only see disadvantages with
a tag-specific, application-specific solution.

-- 
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: Improve language

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

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


The following commit(s) were added to refs/heads/8.5.x by this push:
 new 9ba6f71  Improve language
9ba6f71 is described below

commit 9ba6f712bb1304245ad2d68ed325dfdded06b284
Author: Mark Thomas 
AuthorDate: Thu May 20 15:20:22 2021 +0100

Improve language
---
 java/org/apache/catalina/User.java |  8 
 .../tribes/group/interceptors/TcpFailureDetector.java  |  2 +-
 java/org/apache/coyote/Response.java   |  2 +-
 java/org/apache/tomcat/util/buf/Utf8Decoder.java   |  2 +-
 .../apache/tomcat/util/net/openssl/OpenSSLEngine.java  |  6 +++---
 webapps/docs/appdev/build.xml.txt  |  4 ++--
 webapps/docs/appdev/deployment.xml |  4 ++--
 webapps/docs/appdev/processes.xml  |  2 +-
 webapps/docs/manager-howto.xml |  4 ++--
 webapps/docs/realm-howto.xml   | 18 +-
 .../WEB-INF/classes/websocket/drawboard/Room.java  |  2 +-
 11 files changed, 27 insertions(+), 27 deletions(-)

diff --git a/java/org/apache/catalina/User.java 
b/java/org/apache/catalina/User.java
index e50fd8f..7f1d1e5 100644
--- a/java/org/apache/catalina/User.java
+++ b/java/org/apache/catalina/User.java
@@ -24,10 +24,10 @@ import java.util.Iterator;
 
 
 /**
- * Abstract representation of a user in a {@link UserDatabase}.  Each user
- * is optionally associated with a set of {@link Group}s through which he or
- * she inherits additional security roles, and is optionally assigned a set
- * of specific {@link Role}s.
+ * Abstract representation of a user in a {@link UserDatabase}.  Each user is
+ * optionally associated with a set of {@link Group}s through which they 
inherit
+ * additional security roles, and is optionally assigned a set of specific
+ * {@link Role}s.
  *
  * @author Craig R. McClanahan
  * @since 4.1
diff --git 
a/java/org/apache/catalina/tribes/group/interceptors/TcpFailureDetector.java 
b/java/org/apache/catalina/tribes/group/interceptors/TcpFailureDetector.java
index 04a5974..7d0e857 100644
--- a/java/org/apache/catalina/tribes/group/interceptors/TcpFailureDetector.java
+++ b/java/org/apache/catalina/tribes/group/interceptors/TcpFailureDetector.java
@@ -264,7 +264,7 @@ public class TcpFailureDetector extends 
ChannelInterceptorBase implements TcpFai
 continue;
 }
 if (membership.memberAlive(members[i])) {
-//we don't have this one in our membership, check to see if 
he/she is alive
+//we don't have this one in our membership, check to see if 
the member is alive
 if (memberAlive(members[i])) {
 
log.warn(sm.getString("tcpFailureDetector.performBasicCheck.memberAdded", 
members[i]));
 super.memberAdded(members[i]);
diff --git a/java/org/apache/coyote/Response.java 
b/java/org/apache/coyote/Response.java
index 6a6c787..3af1861 100644
--- a/java/org/apache/coyote/Response.java
+++ b/java/org/apache/coyote/Response.java
@@ -403,7 +403,7 @@ public final class Response {
 return true;
 } catch( NumberFormatException ex ) {
 // Do nothing - the spec doesn't have any "throws"
-// and the user might know what he's doing
+// and the user might know what they're doing
 return false;
 }
 }
diff --git a/java/org/apache/tomcat/util/buf/Utf8Decoder.java 
b/java/org/apache/tomcat/util/buf/Utf8Decoder.java
index ca819c42..932e88c 100644
--- a/java/org/apache/tomcat/util/buf/Utf8Decoder.java
+++ b/java/org/apache/tomcat/util/buf/Utf8Decoder.java
@@ -155,7 +155,7 @@ public class Utf8Decoder extends CharsetDecoder {
 int inIndex = pos + in.arrayOffset();
 int outIndex = out.position() + out.arrayOffset();
 // if someone would change the limit in process,
-// he would face consequences
+// they would face consequences
 for (; inIndex < inIndexLimit && outRemaining > 0; inIndex++) {
 int jchar = bArr[inIndex];
 if (jchar < 0) {
diff --git a/java/org/apache/tomcat/util/net/openssl/OpenSSLEngine.java 
b/java/org/apache/tomcat/util/net/openssl/OpenSSLEngine.java
index a12074a..0a9b463 100644
--- a/java/org/apache/tomcat/util/net/openssl/OpenSSLEngine.java
+++ b/java/org/apache/tomcat/util/net/openssl/OpenSSLEngine.java
@@ -903,11 +903,11 @@ public final class OpenSSLEngine extends SSLEngine 
implements SSLUtil.ProtocolIn
 accepted = Accepted.EXPLICIT;
 break;
 case IMPLICIT:
-// A user did not start handshake by calling this method by 
him/herself,
+// A user did not start handshake by calling this method by 
themselves,
 // but handshak

[tomcat] branch 9.0.x updated: Avoid using local host name when not needed

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

remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
 new 7919934  Avoid using local host name when not needed
7919934 is described below

commit 7919934187980339c0148d15f95b48d655ed779d
Author: remm 
AuthorDate: Thu May 20 16:13:34 2021 +0200

Avoid using local host name when not needed

BZ65301
---
 java/org/apache/catalina/valves/RemoteIpValve.java | 6 --
 webapps/docs/changelog.xml | 4 
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/catalina/valves/RemoteIpValve.java 
b/java/org/apache/catalina/valves/RemoteIpValve.java
index 2497b01..0dbd186 100644
--- a/java/org/apache/catalina/valves/RemoteIpValve.java
+++ b/java/org/apache/catalina/valves/RemoteIpValve.java
@@ -609,7 +609,7 @@ public class RemoteIpValve extends ValveBase {
 final String originalScheme = request.getScheme();
 final boolean originalSecure = request.isSecure();
 final String originalServerName = request.getServerName();
-final String originalLocalName = request.getLocalName();
+final String originalLocalName = isChangeLocalName() ? 
request.getLocalName() : null;
 final int originalServerPort = request.getServerPort();
 final int originalLocalPort = request.getLocalPort();
 final String originalProxiesHeader = request.getHeader(proxiesHeader);
@@ -768,7 +768,9 @@ public class RemoteIpValve extends ValveBase {
 request.setSecure(originalSecure);
 request.getCoyoteRequest().scheme().setString(originalScheme);
 
request.getCoyoteRequest().serverName().setString(originalServerName);
-
request.getCoyoteRequest().localName().setString(originalLocalName);
+if (isChangeLocalName()) {
+
request.getCoyoteRequest().localName().setString(originalLocalName);
+}
 request.setServerPort(originalServerPort);
 request.setLocalPort(originalLocalPort);
 
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index e1209f8..129dda5 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -108,6 +108,10 @@
   
 
   
+65301: RemoteIpValve will now avoid getting
+the local host name when it is not needed. (remm)
+  
+  
 65308: NPE in JNDIRealm when no 
userRoleAttribute
 is given. (fschumacher)
   

-
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: Avoid using local host name when not needed

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

remm 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 c736449  Avoid using local host name when not needed
c736449 is described below

commit c736449509a6eeb656ad54ba1926a5d58f74bbc9
Author: remm 
AuthorDate: Thu May 20 16:13:34 2021 +0200

Avoid using local host name when not needed

BZ65301
---
 java/org/apache/catalina/valves/RemoteIpValve.java | 6 --
 webapps/docs/changelog.xml | 4 
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/catalina/valves/RemoteIpValve.java 
b/java/org/apache/catalina/valves/RemoteIpValve.java
index 2497b01..0dbd186 100644
--- a/java/org/apache/catalina/valves/RemoteIpValve.java
+++ b/java/org/apache/catalina/valves/RemoteIpValve.java
@@ -609,7 +609,7 @@ public class RemoteIpValve extends ValveBase {
 final String originalScheme = request.getScheme();
 final boolean originalSecure = request.isSecure();
 final String originalServerName = request.getServerName();
-final String originalLocalName = request.getLocalName();
+final String originalLocalName = isChangeLocalName() ? 
request.getLocalName() : null;
 final int originalServerPort = request.getServerPort();
 final int originalLocalPort = request.getLocalPort();
 final String originalProxiesHeader = request.getHeader(proxiesHeader);
@@ -768,7 +768,9 @@ public class RemoteIpValve extends ValveBase {
 request.setSecure(originalSecure);
 request.getCoyoteRequest().scheme().setString(originalScheme);
 
request.getCoyoteRequest().serverName().setString(originalServerName);
-
request.getCoyoteRequest().localName().setString(originalLocalName);
+if (isChangeLocalName()) {
+
request.getCoyoteRequest().localName().setString(originalLocalName);
+}
 request.setServerPort(originalServerPort);
 request.setLocalPort(originalLocalPort);
 
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 8f8304c..c07a701 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -108,6 +108,10 @@
   
 
   
+65301: RemoteIpValve will now avoid getting
+the local host name when it is not needed. (remm)
+  
+  
 65308: NPE in JNDIRealm when no 
userRoleAttribute
 is given. (fschumacher)
   

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



[Bug 65301] the enableLookups configuration is not fully active

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

Remy Maucherat  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #5 from Remy Maucherat  ---
Fixed RemoteIpValve to avoid using the local host name if not really needed.
The change will be in 10.0.7, 9.0.47 and 8.5.67.

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



Questions on the contribution process

2021-05-20 Thread Neale Rudd

Hi All,

I am currently working on a new catalina filter for Tomcat.

I will submit my ideas and code for discussion using Bugzilla.

While I was able to find the style guide and submissions guide, I still 
have a few questions about the process:


- Romain has pointed me to 
https://github.com/apache/tomcat/blob/master/webapps/docs/config/filter.xml 
for adding a documentation diff, so I think I have that covered


- should I submit a separate javax and jakarta version or is someone in 
charge of backports?


- is there a way to generate the javadoc for the class?ᅡᅠ I can't see 
comments above the functions in the other filters, so is this manually 
written in HTML or is there a file which automatically generates it 
separate to the source code?ᅡᅠ For example, how is 
https://tomcat.apache.org/tomcat-8.0-doc/api/org/apache/catalina/filters/HttpHeaderSecurityFilter.html 
created?


- is there anything else which I should be submitting along with the new 
class?


I couldn't find the answers to these questions in the submission 
guidelines so I'm asking here.


It may also be helpful if the answers were added to the submission guide 
page for other new contributors to avoid them asking the same questions.


Thanks for your help,
Neale Rudd
metawerx.net


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



Re: Questions on the contribution process

2021-05-20 Thread Mark Thomas

On 20/05/2021 15:36, Neale Rudd wrote:

Hi All,

I am currently working on a new catalina filter for Tomcat.

I will submit my ideas and code for discussion using Bugzilla.


I'd recommend you do that earlier rather than later. I wouldn't want you 
spend time producing this filter only to find out that the Tomcat 
community doesn't want to include it.


While I was able to find the style guide and submissions guide, I still 
have a few questions about the process:


- Romain has pointed me to 
https://github.com/apache/tomcat/blob/master/webapps/docs/config/filter.xml 
for adding a documentation diff, so I think I have that covered


- should I submit a separate javax and jakarta version or is someone in 
charge of backports?


So far, the javax / jakarta switch hasn't caused too many issues for 
back-ports. I'd suggest starting with a patch/PR against 10 and we 
should be able to back-port fairly automatically.


- is there a way to generate the javadoc for the class?ᅡᅠ I can't see 
comments above the functions in the other filters, so is this manually 
written in HTML or is there a file which automatically generates it 
separate to the source code?ᅡᅠ For example, how is 
https://tomcat.apache.org/tomcat-8.0-doc/api/org/apache/catalina/filters/HttpHeaderSecurityFilter.html 
created?


Nope. All the Javadoc is generated from the source code. Keep in mind 
that classes automatically inherit Javadoc from their superclass. 
Generally, we try and keep unnecessary code out of the codebase so we 
don't use @inheritDoc where we don't have to.


- is there anything else which I should be submitting along with the new 
class?


A changelog entry is always appreciated.

I couldn't find the answers to these questions in the submission 
guidelines so I'm asking here.


It may also be helpful if the answers were added to the submission guide 
page for other new contributors to avoid them asking the same questions.


Patches for the submissions guide, style guide and other docs are as 
welcome as those for the code.


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 pull request #419: part.getString will cause OOM without checking maxPostSize, checking maxPostSize first will avoid OOM caused by huge string

2021-05-20 Thread GitBox


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


   Re-opening to take another look.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



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



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

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

--- Comment #1 from Mark Thomas  ---
Do you have a test case that reproduces this?

-- 
You are receiving this mail because:
You are the assignee for the bug.
-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



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

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

--- Comment #2 from Mark Thomas  ---
No need for a test case. I've been able to build a unit test that demonstrates
this.

-- 
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 65124] Inefficient generated JSP code

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

--- Comment #18 from Christopher Schultz  ---
These are good ideas, especially the Objective-C-style
_callTag_org_apache_taglibs_standard_tag_rt_core_SetTag_With_var_And_value
method generation and invocation.

The biggest problem with Java-code generation from JSPs these days is the
amount of code being generated into a single Java method. It's not uncommon to
have so must stuff in a JSP that at least one of the generated-methods hits the
64kb limit.

So anything that can reduce the amount of generated code in the _jsp_service
method should be a priority.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



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

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

--- Comment #3 from Mark Thomas  ---
Test case now passes with the proposed patch applied.

There are a lot of edge cases here so I want to run the Autobahn test suite
before committing this.

-- 
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 65181] Tomcat Native library with OpenSSL Engine private key loading

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

--- Comment #11 from Edin Hodzic  ---
Created attachment 37870
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=37870&action=edit
keep structural reference to the SSL Engine pointed to by tcn_ssl_engine

Found another problem with the recent engine related change.

Got to keep a "structural" reference to the engine so the tcn_ssl_engine
pointer remains valid at the time it's used for loading private key.

Please see the tcn-1.2.28.diff attachment for a patch.

-- 
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 65181] Tomcat Native library with OpenSSL Engine private key loading

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

--- Comment #12 from Edin Hodzic  ---
Comment on attachment 37870
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=37870
keep structural reference to the SSL Engine pointed to by tcn_ssl_engine

diff -aur tomcat-native-1.2.28-src/native/src/ssl.c
tomcat-native-1.2.28-src.changed/native/src/ssl.c
--- tomcat-native-1.2.28-src/native/src/ssl.c   2021-04-01 06:28:54.0
-0700
+++ tomcat-native-1.2.28-src.changed/native/src/ssl.c   2021-05-20
13:21:18.569612200 -0700
@@ -367,6 +367,14 @@
 #endif
 free_dh_params();

+#ifndef OPENSSL_NO_ENGINE
+if (tcn_ssl_engine != NULL) {
+/* Release the SSL Engine structural reference */
+ENGINE_free(tcn_ssl_engine);
+tcn_ssl_engine = NULL;
+}
+#endif
+
 #if OPENSSL_VERSION_NUMBER >= 0x1010L && !defined(LIBRESSL_VERSION_NUMBER)
 /* Openssl v1.1+ handles all termination automatically. Do
  * nothing in this case.
@@ -815,9 +823,9 @@
 if (!ENGINE_set_default(ee, ENGINE_METHOD_ALL))
 err = APR_ENOTIMPL;
 }
-/* Free our "structural" reference. */
+/* Keep our "structural" reference. */
 if (ee)
-ENGINE_free(ee);
+tcn_ssl_engine = ee;
 }
 if (err != APR_SUCCESS) {
 TCN_FREE_CSTRING(engine);
@@ -825,7 +833,6 @@
 tcn_ThrowAPRException(e, err);
 return (jint)err;
 }
-tcn_ssl_engine = ee;
 }
 #endif

-- 
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 65181] Tomcat Native library with OpenSSL Engine private key loading

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

Edin Hodzic  changed:

   What|Removed |Added

  Attachment #37870|0   |1
is obsolete||

--- Comment #13 from Edin Hodzic  ---
Created attachment 37871
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=37871&action=edit
keep structural reference to the SSL Engine pointed to by tcn_ssl_engine

improved diff

-- 
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 65181] Tomcat Native library with OpenSSL Engine private key loading

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

Edin Hodzic  changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
 Resolution|FIXED   |---

-- 
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 65181] Tomcat Native library with OpenSSL Engine private key loading

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

--- Comment #14 from Edin Hodzic  ---
One other potential improvement in the OpenSSL interaction might be to enable
OpenSSL configuration:

In ssl.c, initialization is done with the call:
OPENSSL_init_ssl(OPENSSL_INIT_ENGINE_ALL_BUILTIN, NULL);

The openssl command in OpenSSL source performs initialization like this:
OPENSSL_init_ssl(OPENSSL_INIT_ENGINE_ALL_BUILTIN |
OPENSSL_INIT_LOAD_CONFIG, NULL);

The OPENSSL_INIT_LOAD_CONFIG makes the OpenSSL library load configuration (for
example /etc/ssl/openssl.cnf by default on Ubuntu). The configuration could
also be specified through a path in OPENSSL_CONF environment variable (that
could be set in setenv.sh in Tomcat for full control over the OpenSSL
configuration.)

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