[Bug 66511] New: GZipOutputFilter overwrites chunk instead of reading it

2023-03-06 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=66511

Bug ID: 66511
   Summary: GZipOutputFilter overwrites chunk instead of reading
it
   Product: Tomcat 10
   Version: 10.1.7
  Hardware: PC
OS: Mac OS X 10.1
Status: NEW
  Severity: normal
  Priority: P2
 Component: Connectors
  Assignee: dev@tomcat.apache.org
  Reporter: pouts...@vmware.com
  Target Milestone: --

In GzipOutputFilter::doWrite, if the given ByteBuffer is not backed by an
array, it gets overwritten with empty data. 

See
https://github.com/apache/tomcat/blob/main/java/org/apache/coyote/http11/filters/GzipOutputFilter.java#L73

Suggested solution:

Replace ByteBuffer::put with ByteBuffer::get.

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



svn commit: r1908122 - in /tomcat/site/trunk: docs/security.html xdocs/security.xml

2023-03-06 Thread markt
Author: markt
Date: Mon Mar  6 12:25:03 2023
New Revision: 1908122

URL: http://svn.apache.org/viewvc?rev=1908122&view=rev
Log:
Add a paragraph setting out what is considered out of scope

Modified:
tomcat/site/trunk/docs/security.html
tomcat/site/trunk/xdocs/security.xml

Modified: tomcat/site/trunk/docs/security.html
URL: 
http://svn.apache.org/viewvc/tomcat/site/trunk/docs/security.html?rev=1908122&r1=1908121&r2=1908122&view=diff
==
--- tomcat/site/trunk/docs/security.html (original)
+++ tomcat/site/trunk/docs/security.html Mon Mar  6 12:25:03 2023
@@ -48,21 +48,34 @@
   
 
 
-  Reporting 
New Security Problems with Apache Tomcat
-The Apache Software Foundation takes a very active stance in eliminating
-   security problems and denial of service attacks against Apache Tomcat.
+  Reporting New 
Security Problems with Tomcat
+The ASF takes a very active stance in eliminating security problems and
+   denial of service attacks against Tomcat.

 
 We strongly encourage folks to report such problems to our private
security mailing list first, before disclosing them in a public forum.

 
+Reports of problems that require any of the following will be considered
+   out of scope and will not be accepted by the Tomcat security team. The
+   list is not exhaustive.
+   
+ Access to Tomcat's configuration files.
+ Deployment of a vulnerable web application.
+ Deployment of a malicious web application unless a SecurityManager
+ is configured with an appropriate security policy and the web
+ application is able to bypass a restriction enforced by the
+ SecurityManager.
+   
+
+
 Please note that the security mailing list should only be used
-   for reporting undisclosed security vulnerabilities in Apache Tomcat and
-   managing the process of fixing such vulnerabilities. We cannot accept
-   regular bug reports or other queries at this address. All mail sent to
-   this address that does not relate to an undisclosed security problem in
-   the Apache Tomcat source code will be ignored.
+   for reporting undisclosed security vulnerabilities in Tomcat and 
managing
+   the process of fixing such vulnerabilities. We cannot accept regular bug
+   reports or other queries at this address. All mail sent to this address
+   that does not relate to an undisclosed security problem in the Tomcat
+   source code will be ignored.
 
 If you need to report a bug that isn't an undisclosed security
vulnerability, please use the bug reporting

Modified: tomcat/site/trunk/xdocs/security.xml
URL: 
http://svn.apache.org/viewvc/tomcat/site/trunk/xdocs/security.xml?rev=1908122&r1=1908121&r2=1908122&view=diff
==
--- tomcat/site/trunk/xdocs/security.xml (original)
+++ tomcat/site/trunk/xdocs/security.xml Mon Mar  6 12:25:03 2023
@@ -58,21 +58,34 @@
 
   
 
-  
-The Apache Software Foundation takes a very active stance in eliminating
-   security problems and denial of service attacks against Apache Tomcat.
+  
+The ASF takes a very active stance in eliminating security problems and
+   denial of service attacks against Tomcat.

 
 We strongly encourage folks to report such problems to our private
security mailing list first, before disclosing them in a public forum.

 
+Reports of problems that require any of the following will be considered
+   out of scope and will not be accepted by the Tomcat security team. The
+   list is not exhaustive.
+   
+ Access to Tomcat's configuration files.
+ Deployment of a vulnerable web application.
+ Deployment of a malicious web application unless a SecurityManager
+ is configured with an appropriate security policy and the web
+ application is able to bypass a restriction enforced by the
+ SecurityManager.
+   
+
+
 Please note that the security mailing list should only be used
-   for reporting undisclosed security vulnerabilities in Apache Tomcat and
-   managing the process of fixing such vulnerabilities. We cannot accept
-   regular bug reports or other queries at this address. All mail sent to
-   this address that does not relate to an undisclosed security problem in
-   the Apache Tomcat source code will be ignored.
+   for reporting undisclosed security vulnerabilities in Tomcat and 
managing
+   the process of fixing such vulnerabilities. We cannot accept regular bug
+   reports or other queries at this address. All mail sent to this address
+   that does not relate to an undisclosed security problem in the Tomcat
+   source code will be ignored.
 
 If you need to

[VOTE][RESULT] Release Apache Tomcat 11.0.0-M4

2023-03-06 Thread Mark Thomas

The following votes were cast:

Binding:
+1: lihan, markt, remm

Non-binding:
+1: Dimitris Soumis

The vote therefore passes.

Thanks to everyone who contributed to this release.

Mark


On 27/02/2023 20:32, Mark Thomas wrote:

The proposed Apache Tomcat 11.0.0-M4 release is now available for
voting.

Apache Tomcat 11.0.0-M4 is a milestone release of the 11.0.x branch and 
has been made to provide users with early access to the new features in 
Apache Tomcat 11.0.x so that they may provide feedback. The notable 
changes compared to the previous milestone include:


- Revert the switch to using the ServiceLoader mechanism to load the
   custom URL protocol handlers that Tomcat uses. The original system
   property based approach has been restored.

- Provide an implementation of the sub-set of JavaBeans support that
   does not depend on the java.beans package. This for use by Expression
   Language when the java.desktop module (which is where the java.beans
   package resides) is not available.

- Restore inline state after async operation in NIO2, to account the
   fact that unexpected exceptions are sometimes thrown by the
   implementation. Patch submitted by zhougang.

For full details, see the change log:
https://nightlies.apache.org/tomcat/tomcat-11.0.x/docs/changelog.html

Applications that run on Tomcat 9 and earlier will not run on Tomcat 11 
without changes. Java EE applications designed for Tomcat 9 and earlier 
may be placed in the $CATALINA_BASE/webapps-javaee directory and Tomcat 
will automatically convert them to Jakarta EE and copy them to the 
webapps directory. Applications using deprecated APIs may require 
further changes.


It can be obtained from:
https://dist.apache.org/repos/dist/dev/tomcat/tomcat-11/v11.0.0-M4/

The Maven staging repo is:
https://repository.apache.org/content/repositories/orgapachetomcat-1425

The tag is:
https://github.com/apache/tomcat/tree/11.0.0-M4
3b6de549bdf4f6486c39daa0ae8e4d4b7475b1f6


The proposed 11.0.0-M4 release is:
[ ] Broken - do not release
[ ] Alpha  - go ahead and release as 11.0.0-M4

-
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



svn commit: r60470 - /dev/tomcat/tomcat-11/v11.0.0-M4/ /release/tomcat/tomcat-11/v11.0.0-M4/

2023-03-06 Thread markt
Author: markt
Date: Mon Mar  6 12:53:14 2023
New Revision: 60470

Log:
Release Tomcat 11.0.0-M4

Added:
release/tomcat/tomcat-11/v11.0.0-M4/
  - copied from r60469, dev/tomcat/tomcat-11/v11.0.0-M4/
Removed:
dev/tomcat/tomcat-11/v11.0.0-M4/


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



[Bug 65901] HTTP 401 response for a HEAD request violates HTTP spec by including a body

2023-03-06 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=65901

--- Comment #6 from Stefan Mayr  ---
After this ticket has celebrated its first birthday. Can anyone have a look
into this issue? Looking at the commit history maybe Rainer Jung or Mark Thomas

Thank you

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



svn commit: r1908124 - /tomcat/site/trunk/tools/doap.pl

2023-03-06 Thread markt
Author: markt
Date: Mon Mar  6 14:09:19 2023
New Revision: 1908124

URL: http://svn.apache.org/viewvc?rev=1908124&view=rev
Log:
Fix typo

Modified:
tomcat/site/trunk/tools/doap.pl

Modified: tomcat/site/trunk/tools/doap.pl
URL: 
http://svn.apache.org/viewvc/tomcat/site/trunk/tools/doap.pl?rev=1908124&r1=1908123&r2=1908124&view=diff
==
--- tomcat/site/trunk/tools/doap.pl (original)
+++ tomcat/site/trunk/tools/doap.pl Mon Mar  6 14:09:19 2023
@@ -2,7 +2,7 @@
 use strict;
 use warnings;
 
-# This script modifies the Tomcaat DOAP file to update to the latest release.
+# This script modifies the Tomcat DOAP file to update to the latest release.
 #
 #
 #  



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



svn commit: r1908125 - in /tomcat/site/trunk: ./ docs/tomcat-11.0-doc/ docs/tomcat-11.0-doc/annotationapi/ docs/tomcat-11.0-doc/annotationapi/jakarta/annotation/ docs/tomcat-11.0-doc/annotationapi/jak

2023-03-06 Thread markt
Author: markt
Date: Mon Mar  6 14:14:32 2023
New Revision: 1908125

URL: http://svn.apache.org/viewvc?rev=1908125&view=rev
Log:
Update docs for 11.0.0-M4 release


[This commit notification would consist of 65 parts, 
which exceeds the limit of 50 ones, so it was shortened to the summary.]

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



svn commit: r1908127 - in /tomcat/site/trunk: docs/ xdocs/

2023-03-06 Thread markt
Author: markt
Date: Mon Mar  6 14:21:33 2023
New Revision: 1908127

URL: http://svn.apache.org/viewvc?rev=1908127&view=rev
Log:
Update site for 11.0.0-M4 release

Modified:
tomcat/site/trunk/docs/download-11.html
tomcat/site/trunk/docs/index.html
tomcat/site/trunk/docs/migration-11.0.html
tomcat/site/trunk/docs/oldnews.html
tomcat/site/trunk/docs/security-11.html
tomcat/site/trunk/docs/whichversion.html
tomcat/site/trunk/xdocs/download-11.xml
tomcat/site/trunk/xdocs/index.xml
tomcat/site/trunk/xdocs/migration-11.0.xml
tomcat/site/trunk/xdocs/oldnews.xml
tomcat/site/trunk/xdocs/security-11.xml
tomcat/site/trunk/xdocs/whichversion.xml

Modified: tomcat/site/trunk/docs/download-11.html
URL: 
http://svn.apache.org/viewvc/tomcat/site/trunk/docs/download-11.html?rev=1908127&r1=1908126&r2=1908127&view=diff
==
--- tomcat/site/trunk/docs/download-11.html (original)
+++ tomcat/site/trunk/docs/download-11.html Mon Mar  6 14:21:33 2023
@@ -19,7 +19,7 @@
 
   Quick Navigation
 
-[define v]11.0.0-M3[end]
+[define v]11.0.0-M4[end]
 https://downloads.apache.org/tomcat/tomcat-11/KEYS";>KEYS |
 [v] (alpha) |
 Browse |

Modified: tomcat/site/trunk/docs/index.html
URL: 
http://svn.apache.org/viewvc/tomcat/site/trunk/docs/index.html?rev=1908127&r1=1908126&r2=1908127&view=diff
==
--- tomcat/site/trunk/docs/index.html (original)
+++ tomcat/site/trunk/docs/index.html Mon Mar  6 14:21:33 2023
@@ -34,6 +34,41 @@ wiki page.
 Apache Tomcat, Tomcat, Apache, the Apache feather, and the Apache Tomcat
 project logo are trademarks of the Apache Software Foundation.
 
+2023-03-06 Tomcat 11.0.0-M4 Released
+
+The Apache Tomcat Project is proud to announce the release of version 11.0.0-M4
+(alpha) of Apache Tomcat. This release is a milestone release and is targeted 
at
+Jakarta EE 11.
+Users of Tomcat 10 onwards should be aware that, as a result of the move 
from
+Java EE to Jakarta EE as part of the transfer of Java EE to the Eclipse
+Foundation, the primary package for all implemented APIs has changed from
+javax.* to jakarta.*. This will almost certainly
+require code changes to enable applications to migrate from Tomcat 9 and 
earlier
+to Tomcat 10 and later. A
+https://github.com/apache/tomcat-jakartaee-migration";>migration
+tool is under development to aid this process.
+The notable changes in this release are:
+
+  Revert the switch to using the ServiceLoader mechanism to load the custom
+  URL protocol handlers that Tomcat uses. The original system property 
based
+  approach has been restored.
+  Provide an implementation of the sub-set of JavaBeans support that does
+  not depend on the java.beans package. This for use by Expression Language
+  when the java.desktop module (which is where the java.beans package
+  resides) is not available.
+  Restore inline state after async operation in NIO2, to account the fact
+  that unexpected exceptions are sometimes thrown by the implementation.
+  Patch submitted by zhougang. 
+
+
+Full details of these changes, and all the other changes, are available in the
+Tomcat 11
+(alpha) changelog.
+
+
+
+https://tomcat.apache.org/download-11.cgi";>Download
+
 2023-03-03 Tomcat 10.1.7 Released
 
 The Apache Tomcat Project is proud to announce the release of version 10.1.7
@@ -131,35 +166,6 @@ changelog.
 
 https://tomcat.apache.org/download-90.cgi";>Download
 
-2023-02-23 Tomcat 11.0.0-M3 Released
-
-The Apache Tomcat Project is proud to announce the release of version 11.0.0-M3
-(alpha) of Apache Tomcat. This release is a milestone release and is targeted 
at
-Jakarta EE 11.
-Users of Tomcat 10 onwards should be aware that, as a result of the move 
from
-Java EE to Jakarta EE as part of the transfer of Java EE to the Eclipse
-Foundation, the primary package for all implemented APIs has changed from
-javax.* to jakarta.*. This will almost certainly
-require code changes to enable applications to migrate from Tomcat 9 and 
earlier
-to Tomcat 10 and later. A
-https://github.com/apache/tomcat-jakartaee-migration";>migration
-tool is under development to aid this process.
-The notable changes in this release are:
-
-Increase the minimum supported Java version to Java 17.
-Remove support for starting Tomcat under a SecurityManager.
-Remove JAX-RPC support which was removed from the Jakarta EE platform for
-Jakarta EE 9
-
-
-Full details of these changes, and all the other changes, are available in the
-Tomcat 11
-(alpha) changelog.
-
-
-
-https://tomcat.apache.org/download-11.cgi";>Download
-
 2023-02-13 Tomcat Native 2.0.3 Released
 
 The Apache Tomcat Project is proud to announce the release of version 2.0.3 of

Modified: tomcat/site/trunk/docs/migration-11.0.html
URL: 
http://svn.apache.org/viewvc/tomcat/site/trunk/docs/migration-11.0.html?rev

[tomcat] branch main updated: Fix BZ 66511 - GZip output with direct buffer was broken

2023-03-06 Thread markt
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/main by this push:
 new 339bd4c7dc Fix BZ 66511 - GZip output with direct buffer was broken
339bd4c7dc is described below

commit 339bd4c7dc22660f06cf5fe135c36fa22bded25c
Author: Mark Thomas 
AuthorDate: Mon Mar 6 14:26:29 2023 +

Fix BZ 66511 - GZip output with direct buffer was broken

Patch suggested by Arjen Poutsma
https://bz.apache.org/bugzilla/show_bug.cgi?id=66511
---
 java/org/apache/coyote/http11/filters/GzipOutputFilter.java | 2 +-
 webapps/docs/changelog.xml  | 5 +
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/coyote/http11/filters/GzipOutputFilter.java 
b/java/org/apache/coyote/http11/filters/GzipOutputFilter.java
index 9ef4afaada..39fa1fd63c 100644
--- a/java/org/apache/coyote/http11/filters/GzipOutputFilter.java
+++ b/java/org/apache/coyote/http11/filters/GzipOutputFilter.java
@@ -70,7 +70,7 @@ public class GzipOutputFilter implements OutputFilter {
 chunk.position(chunk.position() + len);
 } else {
 byte[] bytes = new byte[len];
-chunk.put(bytes);
+chunk.get(bytes);
 compressionStream.write(bytes, 0, len);
 }
 return len;
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 0a3e702dc0..8f421a274c 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -135,6 +135,11 @@
 characters as defined in RFC 8259. Based on code submitted by
 Thomas Meyer. (remm)
   
+  
+66511: Fix GzipOutputFilter (used for 
compressed
+HTTP responses) when used with direct buffers. Patch suggested by Arjen
+Poutsma. (markt)
+  
 
   
   


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



[tomcat] branch 10.1.x updated: Fix BZ 66511 - GZip output with direct buffer was broken

2023-03-06 Thread markt
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/10.1.x by this push:
 new 4685e12d5b Fix BZ 66511 - GZip output with direct buffer was broken
4685e12d5b is described below

commit 4685e12d5b1d186c0e139866849b07d29c34c117
Author: Mark Thomas 
AuthorDate: Mon Mar 6 14:26:29 2023 +

Fix BZ 66511 - GZip output with direct buffer was broken

Patch suggested by Arjen Poutsma
https://bz.apache.org/bugzilla/show_bug.cgi?id=66511
---
 java/org/apache/coyote/http11/filters/GzipOutputFilter.java | 2 +-
 webapps/docs/changelog.xml  | 5 +
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/coyote/http11/filters/GzipOutputFilter.java 
b/java/org/apache/coyote/http11/filters/GzipOutputFilter.java
index 9ef4afaada..39fa1fd63c 100644
--- a/java/org/apache/coyote/http11/filters/GzipOutputFilter.java
+++ b/java/org/apache/coyote/http11/filters/GzipOutputFilter.java
@@ -70,7 +70,7 @@ public class GzipOutputFilter implements OutputFilter {
 chunk.position(chunk.position() + len);
 } else {
 byte[] bytes = new byte[len];
-chunk.put(bytes);
+chunk.get(bytes);
 compressionStream.write(bytes, 0, len);
 }
 return len;
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 22a29ca59f..10e53df939 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -125,6 +125,11 @@
 characters as defined in RFC 8259. Based on code submitted by
 Thomas Meyer. (remm)
   
+  
+66511: Fix GzipOutputFilter (used for 
compressed
+HTTP responses) when used with direct buffers. Patch suggested by Arjen
+Poutsma. (markt)
+  
 
   
   


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



[tomcat] branch 9.0.x updated: Fix BZ 66511 - GZip output with direct buffer was broken

2023-03-06 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 d7f8782efe Fix BZ 66511 - GZip output with direct buffer was broken
d7f8782efe is described below

commit d7f8782efea21d36fa7cad0c81d3d285fa374e86
Author: Mark Thomas 
AuthorDate: Mon Mar 6 14:26:29 2023 +

Fix BZ 66511 - GZip output with direct buffer was broken

Patch suggested by Arjen Poutsma
https://bz.apache.org/bugzilla/show_bug.cgi?id=66511
---
 java/org/apache/coyote/http11/filters/GzipOutputFilter.java | 2 +-
 webapps/docs/changelog.xml  | 5 +
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/coyote/http11/filters/GzipOutputFilter.java 
b/java/org/apache/coyote/http11/filters/GzipOutputFilter.java
index 9ef4afaada..39fa1fd63c 100644
--- a/java/org/apache/coyote/http11/filters/GzipOutputFilter.java
+++ b/java/org/apache/coyote/http11/filters/GzipOutputFilter.java
@@ -70,7 +70,7 @@ public class GzipOutputFilter implements OutputFilter {
 chunk.position(chunk.position() + len);
 } else {
 byte[] bytes = new byte[len];
-chunk.put(bytes);
+chunk.get(bytes);
 compressionStream.write(bytes, 0, len);
 }
 return len;
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 818425ce04..4cbfec52f6 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -125,6 +125,11 @@
 characters as defined in RFC 8259. Based on code submitted by
 Thomas Meyer. (remm)
   
+  
+66511: Fix GzipOutputFilter (used for 
compressed
+HTTP responses) when used with direct buffers. Patch suggested by Arjen
+Poutsma. (markt)
+  
 
   
   


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



[tomcat] branch 8.5.x updated: Fix BZ 66511 - GZip output with direct buffer was broken

2023-03-06 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 13b04b3e5c Fix BZ 66511 - GZip output with direct buffer was broken
13b04b3e5c is described below

commit 13b04b3e5c7347dc263442f450105bc8ed798b4e
Author: Mark Thomas 
AuthorDate: Mon Mar 6 14:26:29 2023 +

Fix BZ 66511 - GZip output with direct buffer was broken

Patch suggested by Arjen Poutsma
https://bz.apache.org/bugzilla/show_bug.cgi?id=66511
---
 java/org/apache/coyote/http11/filters/GzipOutputFilter.java | 2 +-
 webapps/docs/changelog.xml  | 5 +
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/coyote/http11/filters/GzipOutputFilter.java 
b/java/org/apache/coyote/http11/filters/GzipOutputFilter.java
index e69179506e..834e563384 100644
--- a/java/org/apache/coyote/http11/filters/GzipOutputFilter.java
+++ b/java/org/apache/coyote/http11/filters/GzipOutputFilter.java
@@ -87,7 +87,7 @@ public class GzipOutputFilter implements OutputFilter {
 chunk.position(chunk.position() + len);
 } else {
 byte[] bytes = new byte[len];
-chunk.put(bytes);
+chunk.get(bytes);
 compressionStream.write(bytes, 0, len);
 }
 return len;
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index e7e83b1b0e..f85493198a 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -125,6 +125,11 @@
 characters as defined in RFC 8259. Based on code submitted by
 Thomas Meyer. (remm)
   
+  
+66511: Fix GzipOutputFilter (used for 
compressed
+HTTP responses) when used with direct buffers. Patch suggested by Arjen
+Poutsma. (markt)
+  
 
   
   


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



[ANN] Apache Tomcat 11.0.0-M4 (alpha) available

2023-03-06 Thread Mark Thomas

The Apache Tomcat team announces the immediate availability of Apache
Tomcat 11.0.0-M4 (alpha).

Apache Tomcat 11 is an open source software implementation of the
Jakarta Servlet, Jakarta Server Pages, Jakarta Expression Language,
Jakarta WebSocket, Jakarta Authentication and Jakarta Annotations
specifications.

Users of Tomcat 10 onwards should be aware that, as a result of the move
from Java EE to Jakarta EE as part of the transfer of Java EE to the
Eclipse Foundation, the primary package for all implemented APIs has
changed from javax.* to jakarta.*. This will almost certainly require
code changes to enable applications to migrate from Tomcat 9 and earlier
to Tomcat 10 and later. A migration tool is under development to aid
this process.

Apache Tomcat 11.0.0-M4 is a milestone release of the 11.0.x branch and 
has been made to provide users with early access to the new features in 
Apache Tomcat 11.0.x so that they may provide feedback. The notable 
changes compared to 11.0.0-M3 include:


- Revert the switch to using the ServiceLoader mechanism to load the
  custom URL protocol handlers that Tomcat uses. The original system
  property based approach has been restored.

- Provide an implementation of the sub-set of JavaBeans support that
  does not depend on the java.beans package. This for use by Expression
  Language when the java.desktop module (which is where the java.beans
  package resides) is not available.

- Restore inline state after async operation in NIO2, to account the
  fact that unexpected exceptions are sometimes thrown by the
  implementation. Patch submitted by zhougang.

Please refer to the change log for the complete list of changes:
http://tomcat.apache.org/tomcat-11.0-doc/changelog.html

Downloads:
http://tomcat.apache.org/download-11.cgi

Migration guides from Apache Tomcat 8.5.x, 9.0.x and 10.1.x:
http://tomcat.apache.org/migration.html

Enjoy!

- The Apache Tomcat team

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



[Bug 66511] GZipOutputFilter overwrites chunk instead of reading it

2023-03-06 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=66511

Mark Thomas  changed:

   What|Removed |Added

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

--- Comment #1 from Mark Thomas  ---
Thanks for reporting this.

Fixed in:
- 11.0.x for 11.0.0-M5 onwards
- 10.1.x for 10.1.8 onwards
-  9.0.x for  9.0.74 onwards
-  8.5.x for  8.5.88 onwards

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



[Bug 66507] Catalina version command not honoring JAVA_OPTS variable

2023-03-06 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=66507

--- Comment #1 from Eric Hamilton  ---
Updated suggested catalina.sh fix to conform with execution style of other
commands:
elif [ "$1" = "version" ] ; then

eval "\"$_RUNJAVA\"" "$JAVA_OPTS" \
  -classpath "\"$CATALINA_HOME/lib/catalina.jar\"" \
  org.apache.catalina.util.ServerInfo

else

-- 
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 66512] New: File downloads render as empty if access to Tomcat based application is delegated via AJP

2023-03-06 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=66512

Bug ID: 66512
   Summary: File downloads render as empty if access to Tomcat
based application is delegated via AJP
   Product: Tomcat 9
   Version: 9.0.73
  Hardware: PC
Status: NEW
  Severity: major
  Priority: P2
 Component: Util
  Assignee: dev@tomcat.apache.org
  Reporter: alexander.schuess...@plunet.com
  Target Milestone: -

Hi there,

I would like to place a report about an issue we are struggling with since we
installed latest security patches for Apache Tomcat and Apache HTTPD on our
hosting servers.

We - Plunet GmbH - develop a Java based application and our inbuilt file
manager is using a Java Servlet for the file exchange. Our application only
supports Java 8. There are plans to support 11 or 17 but we will need time for
this unfortunately so we can not just update Java in case this might help.

We see that since the latest updates of Tomcat users complaint that files with
Non-Unicode characters are downloaded as empty files. Such characters are for
instance greek, kyrillic or hebrew characters.

We see the following error in the stderror.log of Tomcat
01-Mar-2023 17:59:39.100 SCHWERWIEGEND [ajp-nio-127.0.0.1-9129-exec-3]
org.apache.coyote.ajp.AjpProcessor.service Error processing request
java.lang.IllegalArgumentException: Das Unicode Zeichen [Π] an Code Punkt [928]
kann nicht kodiert werden, da es außerhalb des erlaubten Bereiches von 0 bis
255 ist.
at org.apache.tomcat.util.buf.MessageBytes.toBytesSimple(MessageBytes.java:292)

We are aware that this issue happens since Tomcat 9.0.71 and also 9.0.73 did
not resolve it as we hoped to I am afraid so it is definitely related with one
of the latest changes in the MessageBytes implementation of the Tomcat Util
library as I could see them in the code history of this file.
This issue happens though ONLY if - as it is done on our SaaS servers - the
access to our application is delegated via AJP connectors. This is done because
all instances on a shared server access it via virtual hosting on ports 80 and
443.

Currently we have two possible fixing options which both work as we can
confirm:
1. We replace the tomcat-util.jar in Tomcat's lib directory with one from an
older Tomcat 9.x release. (this is not very practical though)
2. We change the delegation via mod_ajp to delegation via mod_proxy (this is
huge effort to change it for hundreds of instances)

We therefore wonder if this is considered to be a bug of maybe just a planned
change and we have to maybe change something in the config of server.xml or so.
But for me it rather feels like a bug, especially since it only happens in this
special scenario. I did some research in the web yet but I did not find anyone
who reported the same issue yet so I am putting it into this bugtracker.

Let me know in case you need more information for addressing my issue.

Thank you very much!

Cheers!

Alex

-- 
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 66512] File downloads render as empty if access to Tomcat based application is delegated via AJP

2023-03-06 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=66512

Mark Thomas  changed:

   What|Removed |Added

 OS||All

--- Comment #1 from Mark Thomas  ---
That error message would have included a stack trace. Can you provided it
please.

-- 
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 66512] File downloads render as empty if access to Tomcat based application is delegated via AJP

2023-03-06 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=66512

--- Comment #2 from Alexander Schüßler  ---
Hi Mark,

thanks for getting back to me so fast! Appreciate it.
Please see below a complete sample of a stacktrace:

#--

28-Feb-2023 22:46:47.393 SEVERE [ajp-nio-127.0.0.1-9004-exec-35]
org.apache.coyote.ajp.AjpProcessor.service Error processing request
java.lang.IllegalArgumentException: The Unicode character [Κ] at code
point [922] cannot be encoded as it is outside the permitted range of 0 to 255
at
org.apache.tomcat.util.buf.MessageBytes.toBytesSimple(MessageBytes.java:292)
at
org.apache.tomcat.util.buf.MessageBytes.toBytes(MessageBytes.java:261)
at
org.apache.coyote.ajp.AjpMessage.appendBytes(AjpMessage.java:172)
at
org.apache.coyote.ajp.AjpProcessor.prepareResponse(AjpProcessor.java:1011)
at
org.apache.coyote.AbstractProcessor.action(AbstractProcessor.java:374)
at org.apache.coyote.Response.action(Response.java:209)
at org.apache.coyote.Response.sendHeaders(Response.java:434)
at
org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:292)
at
org.apache.catalina.connector.OutputBuffer.close(OutputBuffer.java:252)
at
org.apache.catalina.connector.Response.finishResponse(Response.java:445)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:391)
at
org.apache.coyote.ajp.AjpProcessor.service(AjpProcessor.java:433)
at
org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:63)
at
org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:926)
at
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1791)
at
org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at
org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
at
org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
at
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:750)


#--

Let me know if you need something else.

Cheers!

Alex

-- 
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 66512] File downloads render as empty if access to Tomcat based application is delegated via AJP

2023-03-06 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=66512

--- Comment #3 from Alexander Schüßler  ---
Hi,

to clarify:
It is about the non-unicode characters in the FILE NAMES - I guess this was not
clear in my initial report!

For instance one of our clients from Greece struggled with a file named
5_ΠΡΟΣ EL.pdf

Cheers!

Alex

-- 
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 66512] File downloads render as empty if access to Tomcat based application is delegated via AJP

2023-03-06 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=66512

--- Comment #4 from Mark Thomas  ---
Thanks. It looks like a UTF-8 value is being put into an HTTP header. Prior to
the refactoring of MessageBytes, that would have resulted in a corrupted
header. Now it triggers an error to make the problem more obvious. That
behavioural change was intentional.

The reason you see the issue with AJP but not HTTP is that HTTP is coded more
defensively. HTTP logs the problematic header with a warning and carries on.
AJP fails the request.

HTTP headers are expected to be US-ASCII. Non US-ASCII values should be encoded
as per RFC 8187. To what extent that is an application responsibility vs a
container responsibility is not made clear in the Servlet spec.

I can look at making the AJP code more robust since it needs to be consistent
with the HTTP code but that doesn't feel like a proper fix. It should also
trigger quite a few warning messages in the logs which you would probably
prefer not to see.

Given that the application works either when the header is corrupted (using an
old tomcat-util.jar) or when the header is missing (current HTTP code) that
suggests whatever header is being set isn't necessary. Is not setting whatever
header is causing the problem an option? (Assuming Tomcat is not setting it).

-- 
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 66512] File downloads render as empty if access to Tomcat based application is delegated via AJP

2023-03-06 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=66512

--- Comment #5 from Alexander Schüßler  ---
Hi Mark,

I am open for any solution for our issue.

To underline, we are using the given config for AJP + Apache Tomcat for years
without changes and never saw issues like this. The only thing that changes
If desired I can send sample context.xml, server.xml and web.xml of our Tomcats
and also the virtual host config for Apache HTTPD so you can get an idea of our
setup.

Let me know whatever you will need for helping me (and maybe also others) with
this matter and I will see what I can do.

Cheers!

Alex

-- 
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 66512] File downloads render as empty if access to Tomcat based application is delegated via AJP

2023-03-06 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=66512

--- Comment #6 from Mark Thomas  ---
That there have been corrupted header values for years without issue supports
the view that the header is probably not required.

What would be useful for confirmation is the HTTP response headers. For a
request that fails with AJP, repeat the same request in a configuration that
uses an older version to tomcat-util.jar and provide the response headers. I
want to see if I can figure out what is setting the header.

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



[Bug 66512] File downloads render as empty if access to Tomcat based application is delegated via AJP

2023-03-06 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=66512

--- Comment #7 from Alexander Schüßler  ---
Hey Mark,

I am not 100% sure what you want me to do but I guess you would like me to
track a click on a file(i.e. a download link)in the file manager on a system
where it works and not works each and show output in browser debug tools right?

There are huge differences.
In a working system we have this:

#--
HTTP/2 200 OK
strict-transport-security: max-age=0
x-frame-options: DENY
x-content-type-options: nosniff
x-xss-protection: 1; mode=block
content-security-policy: default-src 'self'; script-src 'self' 'unsafe-eval'
'unsafe-inline'; connect-src 'self'; img-src 'self' data:; style-src 'self'
'unsafe-inline' https://fonts.googleapis.com https://fonts.gstatic.com;font-src
'self' 'unsafe-inline' https://fonts.googleapis.com
https://fonts.gstatic.com;frame-ancestors 'self'; form-action 'self'
referrer-policy: strict-origin-when-cross-origin, no-referrer-when-downgrade
feature-policy: autoplay 'none'; camera 'none'; encrypted-media 'none';
fullscreen 'none'; geolocation 'none'; microphone 'none'; midi 'none'; payment
'none';
cache-control: private, must-revalidate
pragma: private, must-revalidate
content-disposition: inline; filename="5_ EL.pdf";
filename*=UTF-8''5_%CE%A0%CE%A1%CE%9F%CE%A3%20EL.pdf
content-length: 53923
vary: User-Agent
content-type: application/pdf
date: Mon, 06 Mar 2023 16:25:51 GMT
server: Apache
X-Firefox-Spdy: h2
#--


In a non working system it seems nothing goes really through:
#--
HTTP/2 200 OK
content-length: 0
content-type: application/pdf
date: Mon, 06 Mar 2023 16:25:00 GMT
server: None
X-Firefox-Spdy: h2
#--

I did both tests with Mozilla Firefox and extracted the information from the
networking tab by clicking on the triggered GET request. Is it that what you
need? Else please guide me a little bit more.

It is also not an issue for us to give you access to a test system on our side
(at least from the web perspective). If it needs to be something that grants
you server-side access via remote desktop or so I had to check this with my
team if we can provide such things.

Thanks!

Cheers!

Alex

-- 
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 66512] File downloads render as empty if access to Tomcat based application is delegated via AJP

2023-03-06 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=66512

--- Comment #8 from Alexander Schüßler  ---
P.S:

I am also on Skype so also screen sharing on Skype are absolutely no problem if
you are willing to, but I definitely do not expect that from you, it is just a
kind offer I would like to make in case you might think that this will be
beneficial.

(I just read your profile on Apache Home so I thought I should mention it :) )

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



Buildbot failure in on tomcat-9.0.x

2023-03-06 Thread buildbot
Build status: BUILD FAILED: failed compile (failure)
Worker used: bb_worker2_ubuntu
URL: https://ci2.apache.org/#builders/37/builds/483
Blamelist: Mark Thomas 
Build Text: failed compile (failure)
Status Detected: new failure
Build Source Stamp: [branch 9.0.x] d7f8782efea21d36fa7cad0c81d3d285fa374e86


Steps:

  worker_preparation: 0

  git: 0

  shell: 0

  shell_1: 0

  shell_2: 0

  shell_3: 0

  shell_4: 0

  shell_5: 0

  compile: 1

  shell_6: 0

  shell_7: 0

  shell_8: 0

  shell_9: 0

  Rsync docs to nightlies.apache.org: 0

  shell_10: 0

  Rsync RAT to nightlies.apache.org: 0

  compile_1: 2

  shell_11: 0

  Rsync Logs to nightlies.apache.org: 0


-- ASF Buildbot


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



Native Windows installer builds

2023-03-06 Thread Christopher Schultz

All,

I'm curious... how married are we to the idea of distributing installers 
for Windows operating systems?


I only ask because the release-build process is somewhat complicated by 
having to build such installers.


Apple has moved to ARM. Windows also supports ARM, though there aren't a 
huge number of such devices in circulation today. Amazon offers 
ARM-based EC2 instances for a lower price than their x86-64 equivalents. 
I assume one could choose to run either Linux or Windows on those.


We don't currently have any plans to support ARM. Should we? Or would it 
be better to drop (direct) support for x86-64 Windows by no longer 
packaging Tomcat releases as Windows installers?


Some years ago, the Apache httpd team discontinued binary packages. For 
most *NIX-environments with package managers and/or easy-to-get 
toolchains, that's not a big deal, but it still leaves Windows users out 
in the cold. The great folks at ApacheLounge picked up the slack and 
provide Windows binaries (including "installers") for httpd and several 
third-party modules, including mod_jk.


Will Stewart distributes an alternative Windows Installer, but that 
appears to only support the Tomcat 9.0.x version, likely because that's 
the one he uses for his own personal/professional uses.


I'm wondering if it's time for the Tomcat team to discontinue in-house 
Windows installer builds.


Are there other options? The installer doesn't do much beyond expand the 
binary installation and set up the service. Can that be done with an 
"installer" that doesn't require a complete re-build with every Tomcat 
release?


It is okay to expect Windows admins to use a script to install and set 
up their installation?


Thanks,
-chris

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



Re: Native Windows installer builds

2023-03-06 Thread Mark Thomas

On 06/03/2023 17:01, Christopher Schultz wrote:

All,

I'm curious... how married are we to the idea of distributing installers 
for Windows operating systems?


There are definitely users that use it so I think we need to provide 
something that installs Tomcat as a service.


My understanding from others around at the time (remm) is that the 
installer was initially intended for developer users rather than system 
admins on servers. My sense from the questions on the users list is that 
it is more used by system admins.


I only ask because the release-build process is somewhat complicated by 
having to build such installers.


Complicated how? Having to use wine to run the installer?

I'll note that all ASF committers can request a full whatever MSDN is 
called this week license for use with ASF projects for no cost.


Apple has moved to ARM. Windows also supports ARM, though there aren't a 
huge number of such devices in circulation today. Amazon offers 
ARM-based EC2 instances for a lower price than their x86-64 equivalents. 
I assume one could choose to run either Linux or Windows on those.


We don't currently have any plans to support ARM. Should we? Or would it 
be better to drop (direct) support for x86-64 Windows by no longer 
packaging Tomcat releases as Windows installers?


As far as I can find, Windows server isn't available on ARM. I don't 
think we need to worry about supporting the Windows Installer on ARM 
until Microsoft announces plans for Windows server on ARM.


Some years ago, the Apache httpd team discontinued binary packages. For 
most *NIX-environments with package managers and/or easy-to-get 
toolchains, that's not a big deal, but it still leaves Windows users out 
in the cold. The great folks at ApacheLounge picked up the slack and 
provide Windows binaries (including "installers") for httpd and several 
third-party modules, including mod_jk.


Will Stewart distributes an alternative Windows Installer, but that 
appears to only support the Tomcat 9.0.x version, likely because that's 
the one he uses for his own personal/professional uses.


I'm wondering if it's time for the Tomcat team to discontinue in-house 
Windows installer builds.


Are there other options? The installer doesn't do much beyond expand the 
binary installation and set up the service. Can that be done with an 
"installer" that doesn't require a complete re-build with every Tomcat 
release?


Just skimming through the installer script:
- install and uninstall
- auto-detect architecture (ensures binaries match JVM arch)
- find / choose JVM
- set ports
- configure Manager user
- select webapps to install
- set service name
- file permissions
- silent install
- creates some shortcuts

and wraps it all up in a familiar style UI.

It is also signed in a way that Windows recognizes.

It is okay to expect Windows admins to use a script to install and set 
up their installation?


If you are proposing replacing the windows installer with a script then 
I can see the potential benefits for us. Shipping a smarter service.bat 
(or similar) rather than a full installer has its attractions.


I think this is something we'd probably need to discuss on the users 
list if we wanted to move forward with it to see if there are any 
requirements we haven't considered.


Mark

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



[Bug 66512] File downloads render as empty if access to Tomcat based application is delegated via AJP

2023-03-06 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=66512

--- Comment #9 from Christopher Schultz  ---
Alexander, have a look at this StackOverflow question and answer:

https://stackoverflow.com/questions/93551/how-to-encode-the-filename-parameter-of-content-disposition-header-in-http

I suspect your "download servlet" is manually-setting the Content-Disposition
header in order to transmit the filename of the file back to the client. You
are also setting the "filename" header as well (as seen in your HTTP response
headers).

Try setting the contents of the "filename" attribute of the Content-Disposition
header to an encoded value in the same way that the "filename" header is being
encoded.

The sample code in the highest-voted answer uses C# but you should be able to
adapt it to Java code easily.

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



Re: Native Windows installer builds

2023-03-06 Thread Christopher Schultz

Mark,

On 3/6/23 12:30, Mark Thomas wrote:

On 06/03/2023 17:01, Christopher Schultz wrote:

All,

I'm curious... how married are we to the idea of distributing 
installers for Windows operating systems?


There are definitely users that use it so I think we need to provide 
something that installs Tomcat as a service.


My understanding from others around at the time (remm) is that the 
installer was initially intended for developer users rather than system 
admins on servers. My sense from the questions on the users list is that 
it is more used by system admins.


I only ask because the release-build process is somewhat complicated 
by having to build such installers.


Complicated how? Having to use wine to run the installer?

I'll note that all ASF committers can request a full whatever MSDN is 
called this week license for use with ASF projects for no cost.


Apple has moved to ARM. Windows also supports ARM, though there aren't 
a huge number of such devices in circulation today. Amazon offers 
ARM-based EC2 instances for a lower price than their x86-64 
equivalents. I assume one could choose to run either Linux or Windows 
on those.


We don't currently have any plans to support ARM. Should we? Or would 
it be better to drop (direct) support for x86-64 Windows by no longer 
packaging Tomcat releases as Windows installers?


As far as I can find, Windows server isn't available on ARM. I don't 
think we need to worry about supporting the Windows Installer on ARM 
until Microsoft announces plans for Windows server on ARM.


Some years ago, the Apache httpd team discontinued binary packages. 
For most *NIX-environments with package managers and/or easy-to-get 
toolchains, that's not a big deal, but it still leaves Windows users 
out in the cold. The great folks at ApacheLounge picked up the slack 
and provide Windows binaries (including "installers") for httpd and 
several third-party modules, including mod_jk.


Will Stewart distributes an alternative Windows Installer, but that 
appears to only support the Tomcat 9.0.x version, likely because 
that's the one he uses for his own personal/professional uses.


I'm wondering if it's time for the Tomcat team to discontinue in-house 
Windows installer builds.


Are there other options? The installer doesn't do much beyond expand 
the binary installation and set up the service. Can that be done with 
an "installer" that doesn't require a complete re-build with every 
Tomcat release?


Just skimming through the installer script:
- install and uninstall
- auto-detect architecture (ensures binaries match JVM arch)
- find / choose JVM
- set ports
- configure Manager user
- select webapps to install
- set service name
- file permissions
- silent install
- creates some shortcuts

and wraps it all up in a familiar style UI.

It is also signed in a way that Windows recognizes.

It is okay to expect Windows admins to use a script to install and set 
up their installation?


If you are proposing replacing the windows installer with a script then 
I can see the potential benefits for us. Shipping a smarter service.bat 
(or similar) rather than a full installer has its attractions.


I think this is something we'd probably need to discuss on the users 
list if we wanted to move forward with it to see if there are any 
requirements we haven't considered.


I completely agree. This wasn't "Chris doesn't want to build the Windows 
installer for the April releases". This was more of an existential 
conversation about what we think it's appropriate to provide for our 
end-users.


-chris

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



[Bug 66512] File downloads render as empty if access to Tomcat based application is delegated via AJP

2023-03-06 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=66512

--- Comment #10 from Alexander Schüßler  ---
Hi Mark,

I am not a developer at my company but I found a suspicious piece of code in
our codebase that would underline your assumption:

https://pastebin.com/m74V3qHx


I suppose what you want us to do is to replace this (please confirm):

#--
response.setHeader ( "Content-Disposition",
forceDownload+"; filename=\"" + originalFileName + "\";
filename*=UTF-8''" +
SysFacade.encodeFilename_for_HttpUrlAccess (
originalFileName ) );

#--

with this:

#--
String encodedFilename =
SysFacade.encodeFilename_for_HttpUrlAccess(originalFileName);
response.setHeader ( "Content-Disposition",
forceDownload+"; filename=\"" + encodedFilename + "\";
filename*=UTF-8''" +
encodedFilename);
#--

I have access to our codebase and could build a test build with this change,
that is not an issue but I must say that a code change would not be the best
solution for us because it will mean that we will have to deploy updates for
all affected customers.

Do you think this is the only option we have?

Let me know your thoughts!

Cheers!

Alex

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



[tomcat] branch main updated: Add release date for 11.0.0-M4

2023-03-06 Thread markt
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/main by this push:
 new 2db3559e67 Add release date for 11.0.0-M4
2db3559e67 is described below

commit 2db3559e67ab3e42dd290d52623093bab43a9a5a
Author: Mark Thomas 
AuthorDate: Mon Mar 6 17:56:51 2023 +

Add release date for 11.0.0-M4
---
 webapps/docs/changelog.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 8f421a274c..dc44e6a75f 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -161,7 +161,7 @@
 
   
 
-
+
   
 
   


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



[Bug 66513] New: Primary Key Violation using PersistentManager + PersistentValves +

2023-03-06 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=66513

Bug ID: 66513
   Summary: Primary Key Violation using  PersistentManager +
PersistentValves +
   Product: Tomcat 9
   Version: 9.0.72
  Hardware: PC
Status: NEW
  Severity: normal
  Priority: P2
 Component: Catalina
  Assignee: dev@tomcat.apache.org
  Reporter: vincent.liaut...@free.fr
  Target Milestone: -

Hi all,
when using PersistentManager + org.apache.catalina.valves.PersistentValve to
store session data in a Database table (in order to run Tomcat on containers
without sticky sessions) we get sometimes a "primary key constraint violation"
due to different thread that are badly synchronized.

When looking at source code, it appears that the usage of PersistentValve
assumes that we get only one request per session at any on time (and you
propose a filter parameter on the persistentValve component to avoid having
several requests at the same time).
However, in the case this filter is not complete (and so we get several
requests with the same sessionId at a time), the source code in
org.apache.catalina.valves.PersistentValve as well in
org.apache.catalina.session.DataSourceStore use a synchronized block to avoid
this problem but this synchronized block is useless because it uses a session
object that is different for each request.

You could solve this issue by using a static HashMap with keys and values
storing sessionId string, and using this sessionId string value as an object to
synchronize the blocks used to store the session in the DB table.
The process could be :
-If sessionId String not already store as a HashMap Key
-Store sessionId String as key and values
Synchronized(theHashMap(sessionId) {


remove it from the hashMap
}

That way you would really synchronize threads that use a same sessionId (and no
more) and would avoid those "primary key violation" errors.

Regards

-- 
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 66513] Primary Key Violation using PersistentManager + PersistentValves +

2023-03-06 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=66513

Vincent Liautaud  changed:

   What|Removed |Added

 CC||vincent.liaut...@free.fr
 OS||All

-- 
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 66512] File downloads render as empty if access to Tomcat based application is delegated via AJP

2023-03-06 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=66512

--- Comment #11 from Mark Thomas  ---
Alex,

You might want to test an updated header as if you look at the "working" one:

content-disposition: inline; filename="5_ EL.pdf";
filename*=UTF-8''5_%CE%A0%CE%A1%CE%9F%CE%A3%20EL.pdf

the filename is corrupted (the  characters).

Fixing the header is (in my view) the best/correct long term option.

The next Tomcat release round (April) will contain a fix that aligns AJP
behaviour with HTTP behaviour (at least I am intending to include such a fix
and will link it to this bug when I do). Given you said that mod_proxy_http
worked, that should address this issue. I would caution you to test that before
relying on it as my expectation is that it will cause the content-disposition
header to be dropped.

-- 
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 66512] File downloads render as empty if access to Tomcat based application is delegated via AJP

2023-03-06 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=66512

--- Comment #12 from Alexander Schüßler  ---
Hi Mark,

thanks so much for all your help with this matter.
I am impressed that you are more responsive than any paid support agent :)

I will test the code change on our side and see if this also helps.
I am also happy to test your change in the Tomcat source code.

We would need Windows binaries therefore as we download them from the download
site of Tomcat.
Since I can not yet estimate how urgent we need the fix in our header
implementation I would love to test your fix asap too. Any chance to get a
Windows binary earlier than April? Before I wrote this ticket (i.e. before
9.0.73 was released) I also had a look for pre-built nightly or alpha builds
for testing purposes but it seems there are none available in the download
archive. But I still dare to ask :)

Thanks and have a nice day!
My day ends now (actually ended hours ago :D ). I will reply to you from
tomorrow again.

Enjoy your evening!

Cheers!

Alex

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



[tomcat] branch main updated: Refactor. Simplify logic. No functional change.

2023-03-06 Thread markt
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/main by this push:
 new afb270c3f7 Refactor. Simplify logic. No functional change.
afb270c3f7 is described below

commit afb270c3f72cc3cdb8f526d175c08cfdded08d69
Author: Mark Thomas 
AuthorDate: Mon Mar 6 19:41:32 2023 +

Refactor. Simplify logic. No functional change.
---
 java/org/apache/coyote/ajp/AjpProcessor.java | 15 +++
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/java/org/apache/coyote/ajp/AjpProcessor.java 
b/java/org/apache/coyote/ajp/AjpProcessor.java
index 3d50ae89b5..2b547e0312 100644
--- a/java/org/apache/coyote/ajp/AjpProcessor.java
+++ b/java/org/apache/coyote/ajp/AjpProcessor.java
@@ -966,19 +966,10 @@ public class AjpProcessor extends AbstractProcessor {
 responseMessage.reset();
 responseMessage.appendByte(Constants.JK_AJP13_SEND_HEADERS);
 
-// Responses with certain status codes are not permitted to include a
-// response body.
+// Responses with certain status codes and/or methods are not 
permitted to include a response body.
 int statusCode = response.getStatus();
-if (statusCode < 200 || statusCode == 204 || statusCode == 205 ||
-statusCode == 304) {
-// No entity body
-swallowResponse = true;
-}
-
-// Responses to HEAD requests are not permitted to include a response
-// body.
-MessageBytes methodMB = request.method();
-if (methodMB.equals("HEAD")) {
+if (statusCode < 200 || statusCode == 204 || statusCode == 205 || 
statusCode == 304 ||
+request.method().equals("HEAD")) {
 // No entity body
 swallowResponse = true;
 }


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



[tomcat] branch 10.1.x updated: Refactor. Simplify logic. No functional change.

2023-03-06 Thread markt
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/10.1.x by this push:
 new c3eb218eb6 Refactor. Simplify logic. No functional change.
c3eb218eb6 is described below

commit c3eb218eb67655e1b1faacb0c1964746809f6f59
Author: Mark Thomas 
AuthorDate: Mon Mar 6 19:41:32 2023 +

Refactor. Simplify logic. No functional change.
---
 java/org/apache/coyote/ajp/AjpProcessor.java | 15 +++
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/java/org/apache/coyote/ajp/AjpProcessor.java 
b/java/org/apache/coyote/ajp/AjpProcessor.java
index 3d50ae89b5..2b547e0312 100644
--- a/java/org/apache/coyote/ajp/AjpProcessor.java
+++ b/java/org/apache/coyote/ajp/AjpProcessor.java
@@ -966,19 +966,10 @@ public class AjpProcessor extends AbstractProcessor {
 responseMessage.reset();
 responseMessage.appendByte(Constants.JK_AJP13_SEND_HEADERS);
 
-// Responses with certain status codes are not permitted to include a
-// response body.
+// Responses with certain status codes and/or methods are not 
permitted to include a response body.
 int statusCode = response.getStatus();
-if (statusCode < 200 || statusCode == 204 || statusCode == 205 ||
-statusCode == 304) {
-// No entity body
-swallowResponse = true;
-}
-
-// Responses to HEAD requests are not permitted to include a response
-// body.
-MessageBytes methodMB = request.method();
-if (methodMB.equals("HEAD")) {
+if (statusCode < 200 || statusCode == 204 || statusCode == 205 || 
statusCode == 304 ||
+request.method().equals("HEAD")) {
 // No entity body
 swallowResponse = true;
 }


-
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: Refactor. Simplify logic. No functional change.

2023-03-06 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 0ca1ae14d8 Refactor. Simplify logic. No functional change.
0ca1ae14d8 is described below

commit 0ca1ae14d8a857dee97e62053c177eaa799d552c
Author: Mark Thomas 
AuthorDate: Mon Mar 6 19:41:32 2023 +

Refactor. Simplify logic. No functional change.
---
 java/org/apache/coyote/ajp/AjpProcessor.java | 15 +++
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/java/org/apache/coyote/ajp/AjpProcessor.java 
b/java/org/apache/coyote/ajp/AjpProcessor.java
index 1b5d311836..6b4a203e91 100644
--- a/java/org/apache/coyote/ajp/AjpProcessor.java
+++ b/java/org/apache/coyote/ajp/AjpProcessor.java
@@ -957,19 +957,10 @@ public class AjpProcessor extends AbstractProcessor {
 responseMessage.reset();
 responseMessage.appendByte(Constants.JK_AJP13_SEND_HEADERS);
 
-// Responses with certain status codes are not permitted to include a
-// response body.
+// Responses with certain status codes and/or methods are not 
permitted to include a response body.
 int statusCode = response.getStatus();
-if (statusCode < 200 || statusCode == 204 || statusCode == 205 ||
-statusCode == 304) {
-// No entity body
-swallowResponse = true;
-}
-
-// Responses to HEAD requests are not permitted to include a response
-// body.
-MessageBytes methodMB = request.method();
-if (methodMB.equals("HEAD")) {
+if (statusCode < 200 || statusCode == 204 || statusCode == 205 || 
statusCode == 304 ||
+request.method().equals("HEAD")) {
 // No entity body
 swallowResponse = true;
 }


-
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: Refactor. Simplify logic. No functional change.

2023-03-06 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 10610bc6c5 Refactor. Simplify logic. No functional change.
10610bc6c5 is described below

commit 10610bc6c556f283e4bd0ce027dd5bf20f913170
Author: Mark Thomas 
AuthorDate: Mon Mar 6 19:41:32 2023 +

Refactor. Simplify logic. No functional change.
---
 java/org/apache/coyote/ajp/AjpProcessor.java | 15 +++
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/java/org/apache/coyote/ajp/AjpProcessor.java 
b/java/org/apache/coyote/ajp/AjpProcessor.java
index 27f9eff1ad..e0ec70c0fe 100644
--- a/java/org/apache/coyote/ajp/AjpProcessor.java
+++ b/java/org/apache/coyote/ajp/AjpProcessor.java
@@ -1050,19 +1050,10 @@ public class AjpProcessor extends AbstractProcessor {
 responseMessage.reset();
 responseMessage.appendByte(Constants.JK_AJP13_SEND_HEADERS);
 
-// Responses with certain status codes are not permitted to include a
-// response body.
+// Responses with certain status codes and/or methods are not 
permitted to include a response body.
 int statusCode = response.getStatus();
-if (statusCode < 200 || statusCode == 204 || statusCode == 205 ||
-statusCode == 304) {
-// No entity body
-swallowResponse = true;
-}
-
-// Responses to HEAD requests are not permitted to include a response
-// body.
-MessageBytes methodMB = request.method();
-if (methodMB.equals("HEAD")) {
+if (statusCode < 200 || statusCode == 204 || statusCode == 205 || 
statusCode == 304 ||
+request.method().equals("HEAD")) {
 // No entity body
 swallowResponse = true;
 }


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



[tomcat] branch 10.1.x updated: Refactor. Re-order. No functional change.

2023-03-06 Thread markt
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/10.1.x by this push:
 new 9bcdc19334 Refactor. Re-order. No functional change.
9bcdc19334 is described below

commit 9bcdc19334e959dcd8e98b689b5a86405e4e2198
Author: Mark Thomas 
AuthorDate: Mon Mar 6 19:45:51 2023 +

Refactor. Re-order. No functional change.
---
 java/org/apache/coyote/ajp/AjpProcessor.java | 29 ++--
 1 file changed, 15 insertions(+), 14 deletions(-)

diff --git a/java/org/apache/coyote/ajp/AjpProcessor.java 
b/java/org/apache/coyote/ajp/AjpProcessor.java
index 2b547e0312..d2c0e46169 100644
--- a/java/org/apache/coyote/ajp/AjpProcessor.java
+++ b/java/org/apache/coyote/ajp/AjpProcessor.java
@@ -961,11 +961,6 @@ public class AjpProcessor extends AbstractProcessor {
 
 response.setCommitted(true);
 
-tmpMB.recycle();
-responseMsgPos = -1;
-responseMessage.reset();
-responseMessage.appendByte(Constants.JK_AJP13_SEND_HEADERS);
-
 // Responses with certain status codes and/or methods are not 
permitted to include a response body.
 int statusCode = response.getStatus();
 if (statusCode < 200 || statusCode == 204 || statusCode == 205 || 
statusCode == 304 ||
@@ -974,14 +969,7 @@ public class AjpProcessor extends AbstractProcessor {
 swallowResponse = true;
 }
 
-// HTTP header contents
-responseMessage.appendInt(statusCode);
-// Reason phrase is optional but mod_jk + httpd 2.x fails with a null
-// reason phrase - bug 45026
-tmpMB.setString(Integer.toString(response.getStatus()));
-responseMessage.appendBytes(tmpMB);
-
-// Special headers
+// Prepare special headers
 MimeHeaders headers = response.getMimeHeaders();
 String contentType = response.getContentType();
 if (contentType != null) {
@@ -996,7 +984,20 @@ public class AjpProcessor extends AbstractProcessor {
 headers.setValue("Content-Length").setLong(contentLength);
 }
 
-// Other headers
+// Write AJP message header
+tmpMB.recycle();
+responseMsgPos = -1;
+responseMessage.reset();
+responseMessage.appendByte(Constants.JK_AJP13_SEND_HEADERS);
+
+// Write HTTP response line
+responseMessage.appendInt(statusCode);
+// Reason phrase is optional but mod_jk + httpd 2.x fails with a null
+// reason phrase - bug 45026
+tmpMB.setString(Integer.toString(response.getStatus()));
+responseMessage.appendBytes(tmpMB);
+
+// Write headers
 int numHeaders = headers.size();
 responseMessage.appendInt(numHeaders);
 for (int i = 0; i < numHeaders; i++) {


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



[tomcat] branch main updated: Refactor. Re-order. No functional change.

2023-03-06 Thread markt
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/main by this push:
 new 4a5a1e5f52 Refactor. Re-order. No functional change.
4a5a1e5f52 is described below

commit 4a5a1e5f520625392971c1b5149b5db1cb47bce6
Author: Mark Thomas 
AuthorDate: Mon Mar 6 19:45:51 2023 +

Refactor. Re-order. No functional change.
---
 java/org/apache/coyote/ajp/AjpProcessor.java | 29 ++--
 1 file changed, 15 insertions(+), 14 deletions(-)

diff --git a/java/org/apache/coyote/ajp/AjpProcessor.java 
b/java/org/apache/coyote/ajp/AjpProcessor.java
index 2b547e0312..d2c0e46169 100644
--- a/java/org/apache/coyote/ajp/AjpProcessor.java
+++ b/java/org/apache/coyote/ajp/AjpProcessor.java
@@ -961,11 +961,6 @@ public class AjpProcessor extends AbstractProcessor {
 
 response.setCommitted(true);
 
-tmpMB.recycle();
-responseMsgPos = -1;
-responseMessage.reset();
-responseMessage.appendByte(Constants.JK_AJP13_SEND_HEADERS);
-
 // Responses with certain status codes and/or methods are not 
permitted to include a response body.
 int statusCode = response.getStatus();
 if (statusCode < 200 || statusCode == 204 || statusCode == 205 || 
statusCode == 304 ||
@@ -974,14 +969,7 @@ public class AjpProcessor extends AbstractProcessor {
 swallowResponse = true;
 }
 
-// HTTP header contents
-responseMessage.appendInt(statusCode);
-// Reason phrase is optional but mod_jk + httpd 2.x fails with a null
-// reason phrase - bug 45026
-tmpMB.setString(Integer.toString(response.getStatus()));
-responseMessage.appendBytes(tmpMB);
-
-// Special headers
+// Prepare special headers
 MimeHeaders headers = response.getMimeHeaders();
 String contentType = response.getContentType();
 if (contentType != null) {
@@ -996,7 +984,20 @@ public class AjpProcessor extends AbstractProcessor {
 headers.setValue("Content-Length").setLong(contentLength);
 }
 
-// Other headers
+// Write AJP message header
+tmpMB.recycle();
+responseMsgPos = -1;
+responseMessage.reset();
+responseMessage.appendByte(Constants.JK_AJP13_SEND_HEADERS);
+
+// Write HTTP response line
+responseMessage.appendInt(statusCode);
+// Reason phrase is optional but mod_jk + httpd 2.x fails with a null
+// reason phrase - bug 45026
+tmpMB.setString(Integer.toString(response.getStatus()));
+responseMessage.appendBytes(tmpMB);
+
+// Write headers
 int numHeaders = headers.size();
 responseMessage.appendInt(numHeaders);
 for (int i = 0; i < numHeaders; i++) {


-
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: Refactor. Re-order. No functional change.

2023-03-06 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 bd22a139cb Refactor. Re-order. No functional change.
bd22a139cb is described below

commit bd22a139cbc30cd4d1a0a674d9cb47b9381dc3c4
Author: Mark Thomas 
AuthorDate: Mon Mar 6 19:45:51 2023 +

Refactor. Re-order. No functional change.
---
 java/org/apache/coyote/ajp/AjpProcessor.java | 29 ++--
 1 file changed, 15 insertions(+), 14 deletions(-)

diff --git a/java/org/apache/coyote/ajp/AjpProcessor.java 
b/java/org/apache/coyote/ajp/AjpProcessor.java
index 6b4a203e91..8e8110bdab 100644
--- a/java/org/apache/coyote/ajp/AjpProcessor.java
+++ b/java/org/apache/coyote/ajp/AjpProcessor.java
@@ -952,11 +952,6 @@ public class AjpProcessor extends AbstractProcessor {
 
 response.setCommitted(true);
 
-tmpMB.recycle();
-responseMsgPos = -1;
-responseMessage.reset();
-responseMessage.appendByte(Constants.JK_AJP13_SEND_HEADERS);
-
 // Responses with certain status codes and/or methods are not 
permitted to include a response body.
 int statusCode = response.getStatus();
 if (statusCode < 200 || statusCode == 204 || statusCode == 205 || 
statusCode == 304 ||
@@ -965,14 +960,7 @@ public class AjpProcessor extends AbstractProcessor {
 swallowResponse = true;
 }
 
-// HTTP header contents
-responseMessage.appendInt(statusCode);
-// Reason phrase is optional but mod_jk + httpd 2.x fails with a null
-// reason phrase - bug 45026
-tmpMB.setString(Integer.toString(response.getStatus()));
-responseMessage.appendBytes(tmpMB);
-
-// Special headers
+// Prepare special headers
 MimeHeaders headers = response.getMimeHeaders();
 String contentType = response.getContentType();
 if (contentType != null) {
@@ -987,7 +975,20 @@ public class AjpProcessor extends AbstractProcessor {
 headers.setValue("Content-Length").setLong(contentLength);
 }
 
-// Other headers
+// Write AJP message header
+tmpMB.recycle();
+responseMsgPos = -1;
+responseMessage.reset();
+responseMessage.appendByte(Constants.JK_AJP13_SEND_HEADERS);
+
+// Write HTTP response line
+responseMessage.appendInt(statusCode);
+// Reason phrase is optional but mod_jk + httpd 2.x fails with a null
+// reason phrase - bug 45026
+tmpMB.setString(Integer.toString(response.getStatus()));
+responseMessage.appendBytes(tmpMB);
+
+// Write headers
 int numHeaders = headers.size();
 responseMessage.appendInt(numHeaders);
 for (int i = 0; i < numHeaders; i++) {


-
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: Refactor. Re-order. No functional change.

2023-03-06 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 56f32fb9e9 Refactor. Re-order. No functional change.
56f32fb9e9 is described below

commit 56f32fb9e91bcb3971c1116345c3fcac59e52fb0
Author: Mark Thomas 
AuthorDate: Mon Mar 6 19:45:51 2023 +

Refactor. Re-order. No functional change.
---
 java/org/apache/coyote/ajp/AjpProcessor.java | 45 ++--
 1 file changed, 23 insertions(+), 22 deletions(-)

diff --git a/java/org/apache/coyote/ajp/AjpProcessor.java 
b/java/org/apache/coyote/ajp/AjpProcessor.java
index e0ec70c0fe..534c74ec78 100644
--- a/java/org/apache/coyote/ajp/AjpProcessor.java
+++ b/java/org/apache/coyote/ajp/AjpProcessor.java
@@ -1045,11 +1045,6 @@ public class AjpProcessor extends AbstractProcessor {
 
 response.setCommitted(true);
 
-tmpMB.recycle();
-responseMsgPos = -1;
-responseMessage.reset();
-responseMessage.appendByte(Constants.JK_AJP13_SEND_HEADERS);
-
 // Responses with certain status codes and/or methods are not 
permitted to include a response body.
 int statusCode = response.getStatus();
 if (statusCode < 200 || statusCode == 204 || statusCode == 205 || 
statusCode == 304 ||
@@ -1058,7 +1053,28 @@ public class AjpProcessor extends AbstractProcessor {
 swallowResponse = true;
 }
 
-// HTTP header contents
+// Prepare special headers
+MimeHeaders headers = response.getMimeHeaders();
+String contentType = response.getContentType();
+if (contentType != null) {
+headers.setValue("Content-Type").setString(contentType);
+}
+String contentLanguage = response.getContentLanguage();
+if (contentLanguage != null) {
+headers.setValue("Content-Language").setString(contentLanguage);
+}
+long contentLength = response.getContentLengthLong();
+if (contentLength >= 0) {
+headers.setValue("Content-Length").setLong(contentLength);
+}
+
+// Write AJP message header
+tmpMB.recycle();
+responseMsgPos = -1;
+responseMessage.reset();
+responseMessage.appendByte(Constants.JK_AJP13_SEND_HEADERS);
+
+// Write HTTP response line
 responseMessage.appendInt(statusCode);
 if (sendReasonPhrase) {
 String message = null;
@@ -1082,22 +1098,7 @@ public class AjpProcessor extends AbstractProcessor {
 }
 responseMessage.appendBytes(tmpMB);
 
-// Special headers
-MimeHeaders headers = response.getMimeHeaders();
-String contentType = response.getContentType();
-if (contentType != null) {
-headers.setValue("Content-Type").setString(contentType);
-}
-String contentLanguage = response.getContentLanguage();
-if (contentLanguage != null) {
-headers.setValue("Content-Language").setString(contentLanguage);
-}
-long contentLength = response.getContentLengthLong();
-if (contentLength >= 0) {
-headers.setValue("Content-Length").setLong(contentLength);
-}
-
-// Other headers
+// Write headers
 int numHeaders = headers.size();
 responseMessage.appendInt(numHeaders);
 for (int i = 0; i < numHeaders; i++) {


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



[Bug 66512] File downloads render as empty if access to Tomcat based application is delegated via AJP

2023-03-06 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=66512

--- Comment #13 from Christopher Schultz  ---
(In reply to Alexander Schüßler from comment #10)
> I am not a developer at my company but I found a suspicious piece of code in
> our codebase that would underline your assumption:

That does indeed look "suspicious". I would bet that the original developer was
trying to accommodate both clients who do and do not understand RFC
5987-encoded strings simultaneously. I wonder how that would actually behave
with each kind of client.

I would indeed change the code, but I would only use a single filename:

response.setHeader ( "Content-Disposition",
forceDownload
+ "; filename*=UTF-8''"
+ SysFacade.encodeFilename_for_HttpUrlAccess ( originalFileName )
);

Or, generate a "clean" version of your original filename that is known not to
contain any non-ASCII characters. I'll leave that as an exercise for the reader
;)

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



[tomcat] branch 10.1.x updated: Fix BZ 66512 - Ignore invalid HHTP response headers for AJP

2023-03-06 Thread markt
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/10.1.x by this push:
 new d8ece17eac Fix BZ 66512 - Ignore invalid HHTP response headers for AJP
d8ece17eac is described below

commit d8ece17eac0c1a9c40a810eacc3c8370f10fa32e
Author: Mark Thomas 
AuthorDate: Mon Mar 6 20:41:44 2023 +

Fix BZ 66512 - Ignore invalid HHTP response headers for AJP

This aligns the behaviour of AJP with that of HTTP.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66512
---
 java/org/apache/coyote/ajp/AjpProcessor.java   | 56 ++--
 java/org/apache/coyote/ajp/LocalStrings.properties |  1 +
 .../coyote/ajp/TestAbstractAjpProcessor.java   | 75 --
 webapps/docs/changelog.xml |  4 ++
 4 files changed, 111 insertions(+), 25 deletions(-)

diff --git a/java/org/apache/coyote/ajp/AjpProcessor.java 
b/java/org/apache/coyote/ajp/AjpProcessor.java
index d2c0e46169..2b76af3eb2 100644
--- a/java/org/apache/coyote/ajp/AjpProcessor.java
+++ b/java/org/apache/coyote/ajp/AjpProcessor.java
@@ -984,32 +984,48 @@ public class AjpProcessor extends AbstractProcessor {
 headers.setValue("Content-Length").setLong(contentLength);
 }
 
-// Write AJP message header
 tmpMB.recycle();
 responseMsgPos = -1;
-responseMessage.reset();
-responseMessage.appendByte(Constants.JK_AJP13_SEND_HEADERS);
 
-// Write HTTP response line
-responseMessage.appendInt(statusCode);
-// Reason phrase is optional but mod_jk + httpd 2.x fails with a null
-// reason phrase - bug 45026
-tmpMB.setString(Integer.toString(response.getStatus()));
-responseMessage.appendBytes(tmpMB);
-
-// Write headers
 int numHeaders = headers.size();
-responseMessage.appendInt(numHeaders);
 for (int i = 0; i < numHeaders; i++) {
-MessageBytes hN = headers.getName(i);
-int hC = Constants.getResponseAjpIndex(hN.toString());
-if (hC > 0) {
-responseMessage.appendInt(hC);
-} else {
-responseMessage.appendBytes(hN);
+if (i == 0) {
+// Write AJP message header
+responseMessage.reset();
+responseMessage.appendByte(Constants.JK_AJP13_SEND_HEADERS);
+
+// Write HTTP response line
+responseMessage.appendInt(statusCode);
+// Reason phrase is optional but mod_jk + httpd 2.x fails with 
a null
+// reason phrase - bug 45026
+tmpMB.setString(Integer.toString(response.getStatus()));
+responseMessage.appendBytes(tmpMB);
+
+// Start headers
+responseMessage.appendInt(numHeaders);
+}
+
+try {
+// Write headers
+MessageBytes hN = headers.getName(i);
+int hC = Constants.getResponseAjpIndex(hN.toString());
+if (hC > 0) {
+responseMessage.appendInt(hC);
+} else {
+responseMessage.appendBytes(hN);
+}
+MessageBytes hV=headers.getValue(i);
+responseMessage.appendBytes(hV);
+} catch (IllegalArgumentException iae) {
+// Log the problematic header
+log.warn(sm.getString("ajpprocessor.response.invalidHeader", 
headers.getName(i),
+headers.getValue(i)), iae);
+// Remove the problematic header
+headers.removeHeader(i);
+numHeaders--;
+// Reset loop and start again
+i = -1;
 }
-MessageBytes hV=headers.getValue(i);
-responseMessage.appendBytes(hV);
 }
 
 // Write to buffer
diff --git a/java/org/apache/coyote/ajp/LocalStrings.properties 
b/java/org/apache/coyote/ajp/LocalStrings.properties
index 467035da3f..623f82c4a9 100644
--- a/java/org/apache/coyote/ajp/LocalStrings.properties
+++ b/java/org/apache/coyote/ajp/LocalStrings.properties
@@ -26,6 +26,7 @@ ajpprocessor.header.tooLong=Header message of length [{0}] 
received but the pack
 ajpprocessor.readtimeout=Timeout attempting to read data from the socket
 ajpprocessor.request.prepare=Error preparing request
 ajpprocessor.request.process=Error processing request
+ajpprocessor.response.invalidHeader=The HTTP response header [{0}] with value 
[{1}] has been removed from the response because it is invalid
 ajpprocessor.unknownAttribute=Rejecting request due to unknown request 
attribute [{0}] received from reverse proxy
 
 ajpprotocol.noSSL=SSL is not supported with AJP. The SSL host configuration 
for [{0}] was ignored
diff --git a/test/org/apache/

[tomcat] branch main updated: Fix BZ 66512 - Ignore invalid HHTP response headers for AJP

2023-03-06 Thread markt
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/main by this push:
 new 7c122e0f2c Fix BZ 66512 - Ignore invalid HHTP response headers for AJP
7c122e0f2c is described below

commit 7c122e0f2c6f80cd5a1812afda5b0d5f751636aa
Author: Mark Thomas 
AuthorDate: Mon Mar 6 20:41:44 2023 +

Fix BZ 66512 - Ignore invalid HHTP response headers for AJP

This aligns the behaviour of AJP with that of HTTP.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66512
---
 java/org/apache/coyote/ajp/AjpProcessor.java   | 56 ++--
 java/org/apache/coyote/ajp/LocalStrings.properties |  1 +
 .../coyote/ajp/TestAbstractAjpProcessor.java   | 75 --
 webapps/docs/changelog.xml |  4 ++
 4 files changed, 111 insertions(+), 25 deletions(-)

diff --git a/java/org/apache/coyote/ajp/AjpProcessor.java 
b/java/org/apache/coyote/ajp/AjpProcessor.java
index d2c0e46169..2b76af3eb2 100644
--- a/java/org/apache/coyote/ajp/AjpProcessor.java
+++ b/java/org/apache/coyote/ajp/AjpProcessor.java
@@ -984,32 +984,48 @@ public class AjpProcessor extends AbstractProcessor {
 headers.setValue("Content-Length").setLong(contentLength);
 }
 
-// Write AJP message header
 tmpMB.recycle();
 responseMsgPos = -1;
-responseMessage.reset();
-responseMessage.appendByte(Constants.JK_AJP13_SEND_HEADERS);
 
-// Write HTTP response line
-responseMessage.appendInt(statusCode);
-// Reason phrase is optional but mod_jk + httpd 2.x fails with a null
-// reason phrase - bug 45026
-tmpMB.setString(Integer.toString(response.getStatus()));
-responseMessage.appendBytes(tmpMB);
-
-// Write headers
 int numHeaders = headers.size();
-responseMessage.appendInt(numHeaders);
 for (int i = 0; i < numHeaders; i++) {
-MessageBytes hN = headers.getName(i);
-int hC = Constants.getResponseAjpIndex(hN.toString());
-if (hC > 0) {
-responseMessage.appendInt(hC);
-} else {
-responseMessage.appendBytes(hN);
+if (i == 0) {
+// Write AJP message header
+responseMessage.reset();
+responseMessage.appendByte(Constants.JK_AJP13_SEND_HEADERS);
+
+// Write HTTP response line
+responseMessage.appendInt(statusCode);
+// Reason phrase is optional but mod_jk + httpd 2.x fails with 
a null
+// reason phrase - bug 45026
+tmpMB.setString(Integer.toString(response.getStatus()));
+responseMessage.appendBytes(tmpMB);
+
+// Start headers
+responseMessage.appendInt(numHeaders);
+}
+
+try {
+// Write headers
+MessageBytes hN = headers.getName(i);
+int hC = Constants.getResponseAjpIndex(hN.toString());
+if (hC > 0) {
+responseMessage.appendInt(hC);
+} else {
+responseMessage.appendBytes(hN);
+}
+MessageBytes hV=headers.getValue(i);
+responseMessage.appendBytes(hV);
+} catch (IllegalArgumentException iae) {
+// Log the problematic header
+log.warn(sm.getString("ajpprocessor.response.invalidHeader", 
headers.getName(i),
+headers.getValue(i)), iae);
+// Remove the problematic header
+headers.removeHeader(i);
+numHeaders--;
+// Reset loop and start again
+i = -1;
 }
-MessageBytes hV=headers.getValue(i);
-responseMessage.appendBytes(hV);
 }
 
 // Write to buffer
diff --git a/java/org/apache/coyote/ajp/LocalStrings.properties 
b/java/org/apache/coyote/ajp/LocalStrings.properties
index 467035da3f..623f82c4a9 100644
--- a/java/org/apache/coyote/ajp/LocalStrings.properties
+++ b/java/org/apache/coyote/ajp/LocalStrings.properties
@@ -26,6 +26,7 @@ ajpprocessor.header.tooLong=Header message of length [{0}] 
received but the pack
 ajpprocessor.readtimeout=Timeout attempting to read data from the socket
 ajpprocessor.request.prepare=Error preparing request
 ajpprocessor.request.process=Error processing request
+ajpprocessor.response.invalidHeader=The HTTP response header [{0}] with value 
[{1}] has been removed from the response because it is invalid
 ajpprocessor.unknownAttribute=Rejecting request due to unknown request 
attribute [{0}] received from reverse proxy
 
 ajpprotocol.noSSL=SSL is not supported with AJP. The SSL host configuration 
for [{0}] was ignored
diff --git a/test/org/apache/coyo

[tomcat] branch 9.0.x updated: Fix BZ 66512 - Ignore invalid HHTP response headers for AJP

2023-03-06 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 8823c0288d Fix BZ 66512 - Ignore invalid HHTP response headers for AJP
8823c0288d is described below

commit 8823c0288db4ff943b73bc08f1c9f508ce2d2650
Author: Mark Thomas 
AuthorDate: Mon Mar 6 20:41:44 2023 +

Fix BZ 66512 - Ignore invalid HHTP response headers for AJP

This aligns the behaviour of AJP with that of HTTP.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66512
---
 java/org/apache/coyote/ajp/AjpProcessor.java   | 56 ++--
 java/org/apache/coyote/ajp/LocalStrings.properties |  1 +
 .../coyote/ajp/TestAbstractAjpProcessor.java   | 75 --
 webapps/docs/changelog.xml |  4 ++
 4 files changed, 111 insertions(+), 25 deletions(-)

diff --git a/java/org/apache/coyote/ajp/AjpProcessor.java 
b/java/org/apache/coyote/ajp/AjpProcessor.java
index 8e8110bdab..297c7dc4ce 100644
--- a/java/org/apache/coyote/ajp/AjpProcessor.java
+++ b/java/org/apache/coyote/ajp/AjpProcessor.java
@@ -975,32 +975,48 @@ public class AjpProcessor extends AbstractProcessor {
 headers.setValue("Content-Length").setLong(contentLength);
 }
 
-// Write AJP message header
 tmpMB.recycle();
 responseMsgPos = -1;
-responseMessage.reset();
-responseMessage.appendByte(Constants.JK_AJP13_SEND_HEADERS);
 
-// Write HTTP response line
-responseMessage.appendInt(statusCode);
-// Reason phrase is optional but mod_jk + httpd 2.x fails with a null
-// reason phrase - bug 45026
-tmpMB.setString(Integer.toString(response.getStatus()));
-responseMessage.appendBytes(tmpMB);
-
-// Write headers
 int numHeaders = headers.size();
-responseMessage.appendInt(numHeaders);
 for (int i = 0; i < numHeaders; i++) {
-MessageBytes hN = headers.getName(i);
-int hC = Constants.getResponseAjpIndex(hN.toString());
-if (hC > 0) {
-responseMessage.appendInt(hC);
-} else {
-responseMessage.appendBytes(hN);
+if (i == 0) {
+// Write AJP message header
+responseMessage.reset();
+responseMessage.appendByte(Constants.JK_AJP13_SEND_HEADERS);
+
+// Write HTTP response line
+responseMessage.appendInt(statusCode);
+// Reason phrase is optional but mod_jk + httpd 2.x fails with 
a null
+// reason phrase - bug 45026
+tmpMB.setString(Integer.toString(response.getStatus()));
+responseMessage.appendBytes(tmpMB);
+
+// Start headers
+responseMessage.appendInt(numHeaders);
+}
+
+try {
+// Write headers
+MessageBytes hN = headers.getName(i);
+int hC = Constants.getResponseAjpIndex(hN.toString());
+if (hC > 0) {
+responseMessage.appendInt(hC);
+} else {
+responseMessage.appendBytes(hN);
+}
+MessageBytes hV=headers.getValue(i);
+responseMessage.appendBytes(hV);
+} catch (IllegalArgumentException iae) {
+// Log the problematic header
+log.warn(sm.getString("ajpprocessor.response.invalidHeader", 
headers.getName(i),
+headers.getValue(i)), iae);
+// Remove the problematic header
+headers.removeHeader(i);
+numHeaders--;
+// Reset loop and start again
+i = -1;
 }
-MessageBytes hV=headers.getValue(i);
-responseMessage.appendBytes(hV);
 }
 
 // Write to buffer
diff --git a/java/org/apache/coyote/ajp/LocalStrings.properties 
b/java/org/apache/coyote/ajp/LocalStrings.properties
index 467035da3f..623f82c4a9 100644
--- a/java/org/apache/coyote/ajp/LocalStrings.properties
+++ b/java/org/apache/coyote/ajp/LocalStrings.properties
@@ -26,6 +26,7 @@ ajpprocessor.header.tooLong=Header message of length [{0}] 
received but the pack
 ajpprocessor.readtimeout=Timeout attempting to read data from the socket
 ajpprocessor.request.prepare=Error preparing request
 ajpprocessor.request.process=Error processing request
+ajpprocessor.response.invalidHeader=The HTTP response header [{0}] with value 
[{1}] has been removed from the response because it is invalid
 ajpprocessor.unknownAttribute=Rejecting request due to unknown request 
attribute [{0}] received from reverse proxy
 
 ajpprotocol.noSSL=SSL is not supported with AJP. The SSL host configuration 
for [{0}] was ignored
diff --git a/test/org/apache/co

[tomcat] branch 8.5.x updated: Fix BZ 66512 - Ignore invalid HTTP response headers for AJP

2023-03-06 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 23e6451af2 Fix BZ 66512 - Ignore invalid HTTP response headers for AJP
23e6451af2 is described below

commit 23e6451af22c8af6b9fdceccdb56f8078420b558
Author: Mark Thomas 
AuthorDate: Mon Mar 6 20:41:44 2023 +

Fix BZ 66512 - Ignore invalid HTTP response headers for AJP

This aligns the behaviour of AJP with that of HTTP.
---
 java/org/apache/coyote/ajp/AjpProcessor.java   | 90 +-
 java/org/apache/coyote/ajp/LocalStrings.properties |  1 +
 .../coyote/ajp/TestAbstractAjpProcessor.java   | 75 --
 webapps/docs/changelog.xml |  4 +
 4 files changed, 128 insertions(+), 42 deletions(-)

diff --git a/java/org/apache/coyote/ajp/AjpProcessor.java 
b/java/org/apache/coyote/ajp/AjpProcessor.java
index 534c74ec78..1d9a393f84 100644
--- a/java/org/apache/coyote/ajp/AjpProcessor.java
+++ b/java/org/apache/coyote/ajp/AjpProcessor.java
@@ -1068,49 +1068,65 @@ public class AjpProcessor extends AbstractProcessor {
 headers.setValue("Content-Length").setLong(contentLength);
 }
 
-// Write AJP message header
 tmpMB.recycle();
 responseMsgPos = -1;
-responseMessage.reset();
-responseMessage.appendByte(Constants.JK_AJP13_SEND_HEADERS);
-
-// Write HTTP response line
-responseMessage.appendInt(statusCode);
-if (sendReasonPhrase) {
-String message = null;
-if (org.apache.coyote.Constants.USE_CUSTOM_STATUS_MSG_IN_HEADER &&
-HttpMessages.isSafeInHttpHeader(response.getMessage())) {
-message = response.getMessage();
-}
-if (message == null) {
-message = HttpMessages.getInstance(
-response.getLocale()).getMessage(response.getStatus());
-}
-if (message == null) {
-// mod_jk + httpd 2.x fails with a null status message - bug 
45026
-message = Integer.toString(response.getStatus());
-}
-tmpMB.setString(message);
-} else {
-// Reason phrase is optional but mod_jk + httpd 2.x fails with a 
null
-// reason phrase - bug 45026
-tmpMB.setString(Integer.toString(response.getStatus()));
-}
-responseMessage.appendBytes(tmpMB);
 
-// Write headers
 int numHeaders = headers.size();
-responseMessage.appendInt(numHeaders);
 for (int i = 0; i < numHeaders; i++) {
-MessageBytes hN = headers.getName(i);
-int hC = Constants.getResponseAjpIndex(hN.toString());
-if (hC > 0) {
-responseMessage.appendInt(hC);
-} else {
-responseMessage.appendBytes(hN);
+if (i == 0) {
+// Write AJP message header
+responseMessage.reset();
+responseMessage.appendByte(Constants.JK_AJP13_SEND_HEADERS);
+
+// Write HTTP response line
+responseMessage.appendInt(statusCode);
+if (sendReasonPhrase) {
+String message = null;
+if 
(org.apache.coyote.Constants.USE_CUSTOM_STATUS_MSG_IN_HEADER &&
+
HttpMessages.isSafeInHttpHeader(response.getMessage())) {
+message = response.getMessage();
+}
+if (message == null) {
+message = HttpMessages.getInstance(
+
response.getLocale()).getMessage(response.getStatus());
+}
+if (message == null) {
+// mod_jk + httpd 2.x fails with a null status message 
- bug 45026
+message = Integer.toString(response.getStatus());
+}
+tmpMB.setString(message);
+} else {
+// Reason phrase is optional but mod_jk + httpd 2.x fails 
with a null
+// reason phrase - bug 45026
+tmpMB.setString(Integer.toString(response.getStatus()));
+}
+responseMessage.appendBytes(tmpMB);
+
+// Start headers
+responseMessage.appendInt(numHeaders);
+}
+
+try {
+// Write headers
+MessageBytes hN = headers.getName(i);
+int hC = Constants.getResponseAjpIndex(hN.toString());
+if (hC > 0) {
+responseMessage.appendInt(hC);
+} else {
+responseMessage.appendBytes(hN);
+}
+MessageBytes hV=headers

[tomcat] branch 8.5.x updated: Fix backport

2023-03-06 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 5a3c991804 Fix backport
5a3c991804 is described below

commit 5a3c9918042d19bf9f933b73b88d6d5f2e79dc77
Author: Mark Thomas 
AuthorDate: Mon Mar 6 20:51:19 2023 +

Fix backport
---
 test/org/apache/coyote/ajp/TestAbstractAjpProcessor.java | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/test/org/apache/coyote/ajp/TestAbstractAjpProcessor.java 
b/test/org/apache/coyote/ajp/TestAbstractAjpProcessor.java
index 4adb0d396b..89793f22a8 100644
--- a/test/org/apache/coyote/ajp/TestAbstractAjpProcessor.java
+++ b/test/org/apache/coyote/ajp/TestAbstractAjpProcessor.java
@@ -922,8 +922,13 @@ public class TestAbstractAjpProcessor extends 
TomcatBaseTest {
 Map> headerMap = new HashMap<>();
 for (int i = 0; i < headerCount; i++) {
 String headerName = message.readHeaderName();
-String heaverValue = message.readString();
-headerMap.computeIfAbsent(headerName, k -> new 
ArrayList<>()).add(heaverValue);
+String headerValue = message.readString();
+List headerValues = headerMap.get(headerName);
+if (headerValues == null) {
+headerValues = new ArrayList<>();
+headerMap.put(headerName, headerValues);
+}
+headerValues.add(headerValue);
 }
 
 return headerMap;


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



[tomcat] branch main updated: Fix typo

2023-03-06 Thread markt
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/main by this push:
 new 37fc50107b Fix typo
37fc50107b is described below

commit 37fc50107becca6593dd73e8c1aaf0503ec3fc4c
Author: Mark Thomas 
AuthorDate: Mon Mar 6 20:52:05 2023 +

Fix typo
---
 test/org/apache/coyote/ajp/TestAbstractAjpProcessor.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/test/org/apache/coyote/ajp/TestAbstractAjpProcessor.java 
b/test/org/apache/coyote/ajp/TestAbstractAjpProcessor.java
index 023b7e00e4..a49ba87ea6 100644
--- a/test/org/apache/coyote/ajp/TestAbstractAjpProcessor.java
+++ b/test/org/apache/coyote/ajp/TestAbstractAjpProcessor.java
@@ -920,8 +920,8 @@ public class TestAbstractAjpProcessor extends 
TomcatBaseTest {
 Map> headerMap = new HashMap<>();
 for (int i = 0; i < headerCount; i++) {
 String headerName = message.readHeaderName();
-String heaverValue = message.readString();
-headerMap.computeIfAbsent(headerName, k -> new 
ArrayList<>()).add(heaverValue);
+String headerValue = message.readString();
+headerMap.computeIfAbsent(headerName, k -> new 
ArrayList<>()).add(headerValue);
 }
 
 return headerMap;


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



[tomcat] branch 10.1.x updated: Fix typo

2023-03-06 Thread markt
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/10.1.x by this push:
 new afa1241ba0 Fix typo
afa1241ba0 is described below

commit afa1241ba09096c7903f4ee236941798d3dc32e6
Author: Mark Thomas 
AuthorDate: Mon Mar 6 20:52:05 2023 +

Fix typo
---
 test/org/apache/coyote/ajp/TestAbstractAjpProcessor.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/test/org/apache/coyote/ajp/TestAbstractAjpProcessor.java 
b/test/org/apache/coyote/ajp/TestAbstractAjpProcessor.java
index 8fd82bd920..0976ca5b66 100644
--- a/test/org/apache/coyote/ajp/TestAbstractAjpProcessor.java
+++ b/test/org/apache/coyote/ajp/TestAbstractAjpProcessor.java
@@ -920,8 +920,8 @@ public class TestAbstractAjpProcessor extends 
TomcatBaseTest {
 Map> headerMap = new HashMap<>();
 for (int i = 0; i < headerCount; i++) {
 String headerName = message.readHeaderName();
-String heaverValue = message.readString();
-headerMap.computeIfAbsent(headerName, k -> new 
ArrayList<>()).add(heaverValue);
+String headerValue = message.readString();
+headerMap.computeIfAbsent(headerName, k -> new 
ArrayList<>()).add(headerValue);
 }
 
 return headerMap;


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



[tomcat] branch 9.0.x updated: Fix typo

2023-03-06 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 64a187283c Fix typo
64a187283c is described below

commit 64a187283c4301db58946fcf2fb6f802a6bf69ef
Author: Mark Thomas 
AuthorDate: Mon Mar 6 20:52:05 2023 +

Fix typo
---
 test/org/apache/coyote/ajp/TestAbstractAjpProcessor.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/test/org/apache/coyote/ajp/TestAbstractAjpProcessor.java 
b/test/org/apache/coyote/ajp/TestAbstractAjpProcessor.java
index f2c4c20f3d..5572116c96 100644
--- a/test/org/apache/coyote/ajp/TestAbstractAjpProcessor.java
+++ b/test/org/apache/coyote/ajp/TestAbstractAjpProcessor.java
@@ -922,8 +922,8 @@ public class TestAbstractAjpProcessor extends 
TomcatBaseTest {
 Map> headerMap = new HashMap<>();
 for (int i = 0; i < headerCount; i++) {
 String headerName = message.readHeaderName();
-String heaverValue = message.readString();
-headerMap.computeIfAbsent(headerName, k -> new 
ArrayList<>()).add(heaverValue);
+String headerValue = message.readString();
+headerMap.computeIfAbsent(headerName, k -> new 
ArrayList<>()).add(headerValue);
 }
 
 return headerMap;


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



[tomcat] branch main updated: Code clean-up. Format. No functional change.

2023-03-06 Thread markt
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/main by this push:
 new fac6fc69a0 Code clean-up. Format. No functional change.
fac6fc69a0 is described below

commit fac6fc69a01bfe863ecad57470ece833d168cbbc
Author: Mark Thomas 
AuthorDate: Mon Mar 6 20:54:47 2023 +

Code clean-up. Format. No functional change.
---
 .../org/apache/coyote/ajp/AbstractAjpProtocol.java |  82 +++--
 java/org/apache/coyote/ajp/AjpMessage.java | 103 +++---
 java/org/apache/coyote/ajp/AjpNio2Protocol.java|   4 +-
 java/org/apache/coyote/ajp/AjpNioProtocol.java |   4 +-
 java/org/apache/coyote/ajp/AjpProcessor.java   | 399 +
 java/org/apache/coyote/ajp/Constants.java  | 180 --
 test/org/apache/coyote/ajp/SimpleAjpClient.java|  29 +-
 .../coyote/ajp/TestAbstractAjpProcessor.java   | 149 
 test/org/apache/coyote/ajp/TesterAjpMessage.java   |  10 +-
 9 files changed, 420 insertions(+), 540 deletions(-)

diff --git a/java/org/apache/coyote/ajp/AbstractAjpProtocol.java 
b/java/org/apache/coyote/ajp/AbstractAjpProtocol.java
index 537a1d0b04..16ea5772d7 100644
--- a/java/org/apache/coyote/ajp/AbstractAjpProtocol.java
+++ b/java/org/apache/coyote/ajp/AbstractAjpProtocol.java
@@ -29,10 +29,9 @@ import org.apache.tomcat.util.net.SocketWrapperBase;
 import org.apache.tomcat.util.res.StringManager;
 
 /**
- * The is the base implementation for the AJP protocol handlers. 
Implementations
- * typically extend this base class rather than implement {@link
- * org.apache.coyote.ProtocolHandler}. All of the implementations that ship 
with
- * Tomcat are implemented this way.
+ * The is the base implementation for the AJP protocol handlers. 
Implementations typically extend this base class rather
+ * than implement {@link org.apache.coyote.ProtocolHandler}. All of the 
implementations that ship with Tomcat are
+ * implemented this way.
  *
  * @param  The type of socket used by the implementation
  */
@@ -44,7 +43,7 @@ public abstract class AbstractAjpProtocol extends 
AbstractProtocol {
 protected static final StringManager sm = 
StringManager.getManager(AbstractAjpProtocol.class);
 
 
-public AbstractAjpProtocol(AbstractEndpoint endpoint) {
+public AbstractAjpProtocol(AbstractEndpoint endpoint) {
 super(endpoint);
 setConnectionTimeout(Constants.DEFAULT_CONNECTION_TIMEOUT);
 // AJP does not use Send File
@@ -61,20 +60,16 @@ public abstract class AbstractAjpProtocol extends 
AbstractProtocol {
 
 
 /**
- * {@inheritDoc}
- *
- * Overridden to make getter accessible to other classes in this package.
+ * {@inheritDoc} Overridden to make getter accessible to other classes in 
this package.
  */
 @Override
-protected AbstractEndpoint getEndpoint() {
+protected AbstractEndpoint getEndpoint() {
 return super.getEndpoint();
 }
 
 
 /**
- * {@inheritDoc}
- *
- * AJP does not support protocol negotiation so this always returns null.
+ * {@inheritDoc} AJP does not support protocol negotiation so this always 
returns null.
  */
 @Override
 protected UpgradeProtocol getNegotiatedProtocol(String name) {
@@ -83,9 +78,7 @@ public abstract class AbstractAjpProtocol extends 
AbstractProtocol {
 
 
 /**
- * {@inheritDoc}
- *
- * AJP does not support protocol upgrade so this always returns null.
+ * {@inheritDoc} AJP does not support protocol upgrade so this always 
returns null.
  */
 @Override
 protected UpgradeProtocol getUpgradeProtocol(String name) {
@@ -96,17 +89,18 @@ public abstract class AbstractAjpProtocol extends 
AbstractProtocol {
 // -- managed in the 
ProtocolHandler
 
 private boolean ajpFlush = true;
-public boolean getAjpFlush() { return ajpFlush; }
+
+public boolean getAjpFlush() {
+return ajpFlush;
+}
+
 /**
- * Configure whether to aend an AJP flush packet when flushing. A flush
- * packet is a zero byte AJP13 SEND_BODY_CHUNK packet. mod_jk and
- * mod_proxy_ajp interpret this as a request to flush data to the client.
- * AJP always does flush at the and of the response, so if it is not
- * important, that the packets get streamed up to the client, do not use
- * extra flush packets. For compatibility and to stay on the safe side,
- * flush packets are enabled by default.
+ * Configure whether to aend an AJP flush packet when flushing. A flush 
packet is a zero byte AJP13 SEND_BODY_CHUNK
+ * packet. mod_jk and mod_proxy_ajp interpret this as a request to flush 
data to the client. AJP always does flush
+ * at the and of the response, so if it is not important, that the packets 
get streamed up to the client, do not use
+ * extra flush packe

[tomcat] branch 10.1.x updated: Code clean-up. Format. No functional change.

2023-03-06 Thread markt
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/10.1.x by this push:
 new 11b17e5648 Code clean-up. Format. No functional change.
11b17e5648 is described below

commit 11b17e5648b53dd8146d4f4dda9719e575416417
Author: Mark Thomas 
AuthorDate: Mon Mar 6 20:55:34 2023 +

Code clean-up. Format. No functional change.
---
 .../org/apache/coyote/ajp/AbstractAjpProtocol.java |  90 ++---
 java/org/apache/coyote/ajp/AjpMessage.java | 103 +++---
 java/org/apache/coyote/ajp/AjpNio2Protocol.java|   4 +-
 java/org/apache/coyote/ajp/AjpNioProtocol.java |   4 +-
 java/org/apache/coyote/ajp/AjpProcessor.java   | 399 +
 java/org/apache/coyote/ajp/Constants.java  | 180 --
 test/org/apache/coyote/ajp/SimpleAjpClient.java|  29 +-
 .../coyote/ajp/TestAbstractAjpProcessor.java   | 149 
 test/org/apache/coyote/ajp/TesterAjpMessage.java   |  10 +-
 9 files changed, 424 insertions(+), 544 deletions(-)

diff --git a/java/org/apache/coyote/ajp/AbstractAjpProtocol.java 
b/java/org/apache/coyote/ajp/AbstractAjpProtocol.java
index d865ce831f..ff64a1cd0b 100644
--- a/java/org/apache/coyote/ajp/AbstractAjpProtocol.java
+++ b/java/org/apache/coyote/ajp/AbstractAjpProtocol.java
@@ -29,10 +29,9 @@ import org.apache.tomcat.util.net.SocketWrapperBase;
 import org.apache.tomcat.util.res.StringManager;
 
 /**
- * The is the base implementation for the AJP protocol handlers. 
Implementations
- * typically extend this base class rather than implement {@link
- * org.apache.coyote.ProtocolHandler}. All of the implementations that ship 
with
- * Tomcat are implemented this way.
+ * The is the base implementation for the AJP protocol handlers. 
Implementations typically extend this base class rather
+ * than implement {@link org.apache.coyote.ProtocolHandler}. All of the 
implementations that ship with Tomcat are
+ * implemented this way.
  *
  * @param  The type of socket used by the implementation
  */
@@ -44,7 +43,7 @@ public abstract class AbstractAjpProtocol extends 
AbstractProtocol {
 protected static final StringManager sm = 
StringManager.getManager(AbstractAjpProtocol.class);
 
 
-public AbstractAjpProtocol(AbstractEndpoint endpoint) {
+public AbstractAjpProtocol(AbstractEndpoint endpoint) {
 super(endpoint);
 setConnectionTimeout(Constants.DEFAULT_CONNECTION_TIMEOUT);
 // AJP does not use Send File
@@ -61,20 +60,16 @@ public abstract class AbstractAjpProtocol extends 
AbstractProtocol {
 
 
 /**
- * {@inheritDoc}
- *
- * Overridden to make getter accessible to other classes in this package.
+ * {@inheritDoc} Overridden to make getter accessible to other classes in 
this package.
  */
 @Override
-protected AbstractEndpoint getEndpoint() {
+protected AbstractEndpoint getEndpoint() {
 return super.getEndpoint();
 }
 
 
 /**
- * {@inheritDoc}
- *
- * AJP does not support protocol negotiation so this always returns null.
+ * {@inheritDoc} AJP does not support protocol negotiation so this always 
returns null.
  */
 @Override
 protected UpgradeProtocol getNegotiatedProtocol(String name) {
@@ -83,9 +78,7 @@ public abstract class AbstractAjpProtocol extends 
AbstractProtocol {
 
 
 /**
- * {@inheritDoc}
- *
- * AJP does not support protocol upgrade so this always returns null.
+ * {@inheritDoc} AJP does not support protocol upgrade so this always 
returns null.
  */
 @Override
 protected UpgradeProtocol getUpgradeProtocol(String name) {
@@ -96,17 +89,18 @@ public abstract class AbstractAjpProtocol extends 
AbstractProtocol {
 // -- managed in the 
ProtocolHandler
 
 private boolean ajpFlush = true;
-public boolean getAjpFlush() { return ajpFlush; }
+
+public boolean getAjpFlush() {
+return ajpFlush;
+}
+
 /**
- * Configure whether to aend an AJP flush packet when flushing. A flush
- * packet is a zero byte AJP13 SEND_BODY_CHUNK packet. mod_jk and
- * mod_proxy_ajp interpret this as a request to flush data to the client.
- * AJP always does flush at the and of the response, so if it is not
- * important, that the packets get streamed up to the client, do not use
- * extra flush packets. For compatibility and to stay on the safe side,
- * flush packets are enabled by default.
+ * Configure whether to aend an AJP flush packet when flushing. A flush 
packet is a zero byte AJP13 SEND_BODY_CHUNK
+ * packet. mod_jk and mod_proxy_ajp interpret this as a request to flush 
data to the client. AJP always does flush
+ * at the and of the response, so if it is not important, that the packets 
get streamed up to the client, do not use
+ * extra flush p

[tomcat] branch 9.0.x updated: Code clean-up. Format. No functional change.

2023-03-06 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 48fa6ffe5c Code clean-up. Format. No functional change.
48fa6ffe5c is described below

commit 48fa6ffe5c89582ff6d417f30370dffbcde2a672
Author: Mark Thomas 
AuthorDate: Mon Mar 6 20:56:22 2023 +

Code clean-up. Format. No functional change.
---
 .../org/apache/coyote/ajp/AbstractAjpProtocol.java |  90 ++---
 java/org/apache/coyote/ajp/AjpAprProtocol.java |  16 +-
 java/org/apache/coyote/ajp/AjpMessage.java | 103 +++---
 java/org/apache/coyote/ajp/AjpNio2Protocol.java|   4 +-
 java/org/apache/coyote/ajp/AjpNioProtocol.java |   4 +-
 java/org/apache/coyote/ajp/AjpProcessor.java   | 393 +
 java/org/apache/coyote/ajp/Constants.java  | 180 --
 test/org/apache/coyote/ajp/SimpleAjpClient.java|  29 +-
 .../coyote/ajp/TestAbstractAjpProcessor.java   | 149 
 test/org/apache/coyote/ajp/TesterAjpMessage.java   |  10 +-
 10 files changed, 432 insertions(+), 546 deletions(-)

diff --git a/java/org/apache/coyote/ajp/AbstractAjpProtocol.java 
b/java/org/apache/coyote/ajp/AbstractAjpProtocol.java
index d865ce831f..ff64a1cd0b 100644
--- a/java/org/apache/coyote/ajp/AbstractAjpProtocol.java
+++ b/java/org/apache/coyote/ajp/AbstractAjpProtocol.java
@@ -29,10 +29,9 @@ import org.apache.tomcat.util.net.SocketWrapperBase;
 import org.apache.tomcat.util.res.StringManager;
 
 /**
- * The is the base implementation for the AJP protocol handlers. 
Implementations
- * typically extend this base class rather than implement {@link
- * org.apache.coyote.ProtocolHandler}. All of the implementations that ship 
with
- * Tomcat are implemented this way.
+ * The is the base implementation for the AJP protocol handlers. 
Implementations typically extend this base class rather
+ * than implement {@link org.apache.coyote.ProtocolHandler}. All of the 
implementations that ship with Tomcat are
+ * implemented this way.
  *
  * @param  The type of socket used by the implementation
  */
@@ -44,7 +43,7 @@ public abstract class AbstractAjpProtocol extends 
AbstractProtocol {
 protected static final StringManager sm = 
StringManager.getManager(AbstractAjpProtocol.class);
 
 
-public AbstractAjpProtocol(AbstractEndpoint endpoint) {
+public AbstractAjpProtocol(AbstractEndpoint endpoint) {
 super(endpoint);
 setConnectionTimeout(Constants.DEFAULT_CONNECTION_TIMEOUT);
 // AJP does not use Send File
@@ -61,20 +60,16 @@ public abstract class AbstractAjpProtocol extends 
AbstractProtocol {
 
 
 /**
- * {@inheritDoc}
- *
- * Overridden to make getter accessible to other classes in this package.
+ * {@inheritDoc} Overridden to make getter accessible to other classes in 
this package.
  */
 @Override
-protected AbstractEndpoint getEndpoint() {
+protected AbstractEndpoint getEndpoint() {
 return super.getEndpoint();
 }
 
 
 /**
- * {@inheritDoc}
- *
- * AJP does not support protocol negotiation so this always returns null.
+ * {@inheritDoc} AJP does not support protocol negotiation so this always 
returns null.
  */
 @Override
 protected UpgradeProtocol getNegotiatedProtocol(String name) {
@@ -83,9 +78,7 @@ public abstract class AbstractAjpProtocol extends 
AbstractProtocol {
 
 
 /**
- * {@inheritDoc}
- *
- * AJP does not support protocol upgrade so this always returns null.
+ * {@inheritDoc} AJP does not support protocol upgrade so this always 
returns null.
  */
 @Override
 protected UpgradeProtocol getUpgradeProtocol(String name) {
@@ -96,17 +89,18 @@ public abstract class AbstractAjpProtocol extends 
AbstractProtocol {
 // -- managed in the 
ProtocolHandler
 
 private boolean ajpFlush = true;
-public boolean getAjpFlush() { return ajpFlush; }
+
+public boolean getAjpFlush() {
+return ajpFlush;
+}
+
 /**
- * Configure whether to aend an AJP flush packet when flushing. A flush
- * packet is a zero byte AJP13 SEND_BODY_CHUNK packet. mod_jk and
- * mod_proxy_ajp interpret this as a request to flush data to the client.
- * AJP always does flush at the and of the response, so if it is not
- * important, that the packets get streamed up to the client, do not use
- * extra flush packets. For compatibility and to stay on the safe side,
- * flush packets are enabled by default.
+ * Configure whether to aend an AJP flush packet when flushing. A flush 
packet is a zero byte AJP13 SEND_BODY_CHUNK
+ * packet. mod_jk and mod_proxy_ajp interpret this as a request to flush 
data to the client. AJP always does flush
+ * at the and of the response, so if it is not important, that the packets 
get

[tomcat] branch 8.5.x updated: Code clean-up. Format. No functional change.

2023-03-06 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 972bd0ad6b Code clean-up. Format. No functional change.
972bd0ad6b is described below

commit 972bd0ad6bcdf80cf63946dbc2db9305bc407787
Author: Mark Thomas 
AuthorDate: Mon Mar 6 20:57:03 2023 +

Code clean-up. Format. No functional change.
---
 .../org/apache/coyote/ajp/AbstractAjpProtocol.java |  90 ++--
 java/org/apache/coyote/ajp/AjpAprProtocol.java |  16 +-
 java/org/apache/coyote/ajp/AjpMessage.java | 103 ++---
 java/org/apache/coyote/ajp/AjpNio2Protocol.java|   4 +-
 java/org/apache/coyote/ajp/AjpNioProtocol.java |   4 +-
 java/org/apache/coyote/ajp/AjpProcessor.java   | 471 ++---
 java/org/apache/coyote/ajp/Constants.java  | 180 +++-
 test/org/apache/coyote/ajp/SimpleAjpClient.java|  29 +-
 .../coyote/ajp/TestAbstractAjpProcessor.java   | 149 +++
 test/org/apache/coyote/ajp/TesterAjpMessage.java   |  10 +-
 10 files changed, 478 insertions(+), 578 deletions(-)

diff --git a/java/org/apache/coyote/ajp/AbstractAjpProtocol.java 
b/java/org/apache/coyote/ajp/AbstractAjpProtocol.java
index 14c0848462..f2f07f9294 100644
--- a/java/org/apache/coyote/ajp/AbstractAjpProtocol.java
+++ b/java/org/apache/coyote/ajp/AbstractAjpProtocol.java
@@ -29,10 +29,9 @@ import org.apache.tomcat.util.net.SocketWrapperBase;
 import org.apache.tomcat.util.res.StringManager;
 
 /**
- * The is the base implementation for the AJP protocol handlers. 
Implementations
- * typically extend this base class rather than implement {@link
- * org.apache.coyote.ProtocolHandler}. All of the implementations that ship 
with
- * Tomcat are implemented this way.
+ * The is the base implementation for the AJP protocol handlers. 
Implementations typically extend this base class rather
+ * than implement {@link org.apache.coyote.ProtocolHandler}. All of the 
implementations that ship with Tomcat are
+ * implemented this way.
  *
  * @param  The type of socket used by the implementation
  */
@@ -44,7 +43,7 @@ public abstract class AbstractAjpProtocol extends 
AbstractProtocol {
 protected static final StringManager sm = 
StringManager.getManager(AbstractAjpProtocol.class);
 
 
-public AbstractAjpProtocol(AbstractEndpoint endpoint) {
+public AbstractAjpProtocol(AbstractEndpoint endpoint) {
 super(endpoint);
 setConnectionTimeout(Constants.DEFAULT_CONNECTION_TIMEOUT);
 // AJP does not use Send File
@@ -61,20 +60,16 @@ public abstract class AbstractAjpProtocol extends 
AbstractProtocol {
 
 
 /**
- * {@inheritDoc}
- *
- * Overridden to make getter accessible to other classes in this package.
+ * {@inheritDoc} Overridden to make getter accessible to other classes in 
this package.
  */
 @Override
-protected AbstractEndpoint getEndpoint() {
+protected AbstractEndpoint getEndpoint() {
 return super.getEndpoint();
 }
 
 
 /**
- * {@inheritDoc}
- *
- * AJP does not support protocol negotiation so this always returns null.
+ * {@inheritDoc} AJP does not support protocol negotiation so this always 
returns null.
  */
 @Override
 protected UpgradeProtocol getNegotiatedProtocol(String name) {
@@ -83,9 +78,7 @@ public abstract class AbstractAjpProtocol extends 
AbstractProtocol {
 
 
 /**
- * {@inheritDoc}
- *
- * AJP does not support protocol upgrade so this always returns null.
+ * {@inheritDoc} AJP does not support protocol upgrade so this always 
returns null.
  */
 @Override
 protected UpgradeProtocol getUpgradeProtocol(String name) {
@@ -96,17 +89,18 @@ public abstract class AbstractAjpProtocol extends 
AbstractProtocol {
 // -- managed in the 
ProtocolHandler
 
 protected boolean ajpFlush = true;
-public boolean getAjpFlush() { return ajpFlush; }
+
+public boolean getAjpFlush() {
+return ajpFlush;
+}
+
 /**
- * Configure whether to aend an AJP flush packet when flushing. A flush
- * packet is a zero byte AJP13 SEND_BODY_CHUNK packet. mod_jk and
- * mod_proxy_ajp interpret this as a request to flush data to the client.
- * AJP always does flush at the and of the response, so if it is not
- * important, that the packets get streamed up to the client, do not use
- * extra flush packets. For compatibility and to stay on the safe side,
- * flush packets are enabled by default.
+ * Configure whether to aend an AJP flush packet when flushing. A flush 
packet is a zero byte AJP13 SEND_BODY_CHUNK
+ * packet. mod_jk and mod_proxy_ajp interpret this as a request to flush 
data to the client. AJP always does flush
+ * at the and of the response, so if it is not important, that the packets 
get st

[tomcat] branch 9.0.x updated: Align with 10.0.x

2023-03-06 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 5fd6daa5ff Align with 10.0.x
5fd6daa5ff is described below

commit 5fd6daa5ffb4ef7927fd159ed162e977619ac7df
Author: Mark Thomas 
AuthorDate: Mon Mar 6 21:04:09 2023 +

Align with 10.0.x
---
 java/org/apache/coyote/ajp/AjpProcessor.java   | 34 +++---
 .../coyote/ajp/TestAbstractAjpProcessor.java   |  2 +-
 2 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/java/org/apache/coyote/ajp/AjpProcessor.java 
b/java/org/apache/coyote/ajp/AjpProcessor.java
index 6e577b4a5b..05c7c9df47 100644
--- a/java/org/apache/coyote/ajp/AjpProcessor.java
+++ b/java/org/apache/coyote/ajp/AjpProcessor.java
@@ -126,24 +126,24 @@ public class AjpProcessor extends AbstractProcessor {
 System.arraycopy(pongMessage.getBuffer(), 0, pongMessageArray, 0, 
pongMessage.getLen());
 
 // Build the Set of javax attributes
+Set s2 = new HashSet<>();
+s2.add("javax.servlet.request.cipher_suite");
+s2.add("javax.servlet.request.key_size");
+s2.add("javax.servlet.request.ssl_session");
+s2.add("javax.servlet.request.X509Certificate");
+javaxAttributes = Collections.unmodifiableSet(s2);
+
 Set s = new HashSet<>();
-s.add("javax.servlet.request.cipher_suite");
-s.add("javax.servlet.request.key_size");
-s.add("javax.servlet.request.ssl_session");
-s.add("javax.servlet.request.X509Certificate");
-javaxAttributes = Collections.unmodifiableSet(s);
-
-Set iis = new HashSet<>();
-iis.add("CERT_ISSUER");
-iis.add("CERT_SUBJECT");
-iis.add("CERT_COOKIE");
-iis.add("HTTPS_SERVER_SUBJECT");
-iis.add("CERT_FLAGS");
-iis.add("HTTPS_SECRETKEYSIZE");
-iis.add("CERT_SERIALNUMBER");
-iis.add("HTTPS_SERVER_ISSUER");
-iis.add("HTTPS_KEYSIZE");
-iisTlsAttributes = Collections.unmodifiableSet(iis);
+s.add("CERT_ISSUER");
+s.add("CERT_SUBJECT");
+s.add("CERT_COOKIE");
+s.add("HTTPS_SERVER_SUBJECT");
+s.add("CERT_FLAGS");
+s.add("HTTPS_SECRETKEYSIZE");
+s.add("CERT_SERIALNUMBER");
+s.add("HTTPS_SERVER_ISSUER");
+s.add("HTTPS_KEYSIZE");
+iisTlsAttributes = Collections.unmodifiableSet(s);
 }
 
 
diff --git a/test/org/apache/coyote/ajp/TestAbstractAjpProcessor.java 
b/test/org/apache/coyote/ajp/TestAbstractAjpProcessor.java
index dae329a5c7..eb1ae12aff 100644
--- a/test/org/apache/coyote/ajp/TestAbstractAjpProcessor.java
+++ b/test/org/apache/coyote/ajp/TestAbstractAjpProcessor.java
@@ -505,7 +505,7 @@ public class TestAbstractAjpProcessor extends 
TomcatBaseTest {
 @Test
 public void testSecret() throws Exception {
 Tomcat tomcat = getTomcatInstance();
-Assert.assertTrue(tomcat.getConnector().setProperty("requiredSecret", 
"RIGHTSECRET"));
+Assert.assertTrue(tomcat.getConnector().setProperty("secret", 
"RIGHTSECRET"));
 tomcat.start();
 
 // No file system docBase required


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

2023-03-06 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 3b74a8877c Align with 9.0.x
3b74a8877c is described below

commit 3b74a8877c54c1516513f746286e6e0ebdf55287
Author: Mark Thomas 
AuthorDate: Mon Mar 6 21:07:24 2023 +

Align with 9.0.x
---
 java/org/apache/coyote/ajp/AjpProcessor.java   | 34 +++---
 .../coyote/ajp/TestAbstractAjpProcessor.java   |  2 +-
 2 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/java/org/apache/coyote/ajp/AjpProcessor.java 
b/java/org/apache/coyote/ajp/AjpProcessor.java
index b1e5ca93bc..103f90f700 100644
--- a/java/org/apache/coyote/ajp/AjpProcessor.java
+++ b/java/org/apache/coyote/ajp/AjpProcessor.java
@@ -127,24 +127,24 @@ public class AjpProcessor extends AbstractProcessor {
 System.arraycopy(pongMessage.getBuffer(), 0, pongMessageArray, 0, 
pongMessage.getLen());
 
 // Build the Set of javax attributes
+Set s2 = new HashSet<>();
+s2.add("javax.servlet.request.cipher_suite");
+s2.add("javax.servlet.request.key_size");
+s2.add("javax.servlet.request.ssl_session");
+s2.add("javax.servlet.request.X509Certificate");
+javaxAttributes = Collections.unmodifiableSet(s2);
+
 Set s = new HashSet<>();
-s.add("javax.servlet.request.cipher_suite");
-s.add("javax.servlet.request.key_size");
-s.add("javax.servlet.request.ssl_session");
-s.add("javax.servlet.request.X509Certificate");
-javaxAttributes = Collections.unmodifiableSet(s);
-
-Set iis = new HashSet<>();
-iis.add("CERT_ISSUER");
-iis.add("CERT_SUBJECT");
-iis.add("CERT_COOKIE");
-iis.add("HTTPS_SERVER_SUBJECT");
-iis.add("CERT_FLAGS");
-iis.add("HTTPS_SECRETKEYSIZE");
-iis.add("CERT_SERIALNUMBER");
-iis.add("HTTPS_SERVER_ISSUER");
-iis.add("HTTPS_KEYSIZE");
-iisTlsAttributes = Collections.unmodifiableSet(iis);
+s.add("CERT_ISSUER");
+s.add("CERT_SUBJECT");
+s.add("CERT_COOKIE");
+s.add("HTTPS_SERVER_SUBJECT");
+s.add("CERT_FLAGS");
+s.add("HTTPS_SECRETKEYSIZE");
+s.add("CERT_SERIALNUMBER");
+s.add("HTTPS_SERVER_ISSUER");
+s.add("HTTPS_KEYSIZE");
+iisTlsAttributes = Collections.unmodifiableSet(s);
 }
 
 
diff --git a/test/org/apache/coyote/ajp/TestAbstractAjpProcessor.java 
b/test/org/apache/coyote/ajp/TestAbstractAjpProcessor.java
index b3fccd1b3e..0ab9f77618 100644
--- a/test/org/apache/coyote/ajp/TestAbstractAjpProcessor.java
+++ b/test/org/apache/coyote/ajp/TestAbstractAjpProcessor.java
@@ -505,7 +505,7 @@ public class TestAbstractAjpProcessor extends 
TomcatBaseTest {
 @Test
 public void testSecret() throws Exception {
 Tomcat tomcat = getTomcatInstance();
-Assert.assertTrue(tomcat.getConnector().setProperty("requiredSecret", 
"RIGHTSECRET"));
+Assert.assertTrue(tomcat.getConnector().setProperty("secret", 
"RIGHTSECRET"));
 tomcat.start();
 
 // No file system docBase required


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



[tomcat] branch 10.1.x updated: Use new attribute name. Align with 11.0.x.

2023-03-06 Thread markt
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/10.1.x by this push:
 new 12618a8892 Use new attribute name. Align with 11.0.x.
12618a8892 is described below

commit 12618a8892587688670826d24d9ae6d3a3b0dc69
Author: Mark Thomas 
AuthorDate: Mon Mar 6 21:02:31 2023 +

Use new attribute name. Align with 11.0.x.
---
 test/org/apache/coyote/ajp/TestAbstractAjpProcessor.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/org/apache/coyote/ajp/TestAbstractAjpProcessor.java 
b/test/org/apache/coyote/ajp/TestAbstractAjpProcessor.java
index 3f76166409..111b033e85 100644
--- a/test/org/apache/coyote/ajp/TestAbstractAjpProcessor.java
+++ b/test/org/apache/coyote/ajp/TestAbstractAjpProcessor.java
@@ -503,7 +503,7 @@ public class TestAbstractAjpProcessor extends 
TomcatBaseTest {
 @Test
 public void testSecret() throws Exception {
 Tomcat tomcat = getTomcatInstance();
-Assert.assertTrue(tomcat.getConnector().setProperty("requiredSecret", 
"RIGHTSECRET"));
+Assert.assertTrue(tomcat.getConnector().setProperty("secret", 
"RIGHTSECRET"));
 tomcat.start();
 
 // No file system docBase required


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



[Bug 66512] File downloads render as empty if access to Tomcat based application is delegated via AJP

2023-03-06 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=66512

--- Comment #14 from Mark Thomas  ---
Dev build for evaluation available from:
https://people.apache.org/~markt/dev/v9.0.74-dev/

Usual caveats apply:
- this is not an official release
- use it at your own risk

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



Buildbot success in on tomcat-9.0.x

2023-03-06 Thread buildbot
Build status: Build succeeded!
Worker used: bb_worker2_ubuntu
URL: https://ci2.apache.org/#builders/37/builds/484
Blamelist: Mark Thomas 
Build Text: build successful
Status Detected: restored build
Build Source Stamp: [branch 9.0.x] 5fd6daa5ffb4ef7927fd159ed162e977619ac7df


Steps:

  worker_preparation: 0

  git: 0

  shell: 0

  shell_1: 0

  shell_2: 0

  shell_3: 0

  shell_4: 0

  shell_5: 0

  compile: 1

  shell_6: 0

  shell_7: 0

  shell_8: 0

  shell_9: 0

  Rsync docs to nightlies.apache.org: 0

  shell_10: 0

  Rsync RAT to nightlies.apache.org: 0

  compile_1: 1

  shell_11: 0

  Rsync Logs to nightlies.apache.org: 0


-- ASF Buildbot


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



tomcat-native v2.0+ breaks unix domain socket support on java16-

2023-03-06 Thread Graham Leggett
Hi all,

A while back I added unix domain socket support to tomcat-native, and patched 
tomcat to use it until java16 is available.

Unfortunately unix domain socket support was removed from tomcat-native 2.0+, 
and now tomcat-native 2.0+ is appearing in distros, meaning that unix domain 
socket support just broke.

https://tomcat.apache.org/native-doc/miscellaneous/changelog.html

"Remove all API methods (and supporting code) that are not used by Tomcat 
10.1.x to support the use of OpenSSL as a replacement for JSSE to provide TLS 
functionality. (markt)”

Is there a way to fix this, or has tomcat just broken everything for anyone in 
a RHEL environment?

Regards,
Graham
—


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



[tomcat] branch main updated: Fix BZ 66507 - Catalina version command not honoring JAVA_OPTS variable

2023-03-06 Thread lihan
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/main by this push:
 new 2ee1135c46 Fix BZ 66507 - Catalina version command not honoring 
JAVA_OPTS variable
2ee1135c46 is described below

commit 2ee1135c46654ff366b50077ef0bce7090666dfa
Author: lihan 
AuthorDate: Tue Mar 7 11:38:51 2023 +0800

Fix BZ 66507 - Catalina version command not honoring JAVA_OPTS variable

Patch suggested by Eric Hamilton
https://bz.apache.org/bugzilla/show_bug.cgi?id=66507
---
 bin/catalina.bat | 2 +-
 bin/catalina.sh  | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/bin/catalina.bat b/bin/catalina.bat
index 068cd283bc..6350932852 100755
--- a/bin/catalina.bat
+++ b/bin/catalina.bat
@@ -304,7 +304,7 @@ set CATALINA_OPTS=
 goto execCmd
 
 :doVersion
-%_EXECJAVA% -classpath "%CATALINA_HOME%\lib\catalina.jar" 
org.apache.catalina.util.ServerInfo
+%_EXECJAVA% %JAVA_OPTS% -classpath "%CATALINA_HOME%\lib\catalina.jar" 
org.apache.catalina.util.ServerInfo
 goto end
 
 
diff --git a/bin/catalina.sh b/bin/catalina.sh
index a7b14b6957..33649fac27 100755
--- a/bin/catalina.sh
+++ b/bin/catalina.sh
@@ -562,9 +562,9 @@ elif [ "$1" = "configtest" ] ; then
 
 elif [ "$1" = "version" ] ; then
 
-"$_RUNJAVA"   \
-  -classpath "$CATALINA_HOME/lib/catalina.jar" \
-  org.apache.catalina.util.ServerInfo
+   eval "\"$_RUNJAVA\"" "$JAVA_OPTS" \
+ -classpath "\"$CATALINA_HOME/lib/catalina.jar\"" \
+ org.apache.catalina.util.ServerInfo
 
 else
 


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



[tomcat] branch 10.1.x updated: Fix BZ 66507 - Catalina version command not honoring JAVA_OPTS variable

2023-03-06 Thread lihan
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/10.1.x by this push:
 new c4acd4faa9 Fix BZ 66507 - Catalina version command not honoring 
JAVA_OPTS variable
c4acd4faa9 is described below

commit c4acd4faa9b297dfffecc82df0b1a4dc4479d067
Author: lihan 
AuthorDate: Tue Mar 7 11:38:51 2023 +0800

Fix BZ 66507 - Catalina version command not honoring JAVA_OPTS variable

Patch suggested by Eric Hamilton
https://bz.apache.org/bugzilla/show_bug.cgi?id=66507
---
 bin/catalina.bat | 2 +-
 bin/catalina.sh  | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/bin/catalina.bat b/bin/catalina.bat
index 824773b460..a5cf1a92f6 100755
--- a/bin/catalina.bat
+++ b/bin/catalina.bat
@@ -324,7 +324,7 @@ set CATALINA_OPTS=
 goto execCmd
 
 :doVersion
-%_EXECJAVA% -classpath "%CATALINA_HOME%\lib\catalina.jar" 
org.apache.catalina.util.ServerInfo
+%_EXECJAVA% %JAVA_OPTS% -classpath "%CATALINA_HOME%\lib\catalina.jar" 
org.apache.catalina.util.ServerInfo
 goto end
 
 
diff --git a/bin/catalina.sh b/bin/catalina.sh
index a15accbdb5..32f87ffb6f 100755
--- a/bin/catalina.sh
+++ b/bin/catalina.sh
@@ -614,9 +614,9 @@ elif [ "$1" = "configtest" ] ; then
 
 elif [ "$1" = "version" ] ; then
 
-"$_RUNJAVA"   \
-  -classpath "$CATALINA_HOME/lib/catalina.jar" \
-  org.apache.catalina.util.ServerInfo
+   eval "\"$_RUNJAVA\"" "$JAVA_OPTS" \
+ -classpath "\"$CATALINA_HOME/lib/catalina.jar\"" \
+ org.apache.catalina.util.ServerInfo
 
 else
 


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



[tomcat] branch 9.0.x updated: Fix BZ 66507 - Catalina version command not honoring JAVA_OPTS variable

2023-03-06 Thread lihan
This is an automated email from the ASF dual-hosted git repository.

lihan 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 33b47cf5eb Fix BZ 66507 - Catalina version command not honoring 
JAVA_OPTS variable
33b47cf5eb is described below

commit 33b47cf5ebcbcfbc91e2923e82d3f5aeae423aa3
Author: lihan 
AuthorDate: Tue Mar 7 11:38:51 2023 +0800

Fix BZ 66507 - Catalina version command not honoring JAVA_OPTS variable

Patch suggested by Eric Hamilton
https://bz.apache.org/bugzilla/show_bug.cgi?id=66507
---
 bin/catalina.bat | 2 +-
 bin/catalina.sh  | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/bin/catalina.bat b/bin/catalina.bat
index 282aefcfd2..84a5f39b48 100755
--- a/bin/catalina.bat
+++ b/bin/catalina.bat
@@ -356,7 +356,7 @@ set CATALINA_OPTS=
 goto execCmd
 
 :doVersion
-%_EXECJAVA% -classpath "%CATALINA_HOME%\lib\catalina.jar" 
org.apache.catalina.util.ServerInfo
+%_EXECJAVA% %JAVA_OPTS% -classpath "%CATALINA_HOME%\lib\catalina.jar" 
org.apache.catalina.util.ServerInfo
 goto end
 
 
diff --git a/bin/catalina.sh b/bin/catalina.sh
index d738853938..3a2ffdafa0 100755
--- a/bin/catalina.sh
+++ b/bin/catalina.sh
@@ -656,9 +656,9 @@ elif [ "$1" = "configtest" ] ; then
 
 elif [ "$1" = "version" ] ; then
 
-"$_RUNJAVA"   \
-  -classpath "$CATALINA_HOME/lib/catalina.jar" \
-  org.apache.catalina.util.ServerInfo
+   eval "\"$_RUNJAVA\"" "$JAVA_OPTS" \
+ -classpath "\"$CATALINA_HOME/lib/catalina.jar\"" \
+ org.apache.catalina.util.ServerInfo
 
 else
 


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



[tomcat] branch 8.5.x updated: Fix BZ 66507 - Catalina version command not honoring JAVA_OPTS variable

2023-03-06 Thread lihan
This is an automated email from the ASF dual-hosted git repository.

lihan 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 04174d9307 Fix BZ 66507 - Catalina version command not honoring 
JAVA_OPTS variable
04174d9307 is described below

commit 04174d9307893cf4cdda8e0761a62e71758edd0f
Author: lihan 
AuthorDate: Tue Mar 7 11:38:51 2023 +0800

Fix BZ 66507 - Catalina version command not honoring JAVA_OPTS variable

Patch suggested by Eric Hamilton
https://bz.apache.org/bugzilla/show_bug.cgi?id=66507
---
 bin/catalina.bat | 2 +-
 bin/catalina.sh  | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/bin/catalina.bat b/bin/catalina.bat
index 282aefcfd2..84a5f39b48 100755
--- a/bin/catalina.bat
+++ b/bin/catalina.bat
@@ -356,7 +356,7 @@ set CATALINA_OPTS=
 goto execCmd
 
 :doVersion
-%_EXECJAVA% -classpath "%CATALINA_HOME%\lib\catalina.jar" 
org.apache.catalina.util.ServerInfo
+%_EXECJAVA% %JAVA_OPTS% -classpath "%CATALINA_HOME%\lib\catalina.jar" 
org.apache.catalina.util.ServerInfo
 goto end
 
 
diff --git a/bin/catalina.sh b/bin/catalina.sh
index d738853938..3a2ffdafa0 100755
--- a/bin/catalina.sh
+++ b/bin/catalina.sh
@@ -656,9 +656,9 @@ elif [ "$1" = "configtest" ] ; then
 
 elif [ "$1" = "version" ] ; then
 
-"$_RUNJAVA"   \
-  -classpath "$CATALINA_HOME/lib/catalina.jar" \
-  org.apache.catalina.util.ServerInfo
+   eval "\"$_RUNJAVA\"" "$JAVA_OPTS" \
+ -classpath "\"$CATALINA_HOME/lib/catalina.jar\"" \
+ org.apache.catalina.util.ServerInfo
 
 else
 


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



[Bug 66507] Catalina version command not honoring JAVA_OPTS variable

2023-03-06 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=66507

Han Li  changed:

   What|Removed |Added

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

--- Comment #2 from Han Li  ---
Thanks for reporting this.

Fixed in:
- 11.0.x for 11.0.0-M5 onwards
- 10.1.x for 10.1.8 onwards
- 9.0.x for 9.0.74 onwards
- 8.5.x for 8.5.88 onwards

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



[GitHub] [tomcat] aooohan commented on pull request #595: Exception message error

2023-03-06 Thread via GitHub


aooohan commented on PR #595:
URL: https://github.com/apache/tomcat/pull/595#issuecomment-1457597852

   Thanks for reporting this. However, I found differences between this file 
and spec, so I will update it to align with spec.


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

To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org

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


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



[GitHub] [tomcat] aooohan closed pull request #595: Exception message error

2023-03-06 Thread via GitHub


aooohan closed pull request #595: Exception message error
URL: https://github.com/apache/tomcat/pull/595


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

To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org

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


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



[tomcat] branch main updated: Align with spec

2023-03-06 Thread lihan
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/main by this push:
 new 1fc4b7c95d Align with spec
1fc4b7c95d is described below

commit 1fc4b7c95dce1db3d86db9393c78023b93725f63
Author: lihan 
AuthorDate: Tue Mar 7 14:16:53 2023 +0800

Align with spec
---
 java/jakarta/servlet/http/HttpFilter.java | 130 --
 1 file changed, 86 insertions(+), 44 deletions(-)

diff --git a/java/jakarta/servlet/http/HttpFilter.java 
b/java/jakarta/servlet/http/HttpFilter.java
index 4c7154bea6..14d14b35b0 100644
--- a/java/jakarta/servlet/http/HttpFilter.java
+++ b/java/jakarta/servlet/http/HttpFilter.java
@@ -25,63 +25,105 @@ import jakarta.servlet.ServletRequest;
 import jakarta.servlet.ServletResponse;
 
 /**
- * Provides a base class that implements the Filter interface and ensures that 
the Request and Response are of type
- * HttpServletRequest and HttpServletResponse respectively.
+ *
+ * 
+ * Provides an abstract class to be subclassed to create an HTTP filter 
suitable for a Web site. A subclass of
+ * HttpFilter should override
+ * {@link #doFilter(jakarta.servlet.http.HttpServletRequest, 
jakarta.servlet.http.HttpServletResponse, jakarta.servlet.FilterChain) }.
+ * 
+ *
+ * 
+ * Filters typically run on multithreaded servers, so be aware that a filter 
must handle concurrent requests and be
+ * careful to synchronize access to shared resources. Shared resources include 
in-memory data such as instance or class
+ * variables and external objects such as files, database connections, and 
network connections. See the
+ * https://docs.oracle.com/javase/tutorial/essential/concurrency/";> 
Java Tutorial on Multithreaded
+ * Programming for more information on handling multiple threads in a Java 
program.
+ *
+ * @author Various
+ *
+ * @since Servlet 4.0
  */
 public abstract class HttpFilter extends GenericFilter {
 
-private static final long serialVersionUID = 1L;
+private static final long serialVersionUID = 7478463438252262094L;
+
+/**
+ * 
+ * Does nothing, because this is an abstract class.
+ * 
+ *
+ * @since Servlet 4.0
+ */
+public HttpFilter() {
+}
 
 /**
- * {@inheritDoc} This implementation tests the request and response to see 
if they are instances of
- * {@link HttpServletRequest} and {@link HttpServletResponse} 
respectively. If they are then they are passed to
- * {@link #doFilter(HttpServletRequest, HttpServletResponse, 
FilterChain)}. If not, a {@link ServletException} is
- * thrown.
  *
- * @throws ServletException If either the request or response are not of 
the expected types or any other error
- *  occurs
+ * 
+ * The doFilter method of the Filter is called by the 
container each time a request/response pair is passed
+ * through the chain due to a client request for a resource at the end of 
the chain. The FilterChain passed in to this
+ * method allows the Filter to pass on the request and response to the 
next entity in the chain. There's no need to
+ * override this method.
+ * 
+ *
+ * 
+ * The default implementation inspects the incoming {@code req} and {@code 
res} objects to determine if they are
+ * instances of {@link HttpServletRequest} and {@link 
HttpServletResponse}, respectively. If not, a
+ * {@link ServletException} is thrown. Otherwise, the protected
+ * {@link #doFilter(jakarta.servlet.http.HttpServletRequest, 
jakarta.servlet.http.HttpServletResponse, jakarta.servlet.FilterChain)}
+ * method is called.
+ * 
+ *
+ * @param req a {@link ServletRequest} object that contains the request 
the client has made of the filter
+ *
+ * @param res a {@link ServletResponse} object that contains the response 
the filter sends to the client
+ *
+ * @param chain the FilterChain for invoking the next filter 
or the resource
+ *
+ * @throws IOException if an input or output error is detected when the 
filter handles the request
+ *
+ * @throws ServletException if the request for the could not be handled or 
either parameter is not an instance of the
+ * respective {@link HttpServletRequest} or {@link HttpServletResponse}.
+ *
+ * @since Servlet 4.0
  */
 @Override
-public void doFilter(ServletRequest request, ServletResponse response, 
FilterChain chain)
-throws IOException, ServletException {
-if (!(request instanceof HttpServletRequest)) {
-throw new ServletException(request + " not HttpServletRequest");
-}
-if (!(response instanceof HttpServletResponse)) {
-throw new ServletException(request + " not HttpServletResponse");
+public void doFilter(ServletRequest req, ServletResponse res, FilterChain 
chain)
+

[tomcat] branch 10.1.x updated: Align with spec

2023-03-06 Thread lihan
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/10.1.x by this push:
 new 5f0a1b92f6 Align with spec
5f0a1b92f6 is described below

commit 5f0a1b92f685b86c00ce6ca18b779b42e562f517
Author: lihan 
AuthorDate: Tue Mar 7 14:16:53 2023 +0800

Align with spec
---
 java/jakarta/servlet/http/HttpFilter.java | 130 --
 1 file changed, 86 insertions(+), 44 deletions(-)

diff --git a/java/jakarta/servlet/http/HttpFilter.java 
b/java/jakarta/servlet/http/HttpFilter.java
index 4c7154bea6..14d14b35b0 100644
--- a/java/jakarta/servlet/http/HttpFilter.java
+++ b/java/jakarta/servlet/http/HttpFilter.java
@@ -25,63 +25,105 @@ import jakarta.servlet.ServletRequest;
 import jakarta.servlet.ServletResponse;
 
 /**
- * Provides a base class that implements the Filter interface and ensures that 
the Request and Response are of type
- * HttpServletRequest and HttpServletResponse respectively.
+ *
+ * 
+ * Provides an abstract class to be subclassed to create an HTTP filter 
suitable for a Web site. A subclass of
+ * HttpFilter should override
+ * {@link #doFilter(jakarta.servlet.http.HttpServletRequest, 
jakarta.servlet.http.HttpServletResponse, jakarta.servlet.FilterChain) }.
+ * 
+ *
+ * 
+ * Filters typically run on multithreaded servers, so be aware that a filter 
must handle concurrent requests and be
+ * careful to synchronize access to shared resources. Shared resources include 
in-memory data such as instance or class
+ * variables and external objects such as files, database connections, and 
network connections. See the
+ * https://docs.oracle.com/javase/tutorial/essential/concurrency/";> 
Java Tutorial on Multithreaded
+ * Programming for more information on handling multiple threads in a Java 
program.
+ *
+ * @author Various
+ *
+ * @since Servlet 4.0
  */
 public abstract class HttpFilter extends GenericFilter {
 
-private static final long serialVersionUID = 1L;
+private static final long serialVersionUID = 7478463438252262094L;
+
+/**
+ * 
+ * Does nothing, because this is an abstract class.
+ * 
+ *
+ * @since Servlet 4.0
+ */
+public HttpFilter() {
+}
 
 /**
- * {@inheritDoc} This implementation tests the request and response to see 
if they are instances of
- * {@link HttpServletRequest} and {@link HttpServletResponse} 
respectively. If they are then they are passed to
- * {@link #doFilter(HttpServletRequest, HttpServletResponse, 
FilterChain)}. If not, a {@link ServletException} is
- * thrown.
  *
- * @throws ServletException If either the request or response are not of 
the expected types or any other error
- *  occurs
+ * 
+ * The doFilter method of the Filter is called by the 
container each time a request/response pair is passed
+ * through the chain due to a client request for a resource at the end of 
the chain. The FilterChain passed in to this
+ * method allows the Filter to pass on the request and response to the 
next entity in the chain. There's no need to
+ * override this method.
+ * 
+ *
+ * 
+ * The default implementation inspects the incoming {@code req} and {@code 
res} objects to determine if they are
+ * instances of {@link HttpServletRequest} and {@link 
HttpServletResponse}, respectively. If not, a
+ * {@link ServletException} is thrown. Otherwise, the protected
+ * {@link #doFilter(jakarta.servlet.http.HttpServletRequest, 
jakarta.servlet.http.HttpServletResponse, jakarta.servlet.FilterChain)}
+ * method is called.
+ * 
+ *
+ * @param req a {@link ServletRequest} object that contains the request 
the client has made of the filter
+ *
+ * @param res a {@link ServletResponse} object that contains the response 
the filter sends to the client
+ *
+ * @param chain the FilterChain for invoking the next filter 
or the resource
+ *
+ * @throws IOException if an input or output error is detected when the 
filter handles the request
+ *
+ * @throws ServletException if the request for the could not be handled or 
either parameter is not an instance of the
+ * respective {@link HttpServletRequest} or {@link HttpServletResponse}.
+ *
+ * @since Servlet 4.0
  */
 @Override
-public void doFilter(ServletRequest request, ServletResponse response, 
FilterChain chain)
-throws IOException, ServletException {
-if (!(request instanceof HttpServletRequest)) {
-throw new ServletException(request + " not HttpServletRequest");
-}
-if (!(response instanceof HttpServletResponse)) {
-throw new ServletException(request + " not HttpServletResponse");
+public void doFilter(ServletRequest req, ServletResponse res, FilterChain 
chain)
+

[tomcat] branch 9.0.x updated: Align with spec

2023-03-06 Thread lihan
This is an automated email from the ASF dual-hosted git repository.

lihan 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 e6cb59c0a7 Align with spec
e6cb59c0a7 is described below

commit e6cb59c0a730d4a5974f8a2e4c1a02946a1be793
Author: lihan 
AuthorDate: Tue Mar 7 14:16:53 2023 +0800

Align with spec
---
 java/javax/servlet/http/HttpFilter.java | 130 +---
 1 file changed, 86 insertions(+), 44 deletions(-)

diff --git a/java/javax/servlet/http/HttpFilter.java 
b/java/javax/servlet/http/HttpFilter.java
index 40394a6343..f1db79c090 100644
--- a/java/javax/servlet/http/HttpFilter.java
+++ b/java/javax/servlet/http/HttpFilter.java
@@ -25,63 +25,105 @@ import javax.servlet.ServletRequest;
 import javax.servlet.ServletResponse;
 
 /**
- * Provides a base class that implements the Filter interface and ensures that 
the Request and Response are of type
- * HttpServletRequest and HttpServletResponse respectively.
+ *
+ * 
+ * Provides an abstract class to be subclassed to create an HTTP filter 
suitable for a Web site. A subclass of
+ * HttpFilter should override
+ * {@link #doFilter(jakarta.servlet.http.HttpServletRequest, 
jakarta.servlet.http.HttpServletResponse, jakarta.servlet.FilterChain) }.
+ * 
+ *
+ * 
+ * Filters typically run on multithreaded servers, so be aware that a filter 
must handle concurrent requests and be
+ * careful to synchronize access to shared resources. Shared resources include 
in-memory data such as instance or class
+ * variables and external objects such as files, database connections, and 
network connections. See the
+ * https://docs.oracle.com/javase/tutorial/essential/concurrency/";> 
Java Tutorial on Multithreaded
+ * Programming for more information on handling multiple threads in a Java 
program.
+ *
+ * @author Various
+ *
+ * @since Servlet 4.0
  */
 public abstract class HttpFilter extends GenericFilter {
 
-private static final long serialVersionUID = 1L;
+private static final long serialVersionUID = 7478463438252262094L;
+
+/**
+ * 
+ * Does nothing, because this is an abstract class.
+ * 
+ *
+ * @since Servlet 4.0
+ */
+public HttpFilter() {
+}
 
 /**
- * {@inheritDoc} This implementation tests the request and response to see 
if they are instances of
- * {@link HttpServletRequest} and {@link HttpServletResponse} 
respectively. If they are then they are passed to
- * {@link #doFilter(HttpServletRequest, HttpServletResponse, 
FilterChain)}. If not, a {@link ServletException} is
- * thrown.
  *
- * @throws ServletException If either the request or response are not of 
the expected types or any other error
- *  occurs
+ * 
+ * The doFilter method of the Filter is called by the 
container each time a request/response pair is passed
+ * through the chain due to a client request for a resource at the end of 
the chain. The FilterChain passed in to this
+ * method allows the Filter to pass on the request and response to the 
next entity in the chain. There's no need to
+ * override this method.
+ * 
+ *
+ * 
+ * The default implementation inspects the incoming {@code req} and {@code 
res} objects to determine if they are
+ * instances of {@link HttpServletRequest} and {@link 
HttpServletResponse}, respectively. If not, a
+ * {@link ServletException} is thrown. Otherwise, the protected
+ * {@link #doFilter(jakarta.servlet.http.HttpServletRequest, 
jakarta.servlet.http.HttpServletResponse, jakarta.servlet.FilterChain)}
+ * method is called.
+ * 
+ *
+ * @param req a {@link ServletRequest} object that contains the request 
the client has made of the filter
+ *
+ * @param res a {@link ServletResponse} object that contains the response 
the filter sends to the client
+ *
+ * @param chain the FilterChain for invoking the next filter 
or the resource
+ *
+ * @throws IOException if an input or output error is detected when the 
filter handles the request
+ *
+ * @throws ServletException if the request for the could not be handled or 
either parameter is not an instance of the
+ * respective {@link HttpServletRequest} or {@link HttpServletResponse}.
+ *
+ * @since Servlet 4.0
  */
 @Override
-public void doFilter(ServletRequest request, ServletResponse response, 
FilterChain chain)
-throws IOException, ServletException {
-if (!(request instanceof HttpServletRequest)) {
-throw new ServletException(request + " not HttpServletRequest");
-}
-if (!(response instanceof HttpServletResponse)) {
-throw new ServletException(request + " not HttpServletResponse");
+public void doFilter(ServletRequest req, ServletResponse res, FilterChain 
chain)
+throws

[tomcat] branch 9.0.x updated: Fix wrong namespace.

2023-03-06 Thread lihan
This is an automated email from the ASF dual-hosted git repository.

lihan 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 32a7fe4ea4 Fix wrong namespace.
32a7fe4ea4 is described below

commit 32a7fe4ea481b9630ddda9df78f593bb33e57638
Author: lihan 
AuthorDate: Tue Mar 7 14:28:13 2023 +0800

Fix wrong namespace.
---
 java/javax/servlet/http/HttpFilter.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/java/javax/servlet/http/HttpFilter.java 
b/java/javax/servlet/http/HttpFilter.java
index f1db79c090..f9b37eb635 100644
--- a/java/javax/servlet/http/HttpFilter.java
+++ b/java/javax/servlet/http/HttpFilter.java
@@ -29,7 +29,7 @@ import javax.servlet.ServletResponse;
  * 
  * Provides an abstract class to be subclassed to create an HTTP filter 
suitable for a Web site. A subclass of
  * HttpFilter should override
- * {@link #doFilter(jakarta.servlet.http.HttpServletRequest, 
jakarta.servlet.http.HttpServletResponse, jakarta.servlet.FilterChain) }.
+ * {@link #doFilter(javax.servlet.http.HttpServletRequest, 
javax.servlet.http.HttpServletResponse, javax.servlet.FilterChain) }.
  * 
  *
  * 
@@ -70,7 +70,7 @@ public abstract class HttpFilter extends GenericFilter {
  * The default implementation inspects the incoming {@code req} and {@code 
res} objects to determine if they are
  * instances of {@link HttpServletRequest} and {@link 
HttpServletResponse}, respectively. If not, a
  * {@link ServletException} is thrown. Otherwise, the protected
- * {@link #doFilter(jakarta.servlet.http.HttpServletRequest, 
jakarta.servlet.http.HttpServletResponse, jakarta.servlet.FilterChain)}
+ * {@link #doFilter(javax.servlet.http.HttpServletRequest, 
javax.servlet.http.HttpServletResponse, javax.servlet.FilterChain)}
  * method is called.
  * 
  *


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



Re: [tomcat] branch main updated: Align with spec

2023-03-06 Thread Konstantin Kolinko
вт, 7 мар. 2023 г. в 09:17, :
>
> This is an automated email from the ASF dual-hosted git repository.
>
> lihan pushed a commit to branch main
> in repository https://gitbox.apache.org/repos/asf/tomcat.git
>
>
> The following commit(s) were added to refs/heads/main by this push:
>  new 1fc4b7c95d Align with spec
> 1fc4b7c95d is described below
>
> commit 1fc4b7c95dce1db3d86db9393c78023b93725f63
> Author: lihan 
> AuthorDate: Tue Mar 7 14:16:53 2023 +0800
>
> Align with spec

-1 (veto)

Please revert.

The text of the specification comes with a license.

I have not checked recently (with the spec is managed by Eclipse
Foundation), but in earlier times (for specs copyrighted by Oracle) it
was clear that you were not allowed to copy their text as you wish.

You are not the first one to make such changes. There were similar
discussions in earlier years.

Best regards,
Konstantin Kolinko

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



Re: [tomcat] branch main updated: Align with spec

2023-03-06 Thread Han Li


> On Mar 7, 2023, at 14:39, Konstantin Kolinko  wrote:
> 
> вт, 7 мар. 2023 г. в 09:17, mailto:li...@apache.org>>:
>> 
>> This is an automated email from the ASF dual-hosted git repository.
>> 
>> lihan pushed a commit to branch main
>> in repository https://gitbox.apache.org/repos/asf/tomcat.git
>> 
>> 
>> The following commit(s) were added to refs/heads/main by this push:
>> new 1fc4b7c95d Align with spec
>> 1fc4b7c95d is described below
>> 
>> commit 1fc4b7c95dce1db3d86db9393c78023b93725f63
>> Author: lihan 
>> AuthorDate: Tue Mar 7 14:16:53 2023 +0800
>> 
>> Align with spec
> 
> -1 (veto)
> 
> Please revert.
Ok.
> 
> The text of the specification comes with a license.
> 
> I have not checked recently (with the spec is managed by Eclipse
> Foundation), but in earlier times (for specs copyrighted by Oracle) it
> was clear that you were not allowed to copy their text as you wish.
> 
> You are not the first one to make such changes. There were similar
> discussions in earlier years.

I probably understand what means, and I have another question that if I just 
align code with spec there’s no problem, right?

Han
> 
> Best regards,
> Konstantin Kolinko
> 
> -
> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org 
> 
> For additional commands, e-mail: dev-h...@tomcat.apache.org 
> 


[tomcat] branch main updated: Revert "Align with spec"

2023-03-06 Thread lihan
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/main by this push:
 new e020b669a5 Revert "Align with spec"
e020b669a5 is described below

commit e020b669a5792a64c79eedb75751907aee2aa4d3
Author: lihan 
AuthorDate: Tue Mar 7 15:18:10 2023 +0800

Revert "Align with spec"

This reverts commit 1fc4b7c95dce1db3d86db9393c78023b93725f63.
---
 java/jakarta/servlet/http/HttpFilter.java | 130 ++
 1 file changed, 44 insertions(+), 86 deletions(-)

diff --git a/java/jakarta/servlet/http/HttpFilter.java 
b/java/jakarta/servlet/http/HttpFilter.java
index 14d14b35b0..4c7154bea6 100644
--- a/java/jakarta/servlet/http/HttpFilter.java
+++ b/java/jakarta/servlet/http/HttpFilter.java
@@ -25,105 +25,63 @@ import jakarta.servlet.ServletRequest;
 import jakarta.servlet.ServletResponse;
 
 /**
- *
- * 
- * Provides an abstract class to be subclassed to create an HTTP filter 
suitable for a Web site. A subclass of
- * HttpFilter should override
- * {@link #doFilter(jakarta.servlet.http.HttpServletRequest, 
jakarta.servlet.http.HttpServletResponse, jakarta.servlet.FilterChain) }.
- * 
- *
- * 
- * Filters typically run on multithreaded servers, so be aware that a filter 
must handle concurrent requests and be
- * careful to synchronize access to shared resources. Shared resources include 
in-memory data such as instance or class
- * variables and external objects such as files, database connections, and 
network connections. See the
- * https://docs.oracle.com/javase/tutorial/essential/concurrency/";> 
Java Tutorial on Multithreaded
- * Programming for more information on handling multiple threads in a Java 
program.
- *
- * @author Various
- *
- * @since Servlet 4.0
+ * Provides a base class that implements the Filter interface and ensures that 
the Request and Response are of type
+ * HttpServletRequest and HttpServletResponse respectively.
  */
 public abstract class HttpFilter extends GenericFilter {
 
-private static final long serialVersionUID = 7478463438252262094L;
-
-/**
- * 
- * Does nothing, because this is an abstract class.
- * 
- *
- * @since Servlet 4.0
- */
-public HttpFilter() {
-}
+private static final long serialVersionUID = 1L;
 
 /**
+ * {@inheritDoc} This implementation tests the request and response to see 
if they are instances of
+ * {@link HttpServletRequest} and {@link HttpServletResponse} 
respectively. If they are then they are passed to
+ * {@link #doFilter(HttpServletRequest, HttpServletResponse, 
FilterChain)}. If not, a {@link ServletException} is
+ * thrown.
  *
- * 
- * The doFilter method of the Filter is called by the 
container each time a request/response pair is passed
- * through the chain due to a client request for a resource at the end of 
the chain. The FilterChain passed in to this
- * method allows the Filter to pass on the request and response to the 
next entity in the chain. There's no need to
- * override this method.
- * 
- *
- * 
- * The default implementation inspects the incoming {@code req} and {@code 
res} objects to determine if they are
- * instances of {@link HttpServletRequest} and {@link 
HttpServletResponse}, respectively. If not, a
- * {@link ServletException} is thrown. Otherwise, the protected
- * {@link #doFilter(jakarta.servlet.http.HttpServletRequest, 
jakarta.servlet.http.HttpServletResponse, jakarta.servlet.FilterChain)}
- * method is called.
- * 
- *
- * @param req a {@link ServletRequest} object that contains the request 
the client has made of the filter
- *
- * @param res a {@link ServletResponse} object that contains the response 
the filter sends to the client
- *
- * @param chain the FilterChain for invoking the next filter 
or the resource
- *
- * @throws IOException if an input or output error is detected when the 
filter handles the request
- *
- * @throws ServletException if the request for the could not be handled or 
either parameter is not an instance of the
- * respective {@link HttpServletRequest} or {@link HttpServletResponse}.
- *
- * @since Servlet 4.0
+ * @throws ServletException If either the request or response are not of 
the expected types or any other error
+ *  occurs
  */
 @Override
-public void doFilter(ServletRequest req, ServletResponse res, FilterChain 
chain)
-throws IOException, ServletException {
-if (!(req instanceof HttpServletRequest && res instanceof 
HttpServletResponse)) {
-throw new ServletException("non-HTTP request or response");
+public void doFilter(ServletRequest request, ServletResponse response, 
FilterChain chain)
+throws IOException, Servle

[tomcat] branch 10.1.x updated: Revert "Align with spec"

2023-03-06 Thread lihan
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/10.1.x by this push:
 new 7e7f1f98e7 Revert "Align with spec"
7e7f1f98e7 is described below

commit 7e7f1f98e7d5717feaa2dae169d34374cb3cea53
Author: lihan 
AuthorDate: Tue Mar 7 15:20:13 2023 +0800

Revert "Align with spec"

This reverts commit 5f0a1b92f685b86c00ce6ca18b779b42e562f517.
---
 java/jakarta/servlet/http/HttpFilter.java | 130 ++
 1 file changed, 44 insertions(+), 86 deletions(-)

diff --git a/java/jakarta/servlet/http/HttpFilter.java 
b/java/jakarta/servlet/http/HttpFilter.java
index 14d14b35b0..4c7154bea6 100644
--- a/java/jakarta/servlet/http/HttpFilter.java
+++ b/java/jakarta/servlet/http/HttpFilter.java
@@ -25,105 +25,63 @@ import jakarta.servlet.ServletRequest;
 import jakarta.servlet.ServletResponse;
 
 /**
- *
- * 
- * Provides an abstract class to be subclassed to create an HTTP filter 
suitable for a Web site. A subclass of
- * HttpFilter should override
- * {@link #doFilter(jakarta.servlet.http.HttpServletRequest, 
jakarta.servlet.http.HttpServletResponse, jakarta.servlet.FilterChain) }.
- * 
- *
- * 
- * Filters typically run on multithreaded servers, so be aware that a filter 
must handle concurrent requests and be
- * careful to synchronize access to shared resources. Shared resources include 
in-memory data such as instance or class
- * variables and external objects such as files, database connections, and 
network connections. See the
- * https://docs.oracle.com/javase/tutorial/essential/concurrency/";> 
Java Tutorial on Multithreaded
- * Programming for more information on handling multiple threads in a Java 
program.
- *
- * @author Various
- *
- * @since Servlet 4.0
+ * Provides a base class that implements the Filter interface and ensures that 
the Request and Response are of type
+ * HttpServletRequest and HttpServletResponse respectively.
  */
 public abstract class HttpFilter extends GenericFilter {
 
-private static final long serialVersionUID = 7478463438252262094L;
-
-/**
- * 
- * Does nothing, because this is an abstract class.
- * 
- *
- * @since Servlet 4.0
- */
-public HttpFilter() {
-}
+private static final long serialVersionUID = 1L;
 
 /**
+ * {@inheritDoc} This implementation tests the request and response to see 
if they are instances of
+ * {@link HttpServletRequest} and {@link HttpServletResponse} 
respectively. If they are then they are passed to
+ * {@link #doFilter(HttpServletRequest, HttpServletResponse, 
FilterChain)}. If not, a {@link ServletException} is
+ * thrown.
  *
- * 
- * The doFilter method of the Filter is called by the 
container each time a request/response pair is passed
- * through the chain due to a client request for a resource at the end of 
the chain. The FilterChain passed in to this
- * method allows the Filter to pass on the request and response to the 
next entity in the chain. There's no need to
- * override this method.
- * 
- *
- * 
- * The default implementation inspects the incoming {@code req} and {@code 
res} objects to determine if they are
- * instances of {@link HttpServletRequest} and {@link 
HttpServletResponse}, respectively. If not, a
- * {@link ServletException} is thrown. Otherwise, the protected
- * {@link #doFilter(jakarta.servlet.http.HttpServletRequest, 
jakarta.servlet.http.HttpServletResponse, jakarta.servlet.FilterChain)}
- * method is called.
- * 
- *
- * @param req a {@link ServletRequest} object that contains the request 
the client has made of the filter
- *
- * @param res a {@link ServletResponse} object that contains the response 
the filter sends to the client
- *
- * @param chain the FilterChain for invoking the next filter 
or the resource
- *
- * @throws IOException if an input or output error is detected when the 
filter handles the request
- *
- * @throws ServletException if the request for the could not be handled or 
either parameter is not an instance of the
- * respective {@link HttpServletRequest} or {@link HttpServletResponse}.
- *
- * @since Servlet 4.0
+ * @throws ServletException If either the request or response are not of 
the expected types or any other error
+ *  occurs
  */
 @Override
-public void doFilter(ServletRequest req, ServletResponse res, FilterChain 
chain)
-throws IOException, ServletException {
-if (!(req instanceof HttpServletRequest && res instanceof 
HttpServletResponse)) {
-throw new ServletException("non-HTTP request or response");
+public void doFilter(ServletRequest request, ServletResponse response, 
FilterChain chain)
+throws IOException, Se

[tomcat] branch 9.0.x updated: Revert "Align with spec"

2023-03-06 Thread lihan
This is an automated email from the ASF dual-hosted git repository.

lihan 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 1f81fd0367 Revert "Align with spec"
1f81fd0367 is described below

commit 1f81fd0367cd2a304873d5290e54dfbd2be447e7
Author: lihan 
AuthorDate: Tue Mar 7 15:22:39 2023 +0800

Revert "Align with spec"

This reverts commit e6cb59c0
---
 java/javax/servlet/http/HttpFilter.java | 130 +++-
 1 file changed, 44 insertions(+), 86 deletions(-)

diff --git a/java/javax/servlet/http/HttpFilter.java 
b/java/javax/servlet/http/HttpFilter.java
index f9b37eb635..40394a6343 100644
--- a/java/javax/servlet/http/HttpFilter.java
+++ b/java/javax/servlet/http/HttpFilter.java
@@ -25,105 +25,63 @@ import javax.servlet.ServletRequest;
 import javax.servlet.ServletResponse;
 
 /**
- *
- * 
- * Provides an abstract class to be subclassed to create an HTTP filter 
suitable for a Web site. A subclass of
- * HttpFilter should override
- * {@link #doFilter(javax.servlet.http.HttpServletRequest, 
javax.servlet.http.HttpServletResponse, javax.servlet.FilterChain) }.
- * 
- *
- * 
- * Filters typically run on multithreaded servers, so be aware that a filter 
must handle concurrent requests and be
- * careful to synchronize access to shared resources. Shared resources include 
in-memory data such as instance or class
- * variables and external objects such as files, database connections, and 
network connections. See the
- * https://docs.oracle.com/javase/tutorial/essential/concurrency/";> 
Java Tutorial on Multithreaded
- * Programming for more information on handling multiple threads in a Java 
program.
- *
- * @author Various
- *
- * @since Servlet 4.0
+ * Provides a base class that implements the Filter interface and ensures that 
the Request and Response are of type
+ * HttpServletRequest and HttpServletResponse respectively.
  */
 public abstract class HttpFilter extends GenericFilter {
 
-private static final long serialVersionUID = 7478463438252262094L;
-
-/**
- * 
- * Does nothing, because this is an abstract class.
- * 
- *
- * @since Servlet 4.0
- */
-public HttpFilter() {
-}
+private static final long serialVersionUID = 1L;
 
 /**
+ * {@inheritDoc} This implementation tests the request and response to see 
if they are instances of
+ * {@link HttpServletRequest} and {@link HttpServletResponse} 
respectively. If they are then they are passed to
+ * {@link #doFilter(HttpServletRequest, HttpServletResponse, 
FilterChain)}. If not, a {@link ServletException} is
+ * thrown.
  *
- * 
- * The doFilter method of the Filter is called by the 
container each time a request/response pair is passed
- * through the chain due to a client request for a resource at the end of 
the chain. The FilterChain passed in to this
- * method allows the Filter to pass on the request and response to the 
next entity in the chain. There's no need to
- * override this method.
- * 
- *
- * 
- * The default implementation inspects the incoming {@code req} and {@code 
res} objects to determine if they are
- * instances of {@link HttpServletRequest} and {@link 
HttpServletResponse}, respectively. If not, a
- * {@link ServletException} is thrown. Otherwise, the protected
- * {@link #doFilter(javax.servlet.http.HttpServletRequest, 
javax.servlet.http.HttpServletResponse, javax.servlet.FilterChain)}
- * method is called.
- * 
- *
- * @param req a {@link ServletRequest} object that contains the request 
the client has made of the filter
- *
- * @param res a {@link ServletResponse} object that contains the response 
the filter sends to the client
- *
- * @param chain the FilterChain for invoking the next filter 
or the resource
- *
- * @throws IOException if an input or output error is detected when the 
filter handles the request
- *
- * @throws ServletException if the request for the could not be handled or 
either parameter is not an instance of the
- * respective {@link HttpServletRequest} or {@link HttpServletResponse}.
- *
- * @since Servlet 4.0
+ * @throws ServletException If either the request or response are not of 
the expected types or any other error
+ *  occurs
  */
 @Override
-public void doFilter(ServletRequest req, ServletResponse res, FilterChain 
chain)
-throws IOException, ServletException {
-if (!(req instanceof HttpServletRequest && res instanceof 
HttpServletResponse)) {
-throw new ServletException("non-HTTP request or response");
+public void doFilter(ServletRequest request, ServletResponse response, 
FilterChain chain)
+throws IOException, ServletException {
+if (!(request instanceof HttpServ

Re: tomcat-native v2.0+ breaks unix domain socket support on java16-

2023-03-06 Thread Rémy Maucherat
On Tue, Mar 7, 2023 at 12:01 AM Graham Leggett  wrote:
>
> Hi all,
>
> A while back I added unix domain socket support to tomcat-native, and patched 
> tomcat to use it until java16 is available.
>
> Unfortunately unix domain socket support was removed from tomcat-native 2.0+, 
> and now tomcat-native 2.0+ is appearing in distros, meaning that unix domain 
> socket support just broke.
>
> https://tomcat.apache.org/native-doc/miscellaneous/changelog.html
>
> "Remove all API methods (and supporting code) that are not used by Tomcat 
> 10.1.x to support the use of OpenSSL as a replacement for JSSE to provide TLS 
> functionality. (markt)”
>
> Is there a way to fix this, or has tomcat just broken everything for anyone 
> in a RHEL environment?

With tomcat-native 2.0, support for the whole APR connector is
removed. So this also includes domain sockets since it is part of the
APR connector. tomcat-native 2.0 now only does OpenSSL for NIO and
NIO2.

If distros are updating existing branches to tomcat-native 2.0, well,
then they should not. 1.x is still supported.

Rémy

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



Re: [tomcat] branch main updated: Align with spec

2023-03-06 Thread Rémy Maucherat
On Tue, Mar 7, 2023 at 8:14 AM Han Li  wrote:
>
>
>
> > On Mar 7, 2023, at 14:39, Konstantin Kolinko  wrote:
> >
> > вт, 7 мар. 2023 г. в 09:17, mailto:li...@apache.org>>:
> >>
> >> This is an automated email from the ASF dual-hosted git repository.
> >>
> >> lihan pushed a commit to branch main
> >> in repository https://gitbox.apache.org/repos/asf/tomcat.git
> >>
> >>
> >> The following commit(s) were added to refs/heads/main by this push:
> >> new 1fc4b7c95d Align with spec
> >> 1fc4b7c95d is described below
> >>
> >> commit 1fc4b7c95dce1db3d86db9393c78023b93725f63
> >> Author: lihan 
> >> AuthorDate: Tue Mar 7 14:16:53 2023 +0800
> >>
> >> Align with spec
> >
> > -1 (veto)
> >
> > Please revert.
> Ok.
> >
> > The text of the specification comes with a license.
> >
> > I have not checked recently (with the spec is managed by Eclipse
> > Foundation), but in earlier times (for specs copyrighted by Oracle) it
> > was clear that you were not allowed to copy their text as you wish.
> >
> > You are not the first one to make such changes. There were similar
> > discussions in earlier years.
>
> I probably understand what means, and I have another question that if I just 
> align code with spec there’s no problem, right?

No problem (obviously).

Rémy

> Han
> >
> > Best regards,
> > Konstantin Kolinko
> >
> > -
> > To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org 
> > 
> > For additional commands, e-mail: dev-h...@tomcat.apache.org 
> > 

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



Re: [tomcat] branch main updated: Align with spec

2023-03-06 Thread Han Li



> On Mar 7, 2023, at 15:51, Rémy Maucherat  wrote:
> 
> On Tue, Mar 7, 2023 at 8:14 AM Han Li  wrote:
>> 
>> 
>> 
>>> On Mar 7, 2023, at 14:39, Konstantin Kolinko  wrote:
>>> 
>>> вт, 7 мар. 2023 г. в 09:17, mailto:li...@apache.org>>:
 
 This is an automated email from the ASF dual-hosted git repository.
 
 lihan pushed a commit to branch main
 in repository https://gitbox.apache.org/repos/asf/tomcat.git
 
 
 The following commit(s) were added to refs/heads/main by this push:
 new 1fc4b7c95d Align with spec
 1fc4b7c95d is described below
 
 commit 1fc4b7c95dce1db3d86db9393c78023b93725f63
 Author: lihan 
 AuthorDate: Tue Mar 7 14:16:53 2023 +0800
 
 Align with spec
>>> 
>>> -1 (veto)
>>> 
>>> Please revert.
>> Ok.
>>> 
>>> The text of the specification comes with a license.
>>> 
>>> I have not checked recently (with the spec is managed by Eclipse
>>> Foundation), but in earlier times (for specs copyrighted by Oracle) it
>>> was clear that you were not allowed to copy their text as you wish.
>>> 
>>> You are not the first one to make such changes. There were similar
>>> discussions in earlier years.
>> 
>> I probably understand what means, and I have another question that if I just 
>> align code with spec there’s no problem, right?
> 
> No problem (obviously).

Ok, Thanks!

Han
> 
> Rémy
> 
>> Han
>>> 
>>> Best regards,
>>> Konstantin Kolinko
>>> 
>>> -
>>> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org 
>>> 
>>> For additional commands, e-mail: dev-h...@tomcat.apache.org 
>>> 
> 
> -
> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: dev-h...@tomcat.apache.org
> 


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



Re: [tomcat] branch main updated: Align with spec

2023-03-06 Thread Konstantin Kolinko
вт, 7 мар. 2023 г. в 10:14, Han Li :
>
>
>
> > On Mar 7, 2023, at 14:39, Konstantin Kolinko  wrote:
> >
> > вт, 7 мар. 2023 г. в 09:17, mailto:li...@apache.org>>:
> >>
> >> This is an automated email from the ASF dual-hosted git repository.
> >>
> >> lihan pushed a commit to branch main
> >> in repository https://gitbox.apache.org/repos/asf/tomcat.git
> >>
> >>
> >> The following commit(s) were added to refs/heads/main by this push:
> >> new 1fc4b7c95d Align with spec
> >> 1fc4b7c95d is described below
> >>
> >> commit 1fc4b7c95dce1db3d86db9393c78023b93725f63
> >> Author: lihan 
> >> AuthorDate: Tue Mar 7 14:16:53 2023 +0800
> >>
> >> Align with spec
> >
> > -1 (veto)
> >
> > Please revert.
> Ok.
> >
> > The text of the specification comes with a license.
> >
> > I have not checked recently (with the spec is managed by Eclipse
> > Foundation), but in earlier times (for specs copyrighted by Oracle) it
> > was clear that you were not allowed to copy their text as you wish.
> >
> > You are not the first one to make such changes. There were similar
> > discussions in earlier years.
>
> I probably understand what means, and I have another question that if I just 
> align code with spec there’s no problem, right?
>

Regarding javadoc,
I think it is OK to document what Tomcat does. (What it has to do is
dictated by the spec, but what it actually does is our implementation
details, and can be documented).

Regarding code,
If you are talking about alignment of method signatures,  those should
already have been aligned.  I know that the TCK (i.e. the set of tests
that comes with specification) has tests that check signatures of all
methods. As Tomcat was tested with TCK some time ago, I think those
methods have already been tested.

If you are talking about alignment of implementation details,
there is no reason to do so,

The specification is just a document (pdf) plus javadoc (and method
signatures documented there), and a set of tests (TCK). If you are
looking at the code that comes with the spec, that code is just a
"reference implementation", serves as an example and does not define
any required behaviour.

If there is a bug, i.e. behaviour of Tomcat differs with that is
dictated by official javadoc, it is a bug, and should be fixed as
such.


Best regards,
Konstantin Kolinko

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