[GitHub] [tomcat] kamnani opened a new pull request #350: Optimize Resource Lookup Logic using bloom Filter

2020-09-01 Thread GitBox


kamnani opened a new pull request #350:
URL: https://github.com/apache/tomcat/pull/350


   Bloom Filter : 
https://llimllib.github.io/bloomfilter-tutorial/#:~:text=A%20Bloom%20filter%20is%20a,may%20be%20in%20the%20set.
   
   This code enables a faster lookup of resources in the jar by eliminating the 
time needed to search for a resource in a Jar, where it is not going to be 
present. The Flag can be set at Host Level Configuration.
Example : 
   ```
   



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

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



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



Re: security.txt

2020-09-01 Thread Coty Sutherland
On Tue, Sep 1, 2020 at 1:01 PM Christopher Schultz <
ch...@christopherschultz.net> wrote:

> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA256
>
> All,
>
> I'd like to propose that we publish a security.txt[1] file on our web
> site under /.well-known/security.txt and /security.txt
>
> This file contains information we all already know, but it's in
> obviously "proprietary" locations on our web site and might not easily
> be found by someone who maybe doesn't speak English, etc.
>
> Here's my proposed content:
>
> Contact: secur...@tomcat.apache.org
> Contact:
> https://tomcat.apache.org/security.html#Reporting_New_Security_Problems_
> with_Apache_Tomcat
> Acknowledgments: https://tomcat.apache.org/security.html
> Preferred-Languages: en
> Canonical: https://tomcat.apache.org/.well-known/security.txt
> Hiring: https://tomcat.apache.org/getinvolved.html
>
> If there are no objections, I'll add it to the site repo, soon.
>

+1 :D


> What's the best way to make sure that the same file ends up in
> /.well-known/security.txt and /security.txt? Can git link them
> together or something like that?
>

I'd guess a rewrite rule like Mark suggested.


> - -chris
>
> [1] https://securitytxt.org/
> -BEGIN PGP SIGNATURE-
> Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/
>
> iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAl9OflcACgkQHPApP6U8
> pFhy7g//bvd5hO/QTg+HJyJ1pRY4DCZUtssratL9iwoXNWmRz5toO6XM+Hj3Bh0U
> 4VOV5pMl+dN6DhSvuUSDXumnkF6RFMPYFjs15TvC5BaMbt7jlwfNtez7ByrVimOm
> BX9KLsXHgjE04Z4nnqp0S+bXdig5bBTtDLPH9woQOOJfx+4LFyPPUMBaKVzxIh2h
> 3VAv1vkUCmwfqzY5jJKxERQBzhYwBzuxOe1dL+qtXZGs6R8++OltX5GH1qYks8PR
> 28A8SDp+YWrMEEMkv0vUIle3lmEpzEa3+hujFHhMjxPM3q80d9r1XR7B+T3SodEo
> 1udOfBMRG6MGU9OiFD+s8vYgVt2BBBSCTzoeuNQkkf2kbzpeFYChjv7mM4ghBSyy
> 6y8Cz5O8HHQwroaxrkbhf1iIlNDdV0zQ+vd1C3EmhiZosD/bWhIL9q0RFzkY5QIY
> d4U2AN2Q6r9Wd12jS7ELjKy2q/BshJktEjdHs0HQUvYP26zOK9AVtH/ojFLmfXf8
> E+8TxLX2Wr3e6VyaGOJayeofSeeWEs0a4kxzfTB1ChQ/tG/SBJACCYS12cCq1XIn
> nKzkNm1ftbNDgH2IxSfvAPl1m9SzoSO3RJwibrV1bwstahtbvgALHP5raGzZ8Mxo
> +piQmPr1YKwxcvQWE3X/aZOv2YryjnbXKCdHixieZu+rU4f7j6M=
> =qHDh
> -END PGP SIGNATURE-
>
> -
> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: dev-h...@tomcat.apache.org
>
>


[GitHub] [tomcat] kamnani closed pull request #348: Optimize server startup time using Bloom Filter

2020-09-01 Thread GitBox


kamnani closed pull request #348:
URL: https://github.com/apache/tomcat/pull/348


   



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

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



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



Re: security.txt

2020-09-01 Thread Raymond Auge
On Tue, Sep 1, 2020 at 2:38 PM Mark Thomas  wrote:

> On 01/09/2020 18:01, Christopher Schultz wrote:
> > All,
> >
> > I'd like to propose that we publish a security.txt[1] file on our web
> > site under /.well-known/security.txt and /security.txt
> >
> > This file contains information we all already know, but it's in
> > obviously "proprietary" locations on our web site and might not easily
> > be found by someone who maybe doesn't speak English, etc.
> >
> > Here's my proposed content:
> >
> > Contact: secur...@tomcat.apache.org
> > Contact:
> > https://tomcat.apache.org/security.html#Reporting_New_Security_Problems_
> > with_Apache_Tomcat
> > Acknowledgments: https://tomcat.apache.org/security.html
> > Preferred-Languages: en
> > Canonical: https://tomcat.apache.org/.well-known/security.txt
> > Hiring: https://tomcat.apache.org/getinvolved.html
> >
> > If there are no objections, I'll add it to the site repo, soon.
>
> +1
>
> > What's the best way to make sure that the same file ends up in
> > /.well-known/security.txt and /security.txt? Can git link them
> > together or something like that?
>
> The site is in svn.
>
> A rewrite rule?
>

As in https://svn.apache.org/repos/asf/tomcat/site/trunk/xdocs/.htaccess

- Ray


>
> Mark
>
> >
> > -chris
> >
> > [1] https://securitytxt.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
>
>

-- 
*Raymond Augé* 
 (@rotty3000)
Senior Software Architect *Liferay, Inc.* 
 (@Liferay)


[jira] [Commented] (MTOMCAT-294) Maven goal of tomcat8:run fails if Java runtime is installed in path containing spaces

2020-09-01 Thread Charles Nice (Jira)


[ 
https://issues.apache.org/jira/browse/MTOMCAT-294?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17188770#comment-17188770
 ] 

Charles Nice commented on MTOMCAT-294:
--

I cannot find the fixed version for this. The alfresco repo has this but 
broken. I really liked the version 7 one, but I need to upgrade.

Where can I get a copy, or will I will I have to build it?

 

best regards,

-C

> Maven goal of tomcat8:run fails if Java runtime is installed in path 
> containing spaces
> --
>
> Key: MTOMCAT-294
> URL: https://issues.apache.org/jira/browse/MTOMCAT-294
> Project: Apache Tomcat Maven Plugin
>  Issue Type: Bug
>Affects Versions: 3.0
> Environment: Windows 8
>Reporter: Sebastian Kempken
>Priority: Major
> Attachments: MTOMCAT-294-stacktrace.txt
>
>
> When invoking the tomcat8:run goal on a Java web project, the execution fails 
> if the Java runtime is installed in a path containing spaces (see attached 
> stacktrace).
> This affects the as-yet unreleased Maven Tomcat 8 plugin (tc8.x branch).



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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



Re: security.txt

2020-09-01 Thread Mark Thomas
On 01/09/2020 18:01, Christopher Schultz wrote:
> All,
> 
> I'd like to propose that we publish a security.txt[1] file on our web
> site under /.well-known/security.txt and /security.txt
> 
> This file contains information we all already know, but it's in
> obviously "proprietary" locations on our web site and might not easily
> be found by someone who maybe doesn't speak English, etc.
> 
> Here's my proposed content:
> 
> Contact: secur...@tomcat.apache.org
> Contact:
> https://tomcat.apache.org/security.html#Reporting_New_Security_Problems_
> with_Apache_Tomcat
> Acknowledgments: https://tomcat.apache.org/security.html
> Preferred-Languages: en
> Canonical: https://tomcat.apache.org/.well-known/security.txt
> Hiring: https://tomcat.apache.org/getinvolved.html
> 
> If there are no objections, I'll add it to the site repo, soon.

+1

> What's the best way to make sure that the same file ends up in
> /.well-known/security.txt and /security.txt? Can git link them
> together or something like that?

The site is in svn.

A rewrite rule?

Mark

> 
> -chris
> 
> [1] https://securitytxt.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



security.txt

2020-09-01 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

All,

I'd like to propose that we publish a security.txt[1] file on our web
site under /.well-known/security.txt and /security.txt

This file contains information we all already know, but it's in
obviously "proprietary" locations on our web site and might not easily
be found by someone who maybe doesn't speak English, etc.

Here's my proposed content:

Contact: secur...@tomcat.apache.org
Contact:
https://tomcat.apache.org/security.html#Reporting_New_Security_Problems_
with_Apache_Tomcat
Acknowledgments: https://tomcat.apache.org/security.html
Preferred-Languages: en
Canonical: https://tomcat.apache.org/.well-known/security.txt
Hiring: https://tomcat.apache.org/getinvolved.html

If there are no objections, I'll add it to the site repo, soon.

What's the best way to make sure that the same file ends up in
/.well-known/security.txt and /security.txt? Can git link them
together or something like that?

- -chris

[1] https://securitytxt.org/
-BEGIN PGP SIGNATURE-
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAl9OflcACgkQHPApP6U8
pFhy7g//bvd5hO/QTg+HJyJ1pRY4DCZUtssratL9iwoXNWmRz5toO6XM+Hj3Bh0U
4VOV5pMl+dN6DhSvuUSDXumnkF6RFMPYFjs15TvC5BaMbt7jlwfNtez7ByrVimOm
BX9KLsXHgjE04Z4nnqp0S+bXdig5bBTtDLPH9woQOOJfx+4LFyPPUMBaKVzxIh2h
3VAv1vkUCmwfqzY5jJKxERQBzhYwBzuxOe1dL+qtXZGs6R8++OltX5GH1qYks8PR
28A8SDp+YWrMEEMkv0vUIle3lmEpzEa3+hujFHhMjxPM3q80d9r1XR7B+T3SodEo
1udOfBMRG6MGU9OiFD+s8vYgVt2BBBSCTzoeuNQkkf2kbzpeFYChjv7mM4ghBSyy
6y8Cz5O8HHQwroaxrkbhf1iIlNDdV0zQ+vd1C3EmhiZosD/bWhIL9q0RFzkY5QIY
d4U2AN2Q6r9Wd12jS7ELjKy2q/BshJktEjdHs0HQUvYP26zOK9AVtH/ojFLmfXf8
E+8TxLX2Wr3e6VyaGOJayeofSeeWEs0a4kxzfTB1ChQ/tG/SBJACCYS12cCq1XIn
nKzkNm1ftbNDgH2IxSfvAPl1m9SzoSO3RJwibrV1bwstahtbvgALHP5raGzZ8Mxo
+piQmPr1YKwxcvQWE3X/aZOv2YryjnbXKCdHixieZu+rU4f7j6M=
=qHDh
-END PGP SIGNATURE-

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



[tomcat] branch 7.0.x updated: EntityTag.parseEntityTag(): optimize comparison

2020-09-01 Thread markt
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/7.0.x by this push:
 new de55a69  EntityTag.parseEntityTag(): optimize comparison
de55a69 is described below

commit de55a696cdaab6079ae90d2ceeacd93b784e379d
Author: Sergey Ponomarev 
AuthorDate: Wed Aug 12 17:13:44 2020 +0300

EntityTag.parseEntityTag(): optimize comparison

Instead of creating a HashSet we can make in-place matching.
Note that even if first ETag matched we still checking the whole header
for correctness
---
 .../apache/catalina/servlets/DefaultServlet.java   | 53 ++
 .../apache/tomcat/util/http/parser/EntityTag.java  | 32 -
 2 files changed, 46 insertions(+), 39 deletions(-)

diff --git a/java/org/apache/catalina/servlets/DefaultServlet.java 
b/java/org/apache/catalina/servlets/DefaultServlet.java
index 04db1b5..c03303d 100644
--- a/java/org/apache/catalina/servlets/DefaultServlet.java
+++ b/java/org/apache/catalina/servlets/DefaultServlet.java
@@ -35,7 +35,6 @@ import java.security.AccessController;
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.Locale;
-import java.util.Set;
 import java.util.StringTokenizer;
 
 import javax.naming.InitialContext;
@@ -1917,21 +1916,24 @@ public class DefaultServlet extends HttpServlet {
 String headerValue = request.getHeader("If-Match");
 if (headerValue != null) {
 
-boolean conditionSatisfied = false;
+boolean conditionSatisfied;
 
 if (!headerValue.equals("*")) {
 String resourceETag = generateETag(resourceAttributes);
-
-// RFC 7232 requires strong comparison for If-Match headers
-Set headerETags = EntityTag.parseEntityTag(new 
StringReader(headerValue), false);
-if (headerETags == null) {
-if (debug > 10) {
-log("DefaultServlet.checkIfMatch:  Invalid header 
value [" + headerValue + "]");
+if (resourceETag == null) {
+conditionSatisfied = false;
+} else {
+// RFC 7232 requires strong comparison for If-Match headers
+Boolean matched = EntityTag.compareEntityTag(new 
StringReader(headerValue), false, resourceETag);
+if (matched == null) {
+if (debug > 10) {
+log("DefaultServlet.checkIfMatch:  Invalid header 
value [" + headerValue + "]");
+}
+response.sendError(HttpServletResponse.SC_BAD_REQUEST);
+return false;
 }
-response.sendError(HttpServletResponse.SC_BAD_REQUEST);
-return false;
+conditionSatisfied = matched.booleanValue();
 }
-conditionSatisfied = headerETags.contains(resourceETag);
 } else {
 conditionSatisfied = true;
 }
@@ -1998,29 +2000,24 @@ public class DefaultServlet extends HttpServlet {
 String headerValue = request.getHeader("If-None-Match");
 if (headerValue != null) {
 
-boolean conditionSatisfied = false;
+boolean conditionSatisfied;
 
 String resourceETag = generateETag(resourceAttributes);
 if (!headerValue.equals("*")) {
-
-// RFC 7232 requires weak comparison for If-None-Match headers
-// This is done by removing any weak markers before comparison
-String comparisonETag;
-if (resourceETag.startsWith("W/")) {
-comparisonETag = resourceETag.substring(2);
+if (resourceETag == null) {
+conditionSatisfied = false;
 } else {
-comparisonETag = resourceETag;
-}
-
-Set headerETags = EntityTag.parseEntityTag(new 
StringReader(headerValue), true);
-if (headerETags == null) {
-if (debug > 10) {
-log("DefaultServlet.checkIfNoneMatch:  Invalid header 
value [" + headerValue + "]");
+// RFC 7232 requires weak comparison for If-None-Match 
headers
+Boolean matched = EntityTag.compareEntityTag(new 
StringReader(headerValue), true, resourceETag);
+if (matched == null) {
+if (debug > 10) {
+log("DefaultServlet.checkIfNoneMatch:  Invalid 
header value [" + headerValue + "]");
+}
+response.sendError(HttpServletResponse.SC_BAD_REQUEST);
+return false;
 }
-response.sendError(HttpServlet

[tomcat] branch 8.5.x updated: EntityTag.parseEntityTag(): optimize comparison

2020-09-01 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 671c5c4  EntityTag.parseEntityTag(): optimize comparison
671c5c4 is described below

commit 671c5c46c1bf4999392d7dcf2bf662e5e2f81baf
Author: Sergey Ponomarev 
AuthorDate: Wed Aug 12 17:13:44 2020 +0300

EntityTag.parseEntityTag(): optimize comparison

Instead of creating a HashSet we can make in-place matching.
Note that even if first ETag matched we still checking the whole header for 
correctness
---
 .../apache/catalina/servlets/DefaultServlet.java   | 53 ++
 .../apache/tomcat/util/http/parser/EntityTag.java  | 32 -
 2 files changed, 46 insertions(+), 39 deletions(-)

diff --git a/java/org/apache/catalina/servlets/DefaultServlet.java 
b/java/org/apache/catalina/servlets/DefaultServlet.java
index 6785da2..5562bb6 100644
--- a/java/org/apache/catalina/servlets/DefaultServlet.java
+++ b/java/org/apache/catalina/servlets/DefaultServlet.java
@@ -44,7 +44,6 @@ import java.util.Enumeration;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Locale;
-import java.util.Set;
 
 import javax.servlet.DispatcherType;
 import javax.servlet.RequestDispatcher;
@@ -2316,21 +2315,24 @@ public class DefaultServlet extends HttpServlet {
 String headerValue = request.getHeader("If-Match");
 if (headerValue != null) {
 
-boolean conditionSatisfied = false;
+boolean conditionSatisfied;
 
 if (!headerValue.equals("*")) {
 String resourceETag = generateETag(resource);
-
-// RFC 7232 requires strong comparison for If-Match headers
-Set headerETags = EntityTag.parseEntityTag(new 
StringReader(headerValue), false);
-if (headerETags == null) {
-if (debug > 10) {
-log("DefaultServlet.checkIfMatch:  Invalid header 
value [" + headerValue + "]");
+if (resourceETag == null) {
+conditionSatisfied = false;
+} else {
+// RFC 7232 requires strong comparison for If-Match headers
+Boolean matched = EntityTag.compareEntityTag(new 
StringReader(headerValue), false, resourceETag);
+if (matched == null) {
+if (debug > 10) {
+log("DefaultServlet.checkIfMatch:  Invalid header 
value [" + headerValue + "]");
+}
+response.sendError(HttpServletResponse.SC_BAD_REQUEST);
+return false;
 }
-response.sendError(HttpServletResponse.SC_BAD_REQUEST);
-return false;
+conditionSatisfied = matched.booleanValue();
 }
-conditionSatisfied = headerETags.contains(resourceETag);
 } else {
 conditionSatisfied = true;
 }
@@ -2397,29 +2399,24 @@ public class DefaultServlet extends HttpServlet {
 String headerValue = request.getHeader("If-None-Match");
 if (headerValue != null) {
 
-boolean conditionSatisfied = false;
+boolean conditionSatisfied;
 
 String resourceETag = generateETag(resource);
 if (!headerValue.equals("*")) {
-
-// RFC 7232 requires weak comparison for If-None-Match headers
-// This is done by removing any weak markers before comparison
-String comparisonETag;
-if (resourceETag.startsWith("W/")) {
-comparisonETag = resourceETag.substring(2);
+if (resourceETag == null) {
+conditionSatisfied = false;
 } else {
-comparisonETag = resourceETag;
-}
-
-Set headerETags = EntityTag.parseEntityTag(new 
StringReader(headerValue), true);
-if (headerETags == null) {
-if (debug > 10) {
-log("DefaultServlet.checkIfNoneMatch:  Invalid header 
value [" + headerValue + "]");
+// RFC 7232 requires weak comparison for If-None-Match 
headers
+Boolean matched = EntityTag.compareEntityTag(new 
StringReader(headerValue), true, resourceETag);
+if (matched == null) {
+if (debug > 10) {
+log("DefaultServlet.checkIfNoneMatch:  Invalid 
header value [" + headerValue + "]");
+}
+response.sendError(HttpServletResponse.SC_BAD_REQUEST);
+return false;
 }
-response.sendError(HttpServletResponse.SC_BAD_REQUEST);
-   

[tomcat] branch 9.0.x updated: EntityTag.parseEntityTag(): optimize comparison

2020-09-01 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 7e9d514  EntityTag.parseEntityTag(): optimize comparison
7e9d514 is described below

commit 7e9d514a733bfe5ccf43df2899d8f39ab852d3e2
Author: Sergey Ponomarev 
AuthorDate: Wed Aug 12 17:13:44 2020 +0300

EntityTag.parseEntityTag(): optimize comparison

Instead of creating a HashSet we can make in-place matching.
Note that even if first ETag matched we still checking the whole header for 
correctness
---
 .../apache/catalina/servlets/DefaultServlet.java   | 53 ++
 .../apache/tomcat/util/http/parser/EntityTag.java  | 32 -
 2 files changed, 46 insertions(+), 39 deletions(-)

diff --git a/java/org/apache/catalina/servlets/DefaultServlet.java 
b/java/org/apache/catalina/servlets/DefaultServlet.java
index 1392bb9..c3be79b 100644
--- a/java/org/apache/catalina/servlets/DefaultServlet.java
+++ b/java/org/apache/catalina/servlets/DefaultServlet.java
@@ -44,7 +44,6 @@ import java.util.Enumeration;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Locale;
-import java.util.Set;
 
 import javax.servlet.DispatcherType;
 import javax.servlet.RequestDispatcher;
@@ -2237,21 +2236,24 @@ public class DefaultServlet extends HttpServlet {
 String headerValue = request.getHeader("If-Match");
 if (headerValue != null) {
 
-boolean conditionSatisfied = false;
+boolean conditionSatisfied;
 
 if (!headerValue.equals("*")) {
 String resourceETag = generateETag(resource);
-
-// RFC 7232 requires strong comparison for If-Match headers
-Set headerETags = EntityTag.parseEntityTag(new 
StringReader(headerValue), false);
-if (headerETags == null) {
-if (debug > 10) {
-log("DefaultServlet.checkIfMatch:  Invalid header 
value [" + headerValue + "]");
+if (resourceETag == null) {
+conditionSatisfied = false;
+} else {
+// RFC 7232 requires strong comparison for If-Match headers
+Boolean matched = EntityTag.compareEntityTag(new 
StringReader(headerValue), false, resourceETag);
+if (matched == null) {
+if (debug > 10) {
+log("DefaultServlet.checkIfMatch:  Invalid header 
value [" + headerValue + "]");
+}
+response.sendError(HttpServletResponse.SC_BAD_REQUEST);
+return false;
 }
-response.sendError(HttpServletResponse.SC_BAD_REQUEST);
-return false;
+conditionSatisfied = matched.booleanValue();
 }
-conditionSatisfied = headerETags.contains(resourceETag);
 } else {
 conditionSatisfied = true;
 }
@@ -2318,29 +2320,24 @@ public class DefaultServlet extends HttpServlet {
 String headerValue = request.getHeader("If-None-Match");
 if (headerValue != null) {
 
-boolean conditionSatisfied = false;
+boolean conditionSatisfied;
 
 String resourceETag = generateETag(resource);
 if (!headerValue.equals("*")) {
-
-// RFC 7232 requires weak comparison for If-None-Match headers
-// This is done by removing any weak markers before comparison
-String comparisonETag;
-if (resourceETag.startsWith("W/")) {
-comparisonETag = resourceETag.substring(2);
+if (resourceETag == null) {
+conditionSatisfied = false;
 } else {
-comparisonETag = resourceETag;
-}
-
-Set headerETags = EntityTag.parseEntityTag(new 
StringReader(headerValue), true);
-if (headerETags == null) {
-if (debug > 10) {
-log("DefaultServlet.checkIfNoneMatch:  Invalid header 
value [" + headerValue + "]");
+// RFC 7232 requires weak comparison for If-None-Match 
headers
+Boolean matched = EntityTag.compareEntityTag(new 
StringReader(headerValue), true, resourceETag);
+if (matched == null) {
+if (debug > 10) {
+log("DefaultServlet.checkIfNoneMatch:  Invalid 
header value [" + headerValue + "]");
+}
+response.sendError(HttpServletResponse.SC_BAD_REQUEST);
+return false;
 }
-response.sendError(HttpServletResponse.SC_BAD_REQUEST);
-   

[tomcat] branch 8.5.x updated: EntityTag.parseEntityTag(): optimize comparison

2020-09-01 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 671c5c4  EntityTag.parseEntityTag(): optimize comparison
671c5c4 is described below

commit 671c5c46c1bf4999392d7dcf2bf662e5e2f81baf
Author: Sergey Ponomarev 
AuthorDate: Wed Aug 12 17:13:44 2020 +0300

EntityTag.parseEntityTag(): optimize comparison

Instead of creating a HashSet we can make in-place matching.
Note that even if first ETag matched we still checking the whole header for 
correctness
---
 .../apache/catalina/servlets/DefaultServlet.java   | 53 ++
 .../apache/tomcat/util/http/parser/EntityTag.java  | 32 -
 2 files changed, 46 insertions(+), 39 deletions(-)

diff --git a/java/org/apache/catalina/servlets/DefaultServlet.java 
b/java/org/apache/catalina/servlets/DefaultServlet.java
index 6785da2..5562bb6 100644
--- a/java/org/apache/catalina/servlets/DefaultServlet.java
+++ b/java/org/apache/catalina/servlets/DefaultServlet.java
@@ -44,7 +44,6 @@ import java.util.Enumeration;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Locale;
-import java.util.Set;
 
 import javax.servlet.DispatcherType;
 import javax.servlet.RequestDispatcher;
@@ -2316,21 +2315,24 @@ public class DefaultServlet extends HttpServlet {
 String headerValue = request.getHeader("If-Match");
 if (headerValue != null) {
 
-boolean conditionSatisfied = false;
+boolean conditionSatisfied;
 
 if (!headerValue.equals("*")) {
 String resourceETag = generateETag(resource);
-
-// RFC 7232 requires strong comparison for If-Match headers
-Set headerETags = EntityTag.parseEntityTag(new 
StringReader(headerValue), false);
-if (headerETags == null) {
-if (debug > 10) {
-log("DefaultServlet.checkIfMatch:  Invalid header 
value [" + headerValue + "]");
+if (resourceETag == null) {
+conditionSatisfied = false;
+} else {
+// RFC 7232 requires strong comparison for If-Match headers
+Boolean matched = EntityTag.compareEntityTag(new 
StringReader(headerValue), false, resourceETag);
+if (matched == null) {
+if (debug > 10) {
+log("DefaultServlet.checkIfMatch:  Invalid header 
value [" + headerValue + "]");
+}
+response.sendError(HttpServletResponse.SC_BAD_REQUEST);
+return false;
 }
-response.sendError(HttpServletResponse.SC_BAD_REQUEST);
-return false;
+conditionSatisfied = matched.booleanValue();
 }
-conditionSatisfied = headerETags.contains(resourceETag);
 } else {
 conditionSatisfied = true;
 }
@@ -2397,29 +2399,24 @@ public class DefaultServlet extends HttpServlet {
 String headerValue = request.getHeader("If-None-Match");
 if (headerValue != null) {
 
-boolean conditionSatisfied = false;
+boolean conditionSatisfied;
 
 String resourceETag = generateETag(resource);
 if (!headerValue.equals("*")) {
-
-// RFC 7232 requires weak comparison for If-None-Match headers
-// This is done by removing any weak markers before comparison
-String comparisonETag;
-if (resourceETag.startsWith("W/")) {
-comparisonETag = resourceETag.substring(2);
+if (resourceETag == null) {
+conditionSatisfied = false;
 } else {
-comparisonETag = resourceETag;
-}
-
-Set headerETags = EntityTag.parseEntityTag(new 
StringReader(headerValue), true);
-if (headerETags == null) {
-if (debug > 10) {
-log("DefaultServlet.checkIfNoneMatch:  Invalid header 
value [" + headerValue + "]");
+// RFC 7232 requires weak comparison for If-None-Match 
headers
+Boolean matched = EntityTag.compareEntityTag(new 
StringReader(headerValue), true, resourceETag);
+if (matched == null) {
+if (debug > 10) {
+log("DefaultServlet.checkIfNoneMatch:  Invalid 
header value [" + headerValue + "]");
+}
+response.sendError(HttpServletResponse.SC_BAD_REQUEST);
+return false;
 }
-response.sendError(HttpServletResponse.SC_BAD_REQUEST);
-   

[tomcat] branch 9.0.x updated: EntityTag.parseEntityTag(): optimize comparison

2020-09-01 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 7e9d514  EntityTag.parseEntityTag(): optimize comparison
7e9d514 is described below

commit 7e9d514a733bfe5ccf43df2899d8f39ab852d3e2
Author: Sergey Ponomarev 
AuthorDate: Wed Aug 12 17:13:44 2020 +0300

EntityTag.parseEntityTag(): optimize comparison

Instead of creating a HashSet we can make in-place matching.
Note that even if first ETag matched we still checking the whole header for 
correctness
---
 .../apache/catalina/servlets/DefaultServlet.java   | 53 ++
 .../apache/tomcat/util/http/parser/EntityTag.java  | 32 -
 2 files changed, 46 insertions(+), 39 deletions(-)

diff --git a/java/org/apache/catalina/servlets/DefaultServlet.java 
b/java/org/apache/catalina/servlets/DefaultServlet.java
index 1392bb9..c3be79b 100644
--- a/java/org/apache/catalina/servlets/DefaultServlet.java
+++ b/java/org/apache/catalina/servlets/DefaultServlet.java
@@ -44,7 +44,6 @@ import java.util.Enumeration;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Locale;
-import java.util.Set;
 
 import javax.servlet.DispatcherType;
 import javax.servlet.RequestDispatcher;
@@ -2237,21 +2236,24 @@ public class DefaultServlet extends HttpServlet {
 String headerValue = request.getHeader("If-Match");
 if (headerValue != null) {
 
-boolean conditionSatisfied = false;
+boolean conditionSatisfied;
 
 if (!headerValue.equals("*")) {
 String resourceETag = generateETag(resource);
-
-// RFC 7232 requires strong comparison for If-Match headers
-Set headerETags = EntityTag.parseEntityTag(new 
StringReader(headerValue), false);
-if (headerETags == null) {
-if (debug > 10) {
-log("DefaultServlet.checkIfMatch:  Invalid header 
value [" + headerValue + "]");
+if (resourceETag == null) {
+conditionSatisfied = false;
+} else {
+// RFC 7232 requires strong comparison for If-Match headers
+Boolean matched = EntityTag.compareEntityTag(new 
StringReader(headerValue), false, resourceETag);
+if (matched == null) {
+if (debug > 10) {
+log("DefaultServlet.checkIfMatch:  Invalid header 
value [" + headerValue + "]");
+}
+response.sendError(HttpServletResponse.SC_BAD_REQUEST);
+return false;
 }
-response.sendError(HttpServletResponse.SC_BAD_REQUEST);
-return false;
+conditionSatisfied = matched.booleanValue();
 }
-conditionSatisfied = headerETags.contains(resourceETag);
 } else {
 conditionSatisfied = true;
 }
@@ -2318,29 +2320,24 @@ public class DefaultServlet extends HttpServlet {
 String headerValue = request.getHeader("If-None-Match");
 if (headerValue != null) {
 
-boolean conditionSatisfied = false;
+boolean conditionSatisfied;
 
 String resourceETag = generateETag(resource);
 if (!headerValue.equals("*")) {
-
-// RFC 7232 requires weak comparison for If-None-Match headers
-// This is done by removing any weak markers before comparison
-String comparisonETag;
-if (resourceETag.startsWith("W/")) {
-comparisonETag = resourceETag.substring(2);
+if (resourceETag == null) {
+conditionSatisfied = false;
 } else {
-comparisonETag = resourceETag;
-}
-
-Set headerETags = EntityTag.parseEntityTag(new 
StringReader(headerValue), true);
-if (headerETags == null) {
-if (debug > 10) {
-log("DefaultServlet.checkIfNoneMatch:  Invalid header 
value [" + headerValue + "]");
+// RFC 7232 requires weak comparison for If-None-Match 
headers
+Boolean matched = EntityTag.compareEntityTag(new 
StringReader(headerValue), true, resourceETag);
+if (matched == null) {
+if (debug > 10) {
+log("DefaultServlet.checkIfNoneMatch:  Invalid 
header value [" + headerValue + "]");
+}
+response.sendError(HttpServletResponse.SC_BAD_REQUEST);
+return false;
 }
-response.sendError(HttpServletResponse.SC_BAD_REQUEST);
-   

[tomcat] branch 9.0.x updated: EntityTag.parseEntityTag(): optimize comparison

2020-09-01 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 7e9d514  EntityTag.parseEntityTag(): optimize comparison
7e9d514 is described below

commit 7e9d514a733bfe5ccf43df2899d8f39ab852d3e2
Author: Sergey Ponomarev 
AuthorDate: Wed Aug 12 17:13:44 2020 +0300

EntityTag.parseEntityTag(): optimize comparison

Instead of creating a HashSet we can make in-place matching.
Note that even if first ETag matched we still checking the whole header for 
correctness
---
 .../apache/catalina/servlets/DefaultServlet.java   | 53 ++
 .../apache/tomcat/util/http/parser/EntityTag.java  | 32 -
 2 files changed, 46 insertions(+), 39 deletions(-)

diff --git a/java/org/apache/catalina/servlets/DefaultServlet.java 
b/java/org/apache/catalina/servlets/DefaultServlet.java
index 1392bb9..c3be79b 100644
--- a/java/org/apache/catalina/servlets/DefaultServlet.java
+++ b/java/org/apache/catalina/servlets/DefaultServlet.java
@@ -44,7 +44,6 @@ import java.util.Enumeration;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Locale;
-import java.util.Set;
 
 import javax.servlet.DispatcherType;
 import javax.servlet.RequestDispatcher;
@@ -2237,21 +2236,24 @@ public class DefaultServlet extends HttpServlet {
 String headerValue = request.getHeader("If-Match");
 if (headerValue != null) {
 
-boolean conditionSatisfied = false;
+boolean conditionSatisfied;
 
 if (!headerValue.equals("*")) {
 String resourceETag = generateETag(resource);
-
-// RFC 7232 requires strong comparison for If-Match headers
-Set headerETags = EntityTag.parseEntityTag(new 
StringReader(headerValue), false);
-if (headerETags == null) {
-if (debug > 10) {
-log("DefaultServlet.checkIfMatch:  Invalid header 
value [" + headerValue + "]");
+if (resourceETag == null) {
+conditionSatisfied = false;
+} else {
+// RFC 7232 requires strong comparison for If-Match headers
+Boolean matched = EntityTag.compareEntityTag(new 
StringReader(headerValue), false, resourceETag);
+if (matched == null) {
+if (debug > 10) {
+log("DefaultServlet.checkIfMatch:  Invalid header 
value [" + headerValue + "]");
+}
+response.sendError(HttpServletResponse.SC_BAD_REQUEST);
+return false;
 }
-response.sendError(HttpServletResponse.SC_BAD_REQUEST);
-return false;
+conditionSatisfied = matched.booleanValue();
 }
-conditionSatisfied = headerETags.contains(resourceETag);
 } else {
 conditionSatisfied = true;
 }
@@ -2318,29 +2320,24 @@ public class DefaultServlet extends HttpServlet {
 String headerValue = request.getHeader("If-None-Match");
 if (headerValue != null) {
 
-boolean conditionSatisfied = false;
+boolean conditionSatisfied;
 
 String resourceETag = generateETag(resource);
 if (!headerValue.equals("*")) {
-
-// RFC 7232 requires weak comparison for If-None-Match headers
-// This is done by removing any weak markers before comparison
-String comparisonETag;
-if (resourceETag.startsWith("W/")) {
-comparisonETag = resourceETag.substring(2);
+if (resourceETag == null) {
+conditionSatisfied = false;
 } else {
-comparisonETag = resourceETag;
-}
-
-Set headerETags = EntityTag.parseEntityTag(new 
StringReader(headerValue), true);
-if (headerETags == null) {
-if (debug > 10) {
-log("DefaultServlet.checkIfNoneMatch:  Invalid header 
value [" + headerValue + "]");
+// RFC 7232 requires weak comparison for If-None-Match 
headers
+Boolean matched = EntityTag.compareEntityTag(new 
StringReader(headerValue), true, resourceETag);
+if (matched == null) {
+if (debug > 10) {
+log("DefaultServlet.checkIfNoneMatch:  Invalid 
header value [" + headerValue + "]");
+}
+response.sendError(HttpServletResponse.SC_BAD_REQUEST);
+return false;
 }
-response.sendError(HttpServletResponse.SC_BAD_REQUEST);
-   

[tomcat] branch 8.5.x updated: EntityTag.parseEntityTag(): optimize comparison

2020-09-01 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 671c5c4  EntityTag.parseEntityTag(): optimize comparison
671c5c4 is described below

commit 671c5c46c1bf4999392d7dcf2bf662e5e2f81baf
Author: Sergey Ponomarev 
AuthorDate: Wed Aug 12 17:13:44 2020 +0300

EntityTag.parseEntityTag(): optimize comparison

Instead of creating a HashSet we can make in-place matching.
Note that even if first ETag matched we still checking the whole header for 
correctness
---
 .../apache/catalina/servlets/DefaultServlet.java   | 53 ++
 .../apache/tomcat/util/http/parser/EntityTag.java  | 32 -
 2 files changed, 46 insertions(+), 39 deletions(-)

diff --git a/java/org/apache/catalina/servlets/DefaultServlet.java 
b/java/org/apache/catalina/servlets/DefaultServlet.java
index 6785da2..5562bb6 100644
--- a/java/org/apache/catalina/servlets/DefaultServlet.java
+++ b/java/org/apache/catalina/servlets/DefaultServlet.java
@@ -44,7 +44,6 @@ import java.util.Enumeration;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Locale;
-import java.util.Set;
 
 import javax.servlet.DispatcherType;
 import javax.servlet.RequestDispatcher;
@@ -2316,21 +2315,24 @@ public class DefaultServlet extends HttpServlet {
 String headerValue = request.getHeader("If-Match");
 if (headerValue != null) {
 
-boolean conditionSatisfied = false;
+boolean conditionSatisfied;
 
 if (!headerValue.equals("*")) {
 String resourceETag = generateETag(resource);
-
-// RFC 7232 requires strong comparison for If-Match headers
-Set headerETags = EntityTag.parseEntityTag(new 
StringReader(headerValue), false);
-if (headerETags == null) {
-if (debug > 10) {
-log("DefaultServlet.checkIfMatch:  Invalid header 
value [" + headerValue + "]");
+if (resourceETag == null) {
+conditionSatisfied = false;
+} else {
+// RFC 7232 requires strong comparison for If-Match headers
+Boolean matched = EntityTag.compareEntityTag(new 
StringReader(headerValue), false, resourceETag);
+if (matched == null) {
+if (debug > 10) {
+log("DefaultServlet.checkIfMatch:  Invalid header 
value [" + headerValue + "]");
+}
+response.sendError(HttpServletResponse.SC_BAD_REQUEST);
+return false;
 }
-response.sendError(HttpServletResponse.SC_BAD_REQUEST);
-return false;
+conditionSatisfied = matched.booleanValue();
 }
-conditionSatisfied = headerETags.contains(resourceETag);
 } else {
 conditionSatisfied = true;
 }
@@ -2397,29 +2399,24 @@ public class DefaultServlet extends HttpServlet {
 String headerValue = request.getHeader("If-None-Match");
 if (headerValue != null) {
 
-boolean conditionSatisfied = false;
+boolean conditionSatisfied;
 
 String resourceETag = generateETag(resource);
 if (!headerValue.equals("*")) {
-
-// RFC 7232 requires weak comparison for If-None-Match headers
-// This is done by removing any weak markers before comparison
-String comparisonETag;
-if (resourceETag.startsWith("W/")) {
-comparisonETag = resourceETag.substring(2);
+if (resourceETag == null) {
+conditionSatisfied = false;
 } else {
-comparisonETag = resourceETag;
-}
-
-Set headerETags = EntityTag.parseEntityTag(new 
StringReader(headerValue), true);
-if (headerETags == null) {
-if (debug > 10) {
-log("DefaultServlet.checkIfNoneMatch:  Invalid header 
value [" + headerValue + "]");
+// RFC 7232 requires weak comparison for If-None-Match 
headers
+Boolean matched = EntityTag.compareEntityTag(new 
StringReader(headerValue), true, resourceETag);
+if (matched == null) {
+if (debug > 10) {
+log("DefaultServlet.checkIfNoneMatch:  Invalid 
header value [" + headerValue + "]");
+}
+response.sendError(HttpServletResponse.SC_BAD_REQUEST);
+return false;
 }
-response.sendError(HttpServletResponse.SC_BAD_REQUEST);
-   

[tomcat] branch 9.0.x updated: EntityTag.parseEntityTag(): optimize comparison

2020-09-01 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 7e9d514  EntityTag.parseEntityTag(): optimize comparison
7e9d514 is described below

commit 7e9d514a733bfe5ccf43df2899d8f39ab852d3e2
Author: Sergey Ponomarev 
AuthorDate: Wed Aug 12 17:13:44 2020 +0300

EntityTag.parseEntityTag(): optimize comparison

Instead of creating a HashSet we can make in-place matching.
Note that even if first ETag matched we still checking the whole header for 
correctness
---
 .../apache/catalina/servlets/DefaultServlet.java   | 53 ++
 .../apache/tomcat/util/http/parser/EntityTag.java  | 32 -
 2 files changed, 46 insertions(+), 39 deletions(-)

diff --git a/java/org/apache/catalina/servlets/DefaultServlet.java 
b/java/org/apache/catalina/servlets/DefaultServlet.java
index 1392bb9..c3be79b 100644
--- a/java/org/apache/catalina/servlets/DefaultServlet.java
+++ b/java/org/apache/catalina/servlets/DefaultServlet.java
@@ -44,7 +44,6 @@ import java.util.Enumeration;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Locale;
-import java.util.Set;
 
 import javax.servlet.DispatcherType;
 import javax.servlet.RequestDispatcher;
@@ -2237,21 +2236,24 @@ public class DefaultServlet extends HttpServlet {
 String headerValue = request.getHeader("If-Match");
 if (headerValue != null) {
 
-boolean conditionSatisfied = false;
+boolean conditionSatisfied;
 
 if (!headerValue.equals("*")) {
 String resourceETag = generateETag(resource);
-
-// RFC 7232 requires strong comparison for If-Match headers
-Set headerETags = EntityTag.parseEntityTag(new 
StringReader(headerValue), false);
-if (headerETags == null) {
-if (debug > 10) {
-log("DefaultServlet.checkIfMatch:  Invalid header 
value [" + headerValue + "]");
+if (resourceETag == null) {
+conditionSatisfied = false;
+} else {
+// RFC 7232 requires strong comparison for If-Match headers
+Boolean matched = EntityTag.compareEntityTag(new 
StringReader(headerValue), false, resourceETag);
+if (matched == null) {
+if (debug > 10) {
+log("DefaultServlet.checkIfMatch:  Invalid header 
value [" + headerValue + "]");
+}
+response.sendError(HttpServletResponse.SC_BAD_REQUEST);
+return false;
 }
-response.sendError(HttpServletResponse.SC_BAD_REQUEST);
-return false;
+conditionSatisfied = matched.booleanValue();
 }
-conditionSatisfied = headerETags.contains(resourceETag);
 } else {
 conditionSatisfied = true;
 }
@@ -2318,29 +2320,24 @@ public class DefaultServlet extends HttpServlet {
 String headerValue = request.getHeader("If-None-Match");
 if (headerValue != null) {
 
-boolean conditionSatisfied = false;
+boolean conditionSatisfied;
 
 String resourceETag = generateETag(resource);
 if (!headerValue.equals("*")) {
-
-// RFC 7232 requires weak comparison for If-None-Match headers
-// This is done by removing any weak markers before comparison
-String comparisonETag;
-if (resourceETag.startsWith("W/")) {
-comparisonETag = resourceETag.substring(2);
+if (resourceETag == null) {
+conditionSatisfied = false;
 } else {
-comparisonETag = resourceETag;
-}
-
-Set headerETags = EntityTag.parseEntityTag(new 
StringReader(headerValue), true);
-if (headerETags == null) {
-if (debug > 10) {
-log("DefaultServlet.checkIfNoneMatch:  Invalid header 
value [" + headerValue + "]");
+// RFC 7232 requires weak comparison for If-None-Match 
headers
+Boolean matched = EntityTag.compareEntityTag(new 
StringReader(headerValue), true, resourceETag);
+if (matched == null) {
+if (debug > 10) {
+log("DefaultServlet.checkIfNoneMatch:  Invalid 
header value [" + headerValue + "]");
+}
+response.sendError(HttpServletResponse.SC_BAD_REQUEST);
+return false;
 }
-response.sendError(HttpServletResponse.SC_BAD_REQUEST);
-   

[tomcat] branch 8.5.x updated: EntityTag.parseEntityTag(): optimize comparison

2020-09-01 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 671c5c4  EntityTag.parseEntityTag(): optimize comparison
671c5c4 is described below

commit 671c5c46c1bf4999392d7dcf2bf662e5e2f81baf
Author: Sergey Ponomarev 
AuthorDate: Wed Aug 12 17:13:44 2020 +0300

EntityTag.parseEntityTag(): optimize comparison

Instead of creating a HashSet we can make in-place matching.
Note that even if first ETag matched we still checking the whole header for 
correctness
---
 .../apache/catalina/servlets/DefaultServlet.java   | 53 ++
 .../apache/tomcat/util/http/parser/EntityTag.java  | 32 -
 2 files changed, 46 insertions(+), 39 deletions(-)

diff --git a/java/org/apache/catalina/servlets/DefaultServlet.java 
b/java/org/apache/catalina/servlets/DefaultServlet.java
index 6785da2..5562bb6 100644
--- a/java/org/apache/catalina/servlets/DefaultServlet.java
+++ b/java/org/apache/catalina/servlets/DefaultServlet.java
@@ -44,7 +44,6 @@ import java.util.Enumeration;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Locale;
-import java.util.Set;
 
 import javax.servlet.DispatcherType;
 import javax.servlet.RequestDispatcher;
@@ -2316,21 +2315,24 @@ public class DefaultServlet extends HttpServlet {
 String headerValue = request.getHeader("If-Match");
 if (headerValue != null) {
 
-boolean conditionSatisfied = false;
+boolean conditionSatisfied;
 
 if (!headerValue.equals("*")) {
 String resourceETag = generateETag(resource);
-
-// RFC 7232 requires strong comparison for If-Match headers
-Set headerETags = EntityTag.parseEntityTag(new 
StringReader(headerValue), false);
-if (headerETags == null) {
-if (debug > 10) {
-log("DefaultServlet.checkIfMatch:  Invalid header 
value [" + headerValue + "]");
+if (resourceETag == null) {
+conditionSatisfied = false;
+} else {
+// RFC 7232 requires strong comparison for If-Match headers
+Boolean matched = EntityTag.compareEntityTag(new 
StringReader(headerValue), false, resourceETag);
+if (matched == null) {
+if (debug > 10) {
+log("DefaultServlet.checkIfMatch:  Invalid header 
value [" + headerValue + "]");
+}
+response.sendError(HttpServletResponse.SC_BAD_REQUEST);
+return false;
 }
-response.sendError(HttpServletResponse.SC_BAD_REQUEST);
-return false;
+conditionSatisfied = matched.booleanValue();
 }
-conditionSatisfied = headerETags.contains(resourceETag);
 } else {
 conditionSatisfied = true;
 }
@@ -2397,29 +2399,24 @@ public class DefaultServlet extends HttpServlet {
 String headerValue = request.getHeader("If-None-Match");
 if (headerValue != null) {
 
-boolean conditionSatisfied = false;
+boolean conditionSatisfied;
 
 String resourceETag = generateETag(resource);
 if (!headerValue.equals("*")) {
-
-// RFC 7232 requires weak comparison for If-None-Match headers
-// This is done by removing any weak markers before comparison
-String comparisonETag;
-if (resourceETag.startsWith("W/")) {
-comparisonETag = resourceETag.substring(2);
+if (resourceETag == null) {
+conditionSatisfied = false;
 } else {
-comparisonETag = resourceETag;
-}
-
-Set headerETags = EntityTag.parseEntityTag(new 
StringReader(headerValue), true);
-if (headerETags == null) {
-if (debug > 10) {
-log("DefaultServlet.checkIfNoneMatch:  Invalid header 
value [" + headerValue + "]");
+// RFC 7232 requires weak comparison for If-None-Match 
headers
+Boolean matched = EntityTag.compareEntityTag(new 
StringReader(headerValue), true, resourceETag);
+if (matched == null) {
+if (debug > 10) {
+log("DefaultServlet.checkIfNoneMatch:  Invalid 
header value [" + headerValue + "]");
+}
+response.sendError(HttpServletResponse.SC_BAD_REQUEST);
+return false;
 }
-response.sendError(HttpServletResponse.SC_BAD_REQUEST);
-   

[tomcat] branch 9.0.x updated: EntityTag.parseEntityTag(): optimize comparison

2020-09-01 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 7e9d514  EntityTag.parseEntityTag(): optimize comparison
7e9d514 is described below

commit 7e9d514a733bfe5ccf43df2899d8f39ab852d3e2
Author: Sergey Ponomarev 
AuthorDate: Wed Aug 12 17:13:44 2020 +0300

EntityTag.parseEntityTag(): optimize comparison

Instead of creating a HashSet we can make in-place matching.
Note that even if first ETag matched we still checking the whole header for 
correctness
---
 .../apache/catalina/servlets/DefaultServlet.java   | 53 ++
 .../apache/tomcat/util/http/parser/EntityTag.java  | 32 -
 2 files changed, 46 insertions(+), 39 deletions(-)

diff --git a/java/org/apache/catalina/servlets/DefaultServlet.java 
b/java/org/apache/catalina/servlets/DefaultServlet.java
index 1392bb9..c3be79b 100644
--- a/java/org/apache/catalina/servlets/DefaultServlet.java
+++ b/java/org/apache/catalina/servlets/DefaultServlet.java
@@ -44,7 +44,6 @@ import java.util.Enumeration;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Locale;
-import java.util.Set;
 
 import javax.servlet.DispatcherType;
 import javax.servlet.RequestDispatcher;
@@ -2237,21 +2236,24 @@ public class DefaultServlet extends HttpServlet {
 String headerValue = request.getHeader("If-Match");
 if (headerValue != null) {
 
-boolean conditionSatisfied = false;
+boolean conditionSatisfied;
 
 if (!headerValue.equals("*")) {
 String resourceETag = generateETag(resource);
-
-// RFC 7232 requires strong comparison for If-Match headers
-Set headerETags = EntityTag.parseEntityTag(new 
StringReader(headerValue), false);
-if (headerETags == null) {
-if (debug > 10) {
-log("DefaultServlet.checkIfMatch:  Invalid header 
value [" + headerValue + "]");
+if (resourceETag == null) {
+conditionSatisfied = false;
+} else {
+// RFC 7232 requires strong comparison for If-Match headers
+Boolean matched = EntityTag.compareEntityTag(new 
StringReader(headerValue), false, resourceETag);
+if (matched == null) {
+if (debug > 10) {
+log("DefaultServlet.checkIfMatch:  Invalid header 
value [" + headerValue + "]");
+}
+response.sendError(HttpServletResponse.SC_BAD_REQUEST);
+return false;
 }
-response.sendError(HttpServletResponse.SC_BAD_REQUEST);
-return false;
+conditionSatisfied = matched.booleanValue();
 }
-conditionSatisfied = headerETags.contains(resourceETag);
 } else {
 conditionSatisfied = true;
 }
@@ -2318,29 +2320,24 @@ public class DefaultServlet extends HttpServlet {
 String headerValue = request.getHeader("If-None-Match");
 if (headerValue != null) {
 
-boolean conditionSatisfied = false;
+boolean conditionSatisfied;
 
 String resourceETag = generateETag(resource);
 if (!headerValue.equals("*")) {
-
-// RFC 7232 requires weak comparison for If-None-Match headers
-// This is done by removing any weak markers before comparison
-String comparisonETag;
-if (resourceETag.startsWith("W/")) {
-comparisonETag = resourceETag.substring(2);
+if (resourceETag == null) {
+conditionSatisfied = false;
 } else {
-comparisonETag = resourceETag;
-}
-
-Set headerETags = EntityTag.parseEntityTag(new 
StringReader(headerValue), true);
-if (headerETags == null) {
-if (debug > 10) {
-log("DefaultServlet.checkIfNoneMatch:  Invalid header 
value [" + headerValue + "]");
+// RFC 7232 requires weak comparison for If-None-Match 
headers
+Boolean matched = EntityTag.compareEntityTag(new 
StringReader(headerValue), true, resourceETag);
+if (matched == null) {
+if (debug > 10) {
+log("DefaultServlet.checkIfNoneMatch:  Invalid 
header value [" + headerValue + "]");
+}
+response.sendError(HttpServletResponse.SC_BAD_REQUEST);
+return false;
 }
-response.sendError(HttpServletResponse.SC_BAD_REQUEST);
-   

[tomcat] branch 8.5.x updated: EntityTag.parseEntityTag(): optimize comparison

2020-09-01 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 671c5c4  EntityTag.parseEntityTag(): optimize comparison
671c5c4 is described below

commit 671c5c46c1bf4999392d7dcf2bf662e5e2f81baf
Author: Sergey Ponomarev 
AuthorDate: Wed Aug 12 17:13:44 2020 +0300

EntityTag.parseEntityTag(): optimize comparison

Instead of creating a HashSet we can make in-place matching.
Note that even if first ETag matched we still checking the whole header for 
correctness
---
 .../apache/catalina/servlets/DefaultServlet.java   | 53 ++
 .../apache/tomcat/util/http/parser/EntityTag.java  | 32 -
 2 files changed, 46 insertions(+), 39 deletions(-)

diff --git a/java/org/apache/catalina/servlets/DefaultServlet.java 
b/java/org/apache/catalina/servlets/DefaultServlet.java
index 6785da2..5562bb6 100644
--- a/java/org/apache/catalina/servlets/DefaultServlet.java
+++ b/java/org/apache/catalina/servlets/DefaultServlet.java
@@ -44,7 +44,6 @@ import java.util.Enumeration;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Locale;
-import java.util.Set;
 
 import javax.servlet.DispatcherType;
 import javax.servlet.RequestDispatcher;
@@ -2316,21 +2315,24 @@ public class DefaultServlet extends HttpServlet {
 String headerValue = request.getHeader("If-Match");
 if (headerValue != null) {
 
-boolean conditionSatisfied = false;
+boolean conditionSatisfied;
 
 if (!headerValue.equals("*")) {
 String resourceETag = generateETag(resource);
-
-// RFC 7232 requires strong comparison for If-Match headers
-Set headerETags = EntityTag.parseEntityTag(new 
StringReader(headerValue), false);
-if (headerETags == null) {
-if (debug > 10) {
-log("DefaultServlet.checkIfMatch:  Invalid header 
value [" + headerValue + "]");
+if (resourceETag == null) {
+conditionSatisfied = false;
+} else {
+// RFC 7232 requires strong comparison for If-Match headers
+Boolean matched = EntityTag.compareEntityTag(new 
StringReader(headerValue), false, resourceETag);
+if (matched == null) {
+if (debug > 10) {
+log("DefaultServlet.checkIfMatch:  Invalid header 
value [" + headerValue + "]");
+}
+response.sendError(HttpServletResponse.SC_BAD_REQUEST);
+return false;
 }
-response.sendError(HttpServletResponse.SC_BAD_REQUEST);
-return false;
+conditionSatisfied = matched.booleanValue();
 }
-conditionSatisfied = headerETags.contains(resourceETag);
 } else {
 conditionSatisfied = true;
 }
@@ -2397,29 +2399,24 @@ public class DefaultServlet extends HttpServlet {
 String headerValue = request.getHeader("If-None-Match");
 if (headerValue != null) {
 
-boolean conditionSatisfied = false;
+boolean conditionSatisfied;
 
 String resourceETag = generateETag(resource);
 if (!headerValue.equals("*")) {
-
-// RFC 7232 requires weak comparison for If-None-Match headers
-// This is done by removing any weak markers before comparison
-String comparisonETag;
-if (resourceETag.startsWith("W/")) {
-comparisonETag = resourceETag.substring(2);
+if (resourceETag == null) {
+conditionSatisfied = false;
 } else {
-comparisonETag = resourceETag;
-}
-
-Set headerETags = EntityTag.parseEntityTag(new 
StringReader(headerValue), true);
-if (headerETags == null) {
-if (debug > 10) {
-log("DefaultServlet.checkIfNoneMatch:  Invalid header 
value [" + headerValue + "]");
+// RFC 7232 requires weak comparison for If-None-Match 
headers
+Boolean matched = EntityTag.compareEntityTag(new 
StringReader(headerValue), true, resourceETag);
+if (matched == null) {
+if (debug > 10) {
+log("DefaultServlet.checkIfNoneMatch:  Invalid 
header value [" + headerValue + "]");
+}
+response.sendError(HttpServletResponse.SC_BAD_REQUEST);
+return false;
 }
-response.sendError(HttpServletResponse.SC_BAD_REQUEST);
-   

[GitHub] [tomcat] markt-asf commented on pull request #338: Compare entity tag

2020-09-01 Thread GitBox


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


   Thanks. Applied manually so I could tweak some of the Javadoc and code 
comments.



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

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



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



[tomcat] branch master updated: EntityTag.parseEntityTag(): optimize comparison

2020-09-01 Thread markt
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new d1298d5  EntityTag.parseEntityTag(): optimize comparison
d1298d5 is described below

commit d1298d5c7ca788501d20c592c63d10758f86c75a
Author: Sergey Ponomarev 
AuthorDate: Wed Aug 12 17:13:44 2020 +0300

EntityTag.parseEntityTag(): optimize comparison

Instead of creating a HashSet we can make in-place matching.
Note that even if first ETag matched we still checking the whole header for 
correctness
---
 .../apache/catalina/servlets/DefaultServlet.java   | 53 ++
 .../apache/tomcat/util/http/parser/EntityTag.java  | 32 -
 2 files changed, 46 insertions(+), 39 deletions(-)

diff --git a/java/org/apache/catalina/servlets/DefaultServlet.java 
b/java/org/apache/catalina/servlets/DefaultServlet.java
index fac8907..86d77d0 100644
--- a/java/org/apache/catalina/servlets/DefaultServlet.java
+++ b/java/org/apache/catalina/servlets/DefaultServlet.java
@@ -43,7 +43,6 @@ import java.util.Comparator;
 import java.util.Enumeration;
 import java.util.List;
 import java.util.Locale;
-import java.util.Set;
 
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
@@ -2170,21 +2169,24 @@ public class DefaultServlet extends HttpServlet {
 String headerValue = request.getHeader("If-Match");
 if (headerValue != null) {
 
-boolean conditionSatisfied = false;
+boolean conditionSatisfied;
 
 if (!headerValue.equals("*")) {
 String resourceETag = generateETag(resource);
-
-// RFC 7232 requires strong comparison for If-Match headers
-Set headerETags = EntityTag.parseEntityTag(new 
StringReader(headerValue), false);
-if (headerETags == null) {
-if (debug > 10) {
-log("DefaultServlet.checkIfMatch:  Invalid header 
value [" + headerValue + "]");
+if (resourceETag == null) {
+conditionSatisfied = false;
+} else {
+// RFC 7232 requires strong comparison for If-Match headers
+Boolean matched = EntityTag.compareEntityTag(new 
StringReader(headerValue), false, resourceETag);
+if (matched == null) {
+if (debug > 10) {
+log("DefaultServlet.checkIfMatch:  Invalid header 
value [" + headerValue + "]");
+}
+response.sendError(HttpServletResponse.SC_BAD_REQUEST);
+return false;
 }
-response.sendError(HttpServletResponse.SC_BAD_REQUEST);
-return false;
+conditionSatisfied = matched.booleanValue();
 }
-conditionSatisfied = headerETags.contains(resourceETag);
 } else {
 conditionSatisfied = true;
 }
@@ -2251,29 +2253,24 @@ public class DefaultServlet extends HttpServlet {
 String headerValue = request.getHeader("If-None-Match");
 if (headerValue != null) {
 
-boolean conditionSatisfied = false;
+boolean conditionSatisfied;
 
 String resourceETag = generateETag(resource);
 if (!headerValue.equals("*")) {
-
-// RFC 7232 requires weak comparison for If-None-Match headers
-// This is done by removing any weak markers before comparison
-String comparisonETag;
-if (resourceETag.startsWith("W/")) {
-comparisonETag = resourceETag.substring(2);
+if (resourceETag == null) {
+conditionSatisfied = false;
 } else {
-comparisonETag = resourceETag;
-}
-
-Set headerETags = EntityTag.parseEntityTag(new 
StringReader(headerValue), true);
-if (headerETags == null) {
-if (debug > 10) {
-log("DefaultServlet.checkIfNoneMatch:  Invalid header 
value [" + headerValue + "]");
+// RFC 7232 requires weak comparison for If-None-Match 
headers
+Boolean matched = EntityTag.compareEntityTag(new 
StringReader(headerValue), true, resourceETag);
+if (matched == null) {
+if (debug > 10) {
+log("DefaultServlet.checkIfNoneMatch:  Invalid 
header value [" + headerValue + "]");
+}
+response.sendError(HttpServletResponse.SC_BAD_REQUEST);
+return false;
 }
-response.sendError(HttpServletResponse.SC_

[GitHub] [tomcat] markt-asf closed pull request #338: Compare entity tag

2020-09-01 Thread GitBox


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


   



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

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



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



Re: [VOTE] Release Apache Tomcat Native 1.2.25

2020-09-01 Thread Mark Thomas
All,

We only have 2 PMC +1 votes for this release.

Mark


On 21/08/2020 19:22, Mark Thomas wrote:
> Version 1.2.25 includes the following changes compared to 1.2.24
> 
> - Improvements to LibreSSL support
> 
> - Improvements to HP_UX support
> 
> Various other fixes and improvements. See the changelog for details.
> 
> The proposed release artefacts can be found at [1],
> and the build was done using tag [2].
> 
> The Apache Tomcat Native 1.2.25 release is
>  [ ] Stable, go ahead and release
>  [ ] Broken because of ...
> 
> Thanks,
> 
> Mark
> 
> 
> [1]
> https://dist.apache.org/repos/dist/dev/tomcat/tomcat-connectors/native/1.2.25
> [2]
> https://gitbox.apache.org/repos/asf?p=tomcat-native.git;a=commit;h=a94590ec2a5e40b168a9494144125a52f41ed0b2
> 
> -
> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: dev-h...@tomcat.apache.org
> 


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



[tomcat] branch 9.0.x updated: Fix path used by the health check valve

2020-09-01 Thread remm
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/9.0.x by this push:
 new e42ee16  Fix path used by the health check valve
e42ee16 is described below

commit e42ee169dbde36e9a6979f4b4036e3b2a0b1b3b4
Author: remm 
AuthorDate: Tue Sep 1 14:29:58 2020 +0200

Fix path used by the health check valve

When not associated with a Context, it should use the full URI.
---
 .../apache/catalina/valves/HealthCheckValve.java   | 23 --
 webapps/docs/changelog.xml |  4 
 2 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/catalina/valves/HealthCheckValve.java 
b/java/org/apache/catalina/valves/HealthCheckValve.java
index f8227ac..fb4a8e2 100644
--- a/java/org/apache/catalina/valves/HealthCheckValve.java
+++ b/java/org/apache/catalina/valves/HealthCheckValve.java
@@ -20,6 +20,8 @@ import java.io.IOException;
 
 import javax.servlet.ServletException;
 
+import org.apache.catalina.Context;
+import org.apache.catalina.LifecycleException;
 import org.apache.catalina.connector.Request;
 import org.apache.catalina.connector.Response;
 import org.apache.tomcat.util.buf.MessageBytes;
@@ -35,8 +37,14 @@ public class HealthCheckValve extends ValveBase {
 "  \"status\": \"UP\",\n" +
 "  \"checks\": []\n" +
 "}";
+
 private String path = "/health";
 
+/**
+ * Will be set to true if the valve is associated with a context.
+ */
+protected boolean context = false;
+
 public HealthCheckValve() {
 super(true);
 }
@@ -50,10 +58,21 @@ public class HealthCheckValve extends ValveBase {
 }
 
 @Override
+protected synchronized void startInternal() throws LifecycleException {
+super.startInternal();
+if (getContainer() instanceof Context) {
+context = true;
+} else {
+context = false;
+}
+}
+
+@Override
 public void invoke(Request request, Response response)
 throws IOException, ServletException {
-MessageBytes requestPathMB = request.getRequestPathMB();
-if (requestPathMB.equals(path)) {
+MessageBytes urlMB =
+context ? request.getRequestPathMB() : 
request.getDecodedRequestURIMB();
+if (urlMB.equals(path)) {
 response.setContentType("application/json");
 response.getOutputStream().print(UP);
 } else {
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 1aa08b5..35dad91 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -101,6 +101,10 @@
 Use the correct method to calculate session idle time in
 PersistentValve. (kfujino)
   
+  
+Fix path used by the health check valve when it is not associated with
+a Context. (remm)
+  
 
   
   


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



[tomcat] branch 7.0.x updated: Manually apply PR #346 - fix BZ64644 add write/read idle session timeout

2020-09-01 Thread markt
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/7.0.x by this push:
 new 96e874f  Manually apply PR #346 - fix BZ64644 add write/read idle 
session timeout
96e874f is described below

commit 96e874f10e041feb3a1f7800254a89c8ff631be8
Author: Mark Thomas 
AuthorDate: Tue Sep 1 13:53:31 2020 +0100

Manually apply PR #346 - fix BZ64644 add write/read idle session timeout

https://bz.apache.org/bugzilla/show_bug.cgi?id=64644
---
 java/org/apache/tomcat/websocket/Constants.java|  6 ++
 .../tomcat/websocket/LocalStrings.properties   |  6 +-
 java/org/apache/tomcat/websocket/WsFrameBase.java  |  2 +-
 .../tomcat/websocket/WsRemoteEndpointImplBase.java |  4 +-
 java/org/apache/tomcat/websocket/WsSession.java| 56 +++---
 .../tomcat/websocket/TestWsWebSocketContainer.java | 85 +-
 webapps/docs/changelog.xml |  6 ++
 webapps/docs/web-socket-howto.xml  | 13 
 8 files changed, 161 insertions(+), 17 deletions(-)

diff --git a/java/org/apache/tomcat/websocket/Constants.java 
b/java/org/apache/tomcat/websocket/Constants.java
index 440050a..076c5c3 100644
--- a/java/org/apache/tomcat/websocket/Constants.java
+++ b/java/org/apache/tomcat/websocket/Constants.java
@@ -86,6 +86,12 @@ public class Constants {
 static final String DEFAULT_ORIGIN_HEADER_VALUE =
 
System.getProperty("org.apache.tomcat.websocket.DEFAULT_ORIGIN_HEADER_VALUE");
 
+// Configuration for read idle timeout on WebSocket session
+public static final String READ_IDLE_TIMEOUT_MS = 
"org.apache.tomcat.websocket.READ_IDLE_TIMEOUT_MS";
+
+// Configuration for write idle timeout on WebSocket session
+public static final String WRITE_IDLE_TIMEOUT_MS = 
"org.apache.tomcat.websocket.WRITE_IDLE_TIMEOUT_MS";
+
 // Configuration for background processing checks intervals
 static final int DEFAULT_PROCESS_PERIOD = Integer.getInteger(
 "org.apache.tomcat.websocket.DEFAULT_PROCESS_PERIOD", 10)
diff --git a/java/org/apache/tomcat/websocket/LocalStrings.properties 
b/java/org/apache/tomcat/websocket/LocalStrings.properties
index 0888576..144b04d 100644
--- a/java/org/apache/tomcat/websocket/LocalStrings.properties
+++ b/java/org/apache/tomcat/websocket/LocalStrings.properties
@@ -88,11 +88,13 @@ wsRemoteEndpoint.nullHandler=Invalid null handler argument
 wsRemoteEndpoint.tooMuchData=Ping or pong may not send more than 125 bytes
 wsRemoteEndpoint.wrongState=The remote endpoint was in state [{0}] which is an 
invalid state for called method
 
-# Note the following message is used as a close reason in a WebSocket control
+# Note the following messages are used as a close reason in a WebSocket control
 # frame and therefore must be 123 bytes (not characters) or less in length.
 # Messages are encoded using UTF-8 where a single character may be encoded in
 # as many as 4 bytes.
-wsSession.timeout=The WebSocket session [{0}] timeout expired
+wsSession.timeout=The WebSocket session [{0}] idle timeout expired
+wsSession.timeoutRead=The WebSocket session [{0}] read idle timeout expired
+wsSession.timeoutWrite=The WebSocket session [{0}] write idle timeout expired
 
 wsSession.closed=The WebSocket session [{0}] has been closed and no method 
(apart from close()) may be called on a closed session
 wsSession.created=Created WebSocket session [{0}]
diff --git a/java/org/apache/tomcat/websocket/WsFrameBase.java 
b/java/org/apache/tomcat/websocket/WsFrameBase.java
index 1d9404e..3fbdb67 100644
--- a/java/org/apache/tomcat/websocket/WsFrameBase.java
+++ b/java/org/apache/tomcat/websocket/WsFrameBase.java
@@ -110,7 +110,7 @@ public abstract class WsFrameBase {
 
 protected void processInputBuffer() throws IOException {
 while (true) {
-wsSession.updateLastActive();
+wsSession.updateLastActiveRead();
 if (state == State.NEW_FRAME) {
 if (!processInitialHeader()) {
 break;
diff --git a/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java 
b/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java
index be719a0..918f507 100644
--- a/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java
+++ b/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java
@@ -292,7 +292,7 @@ public abstract class WsRemoteEndpointImplBase implements 
RemoteEndpoint {
 void startMessage(byte opCode, ByteBuffer payload, boolean last,
 SendHandler handler) {
 
-wsSession.updateLastActive();
+wsSession.updateLastActiveWrite();
 
 List messageParts = new ArrayList();
 messageParts.add(new MessagePart(last, 0, opCode, payload,
@@ -376,7 +376,7 @@ public abstract class WsRemoteEndpointImplBase implements 
RemoteEndpoint {
 writeMessagePar

Re: [Bug 60030] Run away CPU with JSSE / OpenSSL with IE8

2020-09-01 Thread Felix Schumacher


Am 01.09.20 um 10:59 schrieb bugzi...@apache.org:
> https://bz.apache.org/bugzilla/show_bug.cgi?id=60030

Spam reverted and the account has been disabled.

 Felix


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



[tomcat] branch 7.0.x updated: Manually apply PR #346 - fix BZ64644 add write/read idle session timeout

2020-09-01 Thread markt
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/7.0.x by this push:
 new 96e874f  Manually apply PR #346 - fix BZ64644 add write/read idle 
session timeout
96e874f is described below

commit 96e874f10e041feb3a1f7800254a89c8ff631be8
Author: Mark Thomas 
AuthorDate: Tue Sep 1 13:53:31 2020 +0100

Manually apply PR #346 - fix BZ64644 add write/read idle session timeout

https://bz.apache.org/bugzilla/show_bug.cgi?id=64644
---
 java/org/apache/tomcat/websocket/Constants.java|  6 ++
 .../tomcat/websocket/LocalStrings.properties   |  6 +-
 java/org/apache/tomcat/websocket/WsFrameBase.java  |  2 +-
 .../tomcat/websocket/WsRemoteEndpointImplBase.java |  4 +-
 java/org/apache/tomcat/websocket/WsSession.java| 56 +++---
 .../tomcat/websocket/TestWsWebSocketContainer.java | 85 +-
 webapps/docs/changelog.xml |  6 ++
 webapps/docs/web-socket-howto.xml  | 13 
 8 files changed, 161 insertions(+), 17 deletions(-)

diff --git a/java/org/apache/tomcat/websocket/Constants.java 
b/java/org/apache/tomcat/websocket/Constants.java
index 440050a..076c5c3 100644
--- a/java/org/apache/tomcat/websocket/Constants.java
+++ b/java/org/apache/tomcat/websocket/Constants.java
@@ -86,6 +86,12 @@ public class Constants {
 static final String DEFAULT_ORIGIN_HEADER_VALUE =
 
System.getProperty("org.apache.tomcat.websocket.DEFAULT_ORIGIN_HEADER_VALUE");
 
+// Configuration for read idle timeout on WebSocket session
+public static final String READ_IDLE_TIMEOUT_MS = 
"org.apache.tomcat.websocket.READ_IDLE_TIMEOUT_MS";
+
+// Configuration for write idle timeout on WebSocket session
+public static final String WRITE_IDLE_TIMEOUT_MS = 
"org.apache.tomcat.websocket.WRITE_IDLE_TIMEOUT_MS";
+
 // Configuration for background processing checks intervals
 static final int DEFAULT_PROCESS_PERIOD = Integer.getInteger(
 "org.apache.tomcat.websocket.DEFAULT_PROCESS_PERIOD", 10)
diff --git a/java/org/apache/tomcat/websocket/LocalStrings.properties 
b/java/org/apache/tomcat/websocket/LocalStrings.properties
index 0888576..144b04d 100644
--- a/java/org/apache/tomcat/websocket/LocalStrings.properties
+++ b/java/org/apache/tomcat/websocket/LocalStrings.properties
@@ -88,11 +88,13 @@ wsRemoteEndpoint.nullHandler=Invalid null handler argument
 wsRemoteEndpoint.tooMuchData=Ping or pong may not send more than 125 bytes
 wsRemoteEndpoint.wrongState=The remote endpoint was in state [{0}] which is an 
invalid state for called method
 
-# Note the following message is used as a close reason in a WebSocket control
+# Note the following messages are used as a close reason in a WebSocket control
 # frame and therefore must be 123 bytes (not characters) or less in length.
 # Messages are encoded using UTF-8 where a single character may be encoded in
 # as many as 4 bytes.
-wsSession.timeout=The WebSocket session [{0}] timeout expired
+wsSession.timeout=The WebSocket session [{0}] idle timeout expired
+wsSession.timeoutRead=The WebSocket session [{0}] read idle timeout expired
+wsSession.timeoutWrite=The WebSocket session [{0}] write idle timeout expired
 
 wsSession.closed=The WebSocket session [{0}] has been closed and no method 
(apart from close()) may be called on a closed session
 wsSession.created=Created WebSocket session [{0}]
diff --git a/java/org/apache/tomcat/websocket/WsFrameBase.java 
b/java/org/apache/tomcat/websocket/WsFrameBase.java
index 1d9404e..3fbdb67 100644
--- a/java/org/apache/tomcat/websocket/WsFrameBase.java
+++ b/java/org/apache/tomcat/websocket/WsFrameBase.java
@@ -110,7 +110,7 @@ public abstract class WsFrameBase {
 
 protected void processInputBuffer() throws IOException {
 while (true) {
-wsSession.updateLastActive();
+wsSession.updateLastActiveRead();
 if (state == State.NEW_FRAME) {
 if (!processInitialHeader()) {
 break;
diff --git a/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java 
b/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java
index be719a0..918f507 100644
--- a/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java
+++ b/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java
@@ -292,7 +292,7 @@ public abstract class WsRemoteEndpointImplBase implements 
RemoteEndpoint {
 void startMessage(byte opCode, ByteBuffer payload, boolean last,
 SendHandler handler) {
 
-wsSession.updateLastActive();
+wsSession.updateLastActiveWrite();
 
 List messageParts = new ArrayList();
 messageParts.add(new MessagePart(last, 0, opCode, payload,
@@ -376,7 +376,7 @@ public abstract class WsRemoteEndpointImplBase implements 
RemoteEndpoint {
 writeMessagePar

[tomcat] branch 7.0.x updated: Manually apply PR #346 - fix BZ64644 add write/read idle session timeout

2020-09-01 Thread markt
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/7.0.x by this push:
 new 96e874f  Manually apply PR #346 - fix BZ64644 add write/read idle 
session timeout
96e874f is described below

commit 96e874f10e041feb3a1f7800254a89c8ff631be8
Author: Mark Thomas 
AuthorDate: Tue Sep 1 13:53:31 2020 +0100

Manually apply PR #346 - fix BZ64644 add write/read idle session timeout

https://bz.apache.org/bugzilla/show_bug.cgi?id=64644
---
 java/org/apache/tomcat/websocket/Constants.java|  6 ++
 .../tomcat/websocket/LocalStrings.properties   |  6 +-
 java/org/apache/tomcat/websocket/WsFrameBase.java  |  2 +-
 .../tomcat/websocket/WsRemoteEndpointImplBase.java |  4 +-
 java/org/apache/tomcat/websocket/WsSession.java| 56 +++---
 .../tomcat/websocket/TestWsWebSocketContainer.java | 85 +-
 webapps/docs/changelog.xml |  6 ++
 webapps/docs/web-socket-howto.xml  | 13 
 8 files changed, 161 insertions(+), 17 deletions(-)

diff --git a/java/org/apache/tomcat/websocket/Constants.java 
b/java/org/apache/tomcat/websocket/Constants.java
index 440050a..076c5c3 100644
--- a/java/org/apache/tomcat/websocket/Constants.java
+++ b/java/org/apache/tomcat/websocket/Constants.java
@@ -86,6 +86,12 @@ public class Constants {
 static final String DEFAULT_ORIGIN_HEADER_VALUE =
 
System.getProperty("org.apache.tomcat.websocket.DEFAULT_ORIGIN_HEADER_VALUE");
 
+// Configuration for read idle timeout on WebSocket session
+public static final String READ_IDLE_TIMEOUT_MS = 
"org.apache.tomcat.websocket.READ_IDLE_TIMEOUT_MS";
+
+// Configuration for write idle timeout on WebSocket session
+public static final String WRITE_IDLE_TIMEOUT_MS = 
"org.apache.tomcat.websocket.WRITE_IDLE_TIMEOUT_MS";
+
 // Configuration for background processing checks intervals
 static final int DEFAULT_PROCESS_PERIOD = Integer.getInteger(
 "org.apache.tomcat.websocket.DEFAULT_PROCESS_PERIOD", 10)
diff --git a/java/org/apache/tomcat/websocket/LocalStrings.properties 
b/java/org/apache/tomcat/websocket/LocalStrings.properties
index 0888576..144b04d 100644
--- a/java/org/apache/tomcat/websocket/LocalStrings.properties
+++ b/java/org/apache/tomcat/websocket/LocalStrings.properties
@@ -88,11 +88,13 @@ wsRemoteEndpoint.nullHandler=Invalid null handler argument
 wsRemoteEndpoint.tooMuchData=Ping or pong may not send more than 125 bytes
 wsRemoteEndpoint.wrongState=The remote endpoint was in state [{0}] which is an 
invalid state for called method
 
-# Note the following message is used as a close reason in a WebSocket control
+# Note the following messages are used as a close reason in a WebSocket control
 # frame and therefore must be 123 bytes (not characters) or less in length.
 # Messages are encoded using UTF-8 where a single character may be encoded in
 # as many as 4 bytes.
-wsSession.timeout=The WebSocket session [{0}] timeout expired
+wsSession.timeout=The WebSocket session [{0}] idle timeout expired
+wsSession.timeoutRead=The WebSocket session [{0}] read idle timeout expired
+wsSession.timeoutWrite=The WebSocket session [{0}] write idle timeout expired
 
 wsSession.closed=The WebSocket session [{0}] has been closed and no method 
(apart from close()) may be called on a closed session
 wsSession.created=Created WebSocket session [{0}]
diff --git a/java/org/apache/tomcat/websocket/WsFrameBase.java 
b/java/org/apache/tomcat/websocket/WsFrameBase.java
index 1d9404e..3fbdb67 100644
--- a/java/org/apache/tomcat/websocket/WsFrameBase.java
+++ b/java/org/apache/tomcat/websocket/WsFrameBase.java
@@ -110,7 +110,7 @@ public abstract class WsFrameBase {
 
 protected void processInputBuffer() throws IOException {
 while (true) {
-wsSession.updateLastActive();
+wsSession.updateLastActiveRead();
 if (state == State.NEW_FRAME) {
 if (!processInitialHeader()) {
 break;
diff --git a/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java 
b/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java
index be719a0..918f507 100644
--- a/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java
+++ b/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java
@@ -292,7 +292,7 @@ public abstract class WsRemoteEndpointImplBase implements 
RemoteEndpoint {
 void startMessage(byte opCode, ByteBuffer payload, boolean last,
 SendHandler handler) {
 
-wsSession.updateLastActive();
+wsSession.updateLastActiveWrite();
 
 List messageParts = new ArrayList();
 messageParts.add(new MessagePart(last, 0, opCode, payload,
@@ -376,7 +376,7 @@ public abstract class WsRemoteEndpointImplBase implements 
RemoteEndpoint {
 writeMessagePar

[tomcat] branch 7.0.x updated: Manually apply PR #346 - fix BZ64644 add write/read idle session timeout

2020-09-01 Thread markt
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/7.0.x by this push:
 new 96e874f  Manually apply PR #346 - fix BZ64644 add write/read idle 
session timeout
96e874f is described below

commit 96e874f10e041feb3a1f7800254a89c8ff631be8
Author: Mark Thomas 
AuthorDate: Tue Sep 1 13:53:31 2020 +0100

Manually apply PR #346 - fix BZ64644 add write/read idle session timeout

https://bz.apache.org/bugzilla/show_bug.cgi?id=64644
---
 java/org/apache/tomcat/websocket/Constants.java|  6 ++
 .../tomcat/websocket/LocalStrings.properties   |  6 +-
 java/org/apache/tomcat/websocket/WsFrameBase.java  |  2 +-
 .../tomcat/websocket/WsRemoteEndpointImplBase.java |  4 +-
 java/org/apache/tomcat/websocket/WsSession.java| 56 +++---
 .../tomcat/websocket/TestWsWebSocketContainer.java | 85 +-
 webapps/docs/changelog.xml |  6 ++
 webapps/docs/web-socket-howto.xml  | 13 
 8 files changed, 161 insertions(+), 17 deletions(-)

diff --git a/java/org/apache/tomcat/websocket/Constants.java 
b/java/org/apache/tomcat/websocket/Constants.java
index 440050a..076c5c3 100644
--- a/java/org/apache/tomcat/websocket/Constants.java
+++ b/java/org/apache/tomcat/websocket/Constants.java
@@ -86,6 +86,12 @@ public class Constants {
 static final String DEFAULT_ORIGIN_HEADER_VALUE =
 
System.getProperty("org.apache.tomcat.websocket.DEFAULT_ORIGIN_HEADER_VALUE");
 
+// Configuration for read idle timeout on WebSocket session
+public static final String READ_IDLE_TIMEOUT_MS = 
"org.apache.tomcat.websocket.READ_IDLE_TIMEOUT_MS";
+
+// Configuration for write idle timeout on WebSocket session
+public static final String WRITE_IDLE_TIMEOUT_MS = 
"org.apache.tomcat.websocket.WRITE_IDLE_TIMEOUT_MS";
+
 // Configuration for background processing checks intervals
 static final int DEFAULT_PROCESS_PERIOD = Integer.getInteger(
 "org.apache.tomcat.websocket.DEFAULT_PROCESS_PERIOD", 10)
diff --git a/java/org/apache/tomcat/websocket/LocalStrings.properties 
b/java/org/apache/tomcat/websocket/LocalStrings.properties
index 0888576..144b04d 100644
--- a/java/org/apache/tomcat/websocket/LocalStrings.properties
+++ b/java/org/apache/tomcat/websocket/LocalStrings.properties
@@ -88,11 +88,13 @@ wsRemoteEndpoint.nullHandler=Invalid null handler argument
 wsRemoteEndpoint.tooMuchData=Ping or pong may not send more than 125 bytes
 wsRemoteEndpoint.wrongState=The remote endpoint was in state [{0}] which is an 
invalid state for called method
 
-# Note the following message is used as a close reason in a WebSocket control
+# Note the following messages are used as a close reason in a WebSocket control
 # frame and therefore must be 123 bytes (not characters) or less in length.
 # Messages are encoded using UTF-8 where a single character may be encoded in
 # as many as 4 bytes.
-wsSession.timeout=The WebSocket session [{0}] timeout expired
+wsSession.timeout=The WebSocket session [{0}] idle timeout expired
+wsSession.timeoutRead=The WebSocket session [{0}] read idle timeout expired
+wsSession.timeoutWrite=The WebSocket session [{0}] write idle timeout expired
 
 wsSession.closed=The WebSocket session [{0}] has been closed and no method 
(apart from close()) may be called on a closed session
 wsSession.created=Created WebSocket session [{0}]
diff --git a/java/org/apache/tomcat/websocket/WsFrameBase.java 
b/java/org/apache/tomcat/websocket/WsFrameBase.java
index 1d9404e..3fbdb67 100644
--- a/java/org/apache/tomcat/websocket/WsFrameBase.java
+++ b/java/org/apache/tomcat/websocket/WsFrameBase.java
@@ -110,7 +110,7 @@ public abstract class WsFrameBase {
 
 protected void processInputBuffer() throws IOException {
 while (true) {
-wsSession.updateLastActive();
+wsSession.updateLastActiveRead();
 if (state == State.NEW_FRAME) {
 if (!processInitialHeader()) {
 break;
diff --git a/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java 
b/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java
index be719a0..918f507 100644
--- a/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java
+++ b/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java
@@ -292,7 +292,7 @@ public abstract class WsRemoteEndpointImplBase implements 
RemoteEndpoint {
 void startMessage(byte opCode, ByteBuffer payload, boolean last,
 SendHandler handler) {
 
-wsSession.updateLastActive();
+wsSession.updateLastActiveWrite();
 
 List messageParts = new ArrayList();
 messageParts.add(new MessagePart(last, 0, opCode, payload,
@@ -376,7 +376,7 @@ public abstract class WsRemoteEndpointImplBase implements 
RemoteEndpoint {
 writeMessagePar

[tomcat] branch 7.0.x updated: Manually apply PR #346 - fix BZ64644 add write/read idle session timeout

2020-09-01 Thread markt
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/7.0.x by this push:
 new 96e874f  Manually apply PR #346 - fix BZ64644 add write/read idle 
session timeout
96e874f is described below

commit 96e874f10e041feb3a1f7800254a89c8ff631be8
Author: Mark Thomas 
AuthorDate: Tue Sep 1 13:53:31 2020 +0100

Manually apply PR #346 - fix BZ64644 add write/read idle session timeout

https://bz.apache.org/bugzilla/show_bug.cgi?id=64644
---
 java/org/apache/tomcat/websocket/Constants.java|  6 ++
 .../tomcat/websocket/LocalStrings.properties   |  6 +-
 java/org/apache/tomcat/websocket/WsFrameBase.java  |  2 +-
 .../tomcat/websocket/WsRemoteEndpointImplBase.java |  4 +-
 java/org/apache/tomcat/websocket/WsSession.java| 56 +++---
 .../tomcat/websocket/TestWsWebSocketContainer.java | 85 +-
 webapps/docs/changelog.xml |  6 ++
 webapps/docs/web-socket-howto.xml  | 13 
 8 files changed, 161 insertions(+), 17 deletions(-)

diff --git a/java/org/apache/tomcat/websocket/Constants.java 
b/java/org/apache/tomcat/websocket/Constants.java
index 440050a..076c5c3 100644
--- a/java/org/apache/tomcat/websocket/Constants.java
+++ b/java/org/apache/tomcat/websocket/Constants.java
@@ -86,6 +86,12 @@ public class Constants {
 static final String DEFAULT_ORIGIN_HEADER_VALUE =
 
System.getProperty("org.apache.tomcat.websocket.DEFAULT_ORIGIN_HEADER_VALUE");
 
+// Configuration for read idle timeout on WebSocket session
+public static final String READ_IDLE_TIMEOUT_MS = 
"org.apache.tomcat.websocket.READ_IDLE_TIMEOUT_MS";
+
+// Configuration for write idle timeout on WebSocket session
+public static final String WRITE_IDLE_TIMEOUT_MS = 
"org.apache.tomcat.websocket.WRITE_IDLE_TIMEOUT_MS";
+
 // Configuration for background processing checks intervals
 static final int DEFAULT_PROCESS_PERIOD = Integer.getInteger(
 "org.apache.tomcat.websocket.DEFAULT_PROCESS_PERIOD", 10)
diff --git a/java/org/apache/tomcat/websocket/LocalStrings.properties 
b/java/org/apache/tomcat/websocket/LocalStrings.properties
index 0888576..144b04d 100644
--- a/java/org/apache/tomcat/websocket/LocalStrings.properties
+++ b/java/org/apache/tomcat/websocket/LocalStrings.properties
@@ -88,11 +88,13 @@ wsRemoteEndpoint.nullHandler=Invalid null handler argument
 wsRemoteEndpoint.tooMuchData=Ping or pong may not send more than 125 bytes
 wsRemoteEndpoint.wrongState=The remote endpoint was in state [{0}] which is an 
invalid state for called method
 
-# Note the following message is used as a close reason in a WebSocket control
+# Note the following messages are used as a close reason in a WebSocket control
 # frame and therefore must be 123 bytes (not characters) or less in length.
 # Messages are encoded using UTF-8 where a single character may be encoded in
 # as many as 4 bytes.
-wsSession.timeout=The WebSocket session [{0}] timeout expired
+wsSession.timeout=The WebSocket session [{0}] idle timeout expired
+wsSession.timeoutRead=The WebSocket session [{0}] read idle timeout expired
+wsSession.timeoutWrite=The WebSocket session [{0}] write idle timeout expired
 
 wsSession.closed=The WebSocket session [{0}] has been closed and no method 
(apart from close()) may be called on a closed session
 wsSession.created=Created WebSocket session [{0}]
diff --git a/java/org/apache/tomcat/websocket/WsFrameBase.java 
b/java/org/apache/tomcat/websocket/WsFrameBase.java
index 1d9404e..3fbdb67 100644
--- a/java/org/apache/tomcat/websocket/WsFrameBase.java
+++ b/java/org/apache/tomcat/websocket/WsFrameBase.java
@@ -110,7 +110,7 @@ public abstract class WsFrameBase {
 
 protected void processInputBuffer() throws IOException {
 while (true) {
-wsSession.updateLastActive();
+wsSession.updateLastActiveRead();
 if (state == State.NEW_FRAME) {
 if (!processInitialHeader()) {
 break;
diff --git a/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java 
b/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java
index be719a0..918f507 100644
--- a/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java
+++ b/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java
@@ -292,7 +292,7 @@ public abstract class WsRemoteEndpointImplBase implements 
RemoteEndpoint {
 void startMessage(byte opCode, ByteBuffer payload, boolean last,
 SendHandler handler) {
 
-wsSession.updateLastActive();
+wsSession.updateLastActiveWrite();
 
 List messageParts = new ArrayList();
 messageParts.add(new MessagePart(last, 0, opCode, payload,
@@ -376,7 +376,7 @@ public abstract class WsRemoteEndpointImplBase implements 
RemoteEndpoint {
 writeMessagePar

[Bug 64644] wrong state of WsSession on network outage

2020-09-01 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=64644

Mark Thomas  changed:

   What|Removed |Added

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

--- Comment #6 from Mark Thomas  ---
Fixed in:
- master for 10.0.0-M8 onwards
- 9.0.x for 9.0.38 onwards
- 8.5.x for 8.5.58 onwards
- 7.0.x for 7.0.106 onwards

Thanks for the PR and for adapting it based on feedback.

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



[tomcat] branch 8.5.x updated: Manually apply PR #346 - fix BZ64644 add write/read idle session timeout

2020-09-01 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 ee51a0d  Manually apply PR #346 - fix BZ64644 add write/read idle 
session timeout
ee51a0d is described below

commit ee51a0dbfa9fd533b50396417b8c4734c8719ae1
Author: Mark Thomas 
AuthorDate: Tue Sep 1 13:53:31 2020 +0100

Manually apply PR #346 - fix BZ64644 add write/read idle session timeout

https://bz.apache.org/bugzilla/show_bug.cgi?id=64644
---
 java/org/apache/tomcat/websocket/Constants.java|  6 ++
 .../tomcat/websocket/LocalStrings.properties   |  6 +-
 java/org/apache/tomcat/websocket/WsFrameBase.java  |  2 +-
 .../tomcat/websocket/WsRemoteEndpointImplBase.java |  6 +-
 java/org/apache/tomcat/websocket/WsSession.java| 53 +++---
 .../tomcat/websocket/TestWsWebSocketContainer.java | 85 +-
 webapps/docs/changelog.xml |  6 ++
 webapps/docs/web-socket-howto.xml  | 13 
 8 files changed, 159 insertions(+), 18 deletions(-)

diff --git a/java/org/apache/tomcat/websocket/Constants.java 
b/java/org/apache/tomcat/websocket/Constants.java
index fa01921..09dbc73 100644
--- a/java/org/apache/tomcat/websocket/Constants.java
+++ b/java/org/apache/tomcat/websocket/Constants.java
@@ -114,6 +114,12 @@ public class Constants {
 // Milliseconds so this is 20 seconds
 public static final long DEFAULT_BLOCKING_SEND_TIMEOUT = 20 * 1000;
 
+// Configuration for read idle timeout on WebSocket session
+public static final String READ_IDLE_TIMEOUT_MS = 
"org.apache.tomcat.websocket.READ_IDLE_TIMEOUT_MS";
+
+// Configuration for write idle timeout on WebSocket session
+public static final String WRITE_IDLE_TIMEOUT_MS = 
"org.apache.tomcat.websocket.WRITE_IDLE_TIMEOUT_MS";
+
 // Configuration for background processing checks intervals
 static final int DEFAULT_PROCESS_PERIOD = Integer.getInteger(
 "org.apache.tomcat.websocket.DEFAULT_PROCESS_PERIOD", 10)
diff --git a/java/org/apache/tomcat/websocket/LocalStrings.properties 
b/java/org/apache/tomcat/websocket/LocalStrings.properties
index 8c3c505..22e9f17 100644
--- a/java/org/apache/tomcat/websocket/LocalStrings.properties
+++ b/java/org/apache/tomcat/websocket/LocalStrings.properties
@@ -98,11 +98,13 @@ wsRemoteEndpoint.tooMuchData=Ping or pong may not send more 
than 125 bytes
 wsRemoteEndpoint.writeTimeout=Blocking write timeout
 wsRemoteEndpoint.wrongState=The remote endpoint was in state [{0}] which is an 
invalid state for called method
 
-# Note the following message is used as a close reason in a WebSocket control
+# Note the following messages are used as a close reason in a WebSocket control
 # frame and therefore must be 123 bytes (not characters) or less in length.
 # Messages are encoded using UTF-8 where a single character may be encoded in
 # as many as 4 bytes.
-wsSession.timeout=The WebSocket session [{0}] timeout expired
+wsSession.timeout=The WebSocket session [{0}] idle timeout expired
+wsSession.timeoutRead=The WebSocket session [{0}] read idle timeout expired
+wsSession.timeoutWrite=The WebSocket session [{0}] write idle timeout expired
 
 wsSession.closed=The WebSocket session [{0}] has been closed and no method 
(apart from close()) may be called on a closed session
 wsSession.created=Created WebSocket session [{0}]
diff --git a/java/org/apache/tomcat/websocket/WsFrameBase.java 
b/java/org/apache/tomcat/websocket/WsFrameBase.java
index a6df700..3993c6a 100644
--- a/java/org/apache/tomcat/websocket/WsFrameBase.java
+++ b/java/org/apache/tomcat/websocket/WsFrameBase.java
@@ -113,7 +113,7 @@ public abstract class WsFrameBase {
 
 protected void processInputBuffer() throws IOException {
 while (!isSuspended()) {
-wsSession.updateLastActive();
+wsSession.updateLastActiveRead();
 if (state == State.NEW_FRAME) {
 if (!processInitialHeader()) {
 break;
diff --git a/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java 
b/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java
index c87f99e..103f80d 100644
--- a/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java
+++ b/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java
@@ -275,7 +275,7 @@ public abstract class WsRemoteEndpointImplBase implements 
RemoteEndpoint {
 
 private void sendMessageBlock(byte opCode, ByteBuffer payload, boolean 
last,
 long timeoutExpiry) throws IOException {
-wsSession.updateLastActive();
+wsSession.updateLastActiveWrite();
 
 BlockingSendHandler bsh = new BlockingSendHandler();
 
@@ -340,7 +340,7 @@ public abstract class WsRemoteEndpointImplBase implements 
RemoteEndpoint {
 void startMessage(byte opCode, ByteBuffer payload, boolean last,
  

[tomcat] branch 9.0.x updated: Manually apply PR #346 - fix BZ64644 add write/read idle session timeout

2020-09-01 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 1b65886  Manually apply PR #346 - fix BZ64644 add write/read idle 
session timeout
1b65886 is described below

commit 1b6588642ceec650c69f416f98ef1a702739b80b
Author: Mark Thomas 
AuthorDate: Tue Sep 1 13:53:31 2020 +0100

Manually apply PR #346 - fix BZ64644 add write/read idle session timeout

https://bz.apache.org/bugzilla/show_bug.cgi?id=64644
---
 java/org/apache/tomcat/websocket/Constants.java|  6 ++
 .../tomcat/websocket/LocalStrings.properties   |  6 +-
 java/org/apache/tomcat/websocket/WsFrameBase.java  |  2 +-
 .../tomcat/websocket/WsRemoteEndpointImplBase.java |  6 +-
 java/org/apache/tomcat/websocket/WsSession.java| 53 +++---
 .../tomcat/websocket/TestWsWebSocketContainer.java | 85 +-
 webapps/docs/changelog.xml |  6 ++
 webapps/docs/web-socket-howto.xml  | 13 
 8 files changed, 159 insertions(+), 18 deletions(-)

diff --git a/java/org/apache/tomcat/websocket/Constants.java 
b/java/org/apache/tomcat/websocket/Constants.java
index fa01921..09dbc73 100644
--- a/java/org/apache/tomcat/websocket/Constants.java
+++ b/java/org/apache/tomcat/websocket/Constants.java
@@ -114,6 +114,12 @@ public class Constants {
 // Milliseconds so this is 20 seconds
 public static final long DEFAULT_BLOCKING_SEND_TIMEOUT = 20 * 1000;
 
+// Configuration for read idle timeout on WebSocket session
+public static final String READ_IDLE_TIMEOUT_MS = 
"org.apache.tomcat.websocket.READ_IDLE_TIMEOUT_MS";
+
+// Configuration for write idle timeout on WebSocket session
+public static final String WRITE_IDLE_TIMEOUT_MS = 
"org.apache.tomcat.websocket.WRITE_IDLE_TIMEOUT_MS";
+
 // Configuration for background processing checks intervals
 static final int DEFAULT_PROCESS_PERIOD = Integer.getInteger(
 "org.apache.tomcat.websocket.DEFAULT_PROCESS_PERIOD", 10)
diff --git a/java/org/apache/tomcat/websocket/LocalStrings.properties 
b/java/org/apache/tomcat/websocket/LocalStrings.properties
index 8c3c505..22e9f17 100644
--- a/java/org/apache/tomcat/websocket/LocalStrings.properties
+++ b/java/org/apache/tomcat/websocket/LocalStrings.properties
@@ -98,11 +98,13 @@ wsRemoteEndpoint.tooMuchData=Ping or pong may not send more 
than 125 bytes
 wsRemoteEndpoint.writeTimeout=Blocking write timeout
 wsRemoteEndpoint.wrongState=The remote endpoint was in state [{0}] which is an 
invalid state for called method
 
-# Note the following message is used as a close reason in a WebSocket control
+# Note the following messages are used as a close reason in a WebSocket control
 # frame and therefore must be 123 bytes (not characters) or less in length.
 # Messages are encoded using UTF-8 where a single character may be encoded in
 # as many as 4 bytes.
-wsSession.timeout=The WebSocket session [{0}] timeout expired
+wsSession.timeout=The WebSocket session [{0}] idle timeout expired
+wsSession.timeoutRead=The WebSocket session [{0}] read idle timeout expired
+wsSession.timeoutWrite=The WebSocket session [{0}] write idle timeout expired
 
 wsSession.closed=The WebSocket session [{0}] has been closed and no method 
(apart from close()) may be called on a closed session
 wsSession.created=Created WebSocket session [{0}]
diff --git a/java/org/apache/tomcat/websocket/WsFrameBase.java 
b/java/org/apache/tomcat/websocket/WsFrameBase.java
index a6df700..3993c6a 100644
--- a/java/org/apache/tomcat/websocket/WsFrameBase.java
+++ b/java/org/apache/tomcat/websocket/WsFrameBase.java
@@ -113,7 +113,7 @@ public abstract class WsFrameBase {
 
 protected void processInputBuffer() throws IOException {
 while (!isSuspended()) {
-wsSession.updateLastActive();
+wsSession.updateLastActiveRead();
 if (state == State.NEW_FRAME) {
 if (!processInitialHeader()) {
 break;
diff --git a/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java 
b/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java
index c87f99e..103f80d 100644
--- a/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java
+++ b/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java
@@ -275,7 +275,7 @@ public abstract class WsRemoteEndpointImplBase implements 
RemoteEndpoint {
 
 private void sendMessageBlock(byte opCode, ByteBuffer payload, boolean 
last,
 long timeoutExpiry) throws IOException {
-wsSession.updateLastActive();
+wsSession.updateLastActiveWrite();
 
 BlockingSendHandler bsh = new BlockingSendHandler();
 
@@ -340,7 +340,7 @@ public abstract class WsRemoteEndpointImplBase implements 
RemoteEndpoint {
 void startMessage(byte opCode, ByteBuffer payload, boolean last,
  

[tomcat] branch master updated: Manually apply PR #346 - fix BZ64644 add write/read idle session timeout

2020-09-01 Thread markt
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new 3a1824f  Manually apply PR #346 - fix BZ64644 add write/read idle 
session timeout
3a1824f is described below

commit 3a1824fe286232ada14ac95fda541e7744e31ab4
Author: Mark Thomas 
AuthorDate: Tue Sep 1 13:53:31 2020 +0100

Manually apply PR #346 - fix BZ64644 add write/read idle session timeout

https://bz.apache.org/bugzilla/show_bug.cgi?id=64644
---
 java/org/apache/tomcat/websocket/Constants.java|  6 ++
 .../tomcat/websocket/LocalStrings.properties   |  6 +-
 java/org/apache/tomcat/websocket/WsFrameBase.java  |  2 +-
 .../tomcat/websocket/WsRemoteEndpointImplBase.java |  6 +-
 java/org/apache/tomcat/websocket/WsSession.java| 53 +++---
 .../tomcat/websocket/TestWsWebSocketContainer.java | 85 +-
 webapps/docs/changelog.xml |  6 ++
 webapps/docs/web-socket-howto.xml  | 13 
 8 files changed, 159 insertions(+), 18 deletions(-)

diff --git a/java/org/apache/tomcat/websocket/Constants.java 
b/java/org/apache/tomcat/websocket/Constants.java
index 1971653..482a724 100644
--- a/java/org/apache/tomcat/websocket/Constants.java
+++ b/java/org/apache/tomcat/websocket/Constants.java
@@ -114,6 +114,12 @@ public class Constants {
 // Milliseconds so this is 20 seconds
 public static final long DEFAULT_BLOCKING_SEND_TIMEOUT = 20 * 1000;
 
+// Configuration for read idle timeout on WebSocket session
+public static final String READ_IDLE_TIMEOUT_MS = 
"org.apache.tomcat.websocket.READ_IDLE_TIMEOUT_MS";
+
+// Configuration for write idle timeout on WebSocket session
+public static final String WRITE_IDLE_TIMEOUT_MS = 
"org.apache.tomcat.websocket.WRITE_IDLE_TIMEOUT_MS";
+
 // Configuration for background processing checks intervals
 static final int DEFAULT_PROCESS_PERIOD = Integer.getInteger(
 "org.apache.tomcat.websocket.DEFAULT_PROCESS_PERIOD", 10)
diff --git a/java/org/apache/tomcat/websocket/LocalStrings.properties 
b/java/org/apache/tomcat/websocket/LocalStrings.properties
index 8c3c505..22e9f17 100644
--- a/java/org/apache/tomcat/websocket/LocalStrings.properties
+++ b/java/org/apache/tomcat/websocket/LocalStrings.properties
@@ -98,11 +98,13 @@ wsRemoteEndpoint.tooMuchData=Ping or pong may not send more 
than 125 bytes
 wsRemoteEndpoint.writeTimeout=Blocking write timeout
 wsRemoteEndpoint.wrongState=The remote endpoint was in state [{0}] which is an 
invalid state for called method
 
-# Note the following message is used as a close reason in a WebSocket control
+# Note the following messages are used as a close reason in a WebSocket control
 # frame and therefore must be 123 bytes (not characters) or less in length.
 # Messages are encoded using UTF-8 where a single character may be encoded in
 # as many as 4 bytes.
-wsSession.timeout=The WebSocket session [{0}] timeout expired
+wsSession.timeout=The WebSocket session [{0}] idle timeout expired
+wsSession.timeoutRead=The WebSocket session [{0}] read idle timeout expired
+wsSession.timeoutWrite=The WebSocket session [{0}] write idle timeout expired
 
 wsSession.closed=The WebSocket session [{0}] has been closed and no method 
(apart from close()) may be called on a closed session
 wsSession.created=Created WebSocket session [{0}]
diff --git a/java/org/apache/tomcat/websocket/WsFrameBase.java 
b/java/org/apache/tomcat/websocket/WsFrameBase.java
index a5d2aaa..3bb9bb1 100644
--- a/java/org/apache/tomcat/websocket/WsFrameBase.java
+++ b/java/org/apache/tomcat/websocket/WsFrameBase.java
@@ -113,7 +113,7 @@ public abstract class WsFrameBase {
 
 protected void processInputBuffer() throws IOException {
 while (!isSuspended()) {
-wsSession.updateLastActive();
+wsSession.updateLastActiveRead();
 if (state == State.NEW_FRAME) {
 if (!processInitialHeader()) {
 break;
diff --git a/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java 
b/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java
index ba542a4..0324e50 100644
--- a/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java
+++ b/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java
@@ -275,7 +275,7 @@ public abstract class WsRemoteEndpointImplBase implements 
RemoteEndpoint {
 
 private void sendMessageBlock(byte opCode, ByteBuffer payload, boolean 
last,
 long timeoutExpiry) throws IOException {
-wsSession.updateLastActive();
+wsSession.updateLastActiveWrite();
 
 BlockingSendHandler bsh = new BlockingSendHandler();
 
@@ -340,7 +340,7 @@ public abstract class WsRemoteEndpointImplBase implements 
RemoteEndpoint {
 void startMessage(byte opCode, ByteBuffer payload, boolean last,

[GitHub] [tomcat] markt-asf commented on pull request #346: Bug 64644 add custom properties to close connections on readIdletimeout

2020-09-01 Thread GitBox


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


   Applied manually.



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

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



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



[GitHub] [tomcat] markt-asf closed pull request #346: Bug 64644 add custom properties to close connections on readIdletimeout

2020-09-01 Thread GitBox


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


   



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

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



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



[GitHub] [tomcat] markt-asf commented on a change in pull request #346: Bug 64644 add custom properties to close connections on readIdletimeout

2020-09-01 Thread GitBox


markt-asf commented on a change in pull request #346:
URL: https://github.com/apache/tomcat/pull/346#discussion_r481028956



##
File path: test/org/apache/tomcat/websocket/TestWsWebSocketContainer.java
##
@@ -779,6 +779,104 @@ public void testSessionExpirySession() throws Exception {
 Assert.assertEquals(0, getOpenCount(setA));
 }
 
+@Test
+public void testSessionExpiryOnUserPropertyReadIdleTimeout() throws 
Exception {
+final String readIdleTimeoutParameter = 
org.apache.tomcat.websocket.Constants.WS_READ_IDLE_TIMEOUT;
+
+Tomcat tomcat = getTomcatInstance();
+// No file system docBase required
+Context ctx = tomcat.addContext("", null);
+ctx.addApplicationListener(TesterEchoServer.Config.class.getName());
+Tomcat.addServlet(ctx, "default", new DefaultServlet());
+ctx.addServletMappingDecoded("/", "default");
+
+tomcat.start();
+
+// Need access to implementation methods for configuring unit tests
+WsWebSocketContainer wsContainer = (WsWebSocketContainer)
+ContainerProvider.getWebSocketContainer();
+
+wsContainer.setDefaultMaxSessionIdleTimeout(5000);
+wsContainer.setProcessPeriod(1);
+
+EndpointA endpointA = new EndpointA();
+Session s1a = connectToEchoServer(wsContainer, endpointA,
+TesterEchoServer.Config.PATH_BASIC);
+s1a.setMaxIdleTimeout(9);
+
+s1a.getUserProperties().put(readIdleTimeoutParameter, (long)5000);

Review comment:
   Using Long here avoids an IDE warning. (and the same in the second new 
test below).

##
File path: java/org/apache/tomcat/websocket/WsSession.java
##
@@ -816,16 +823,62 @@ protected void checkExpiration() {
 return;
 }
 
-if (System.currentTimeMillis() - lastActive > timeout) {
+long currentTime = System.currentTimeMillis();
+
+if (currentTime - lastActive > timeout) {
 String msg = sm.getString("wsSession.timeout", getId());
 if (log.isDebugEnabled()) {
 log.debug(msg);
 }
 doClose(new CloseReason(CloseCodes.GOING_AWAY, msg),
 new CloseReason(CloseCodes.CLOSED_ABNORMALLY, msg));
+} else {
+boolean closeConnection = false;
+Long idleReadTimeout = getIdleReadTimeout();
+
+closeConnection = idleReadTimeout != null && (currentTime - 
lastReadTime > idleReadTimeout);
+
+if (closeConnection) {
+String msg = sm.getString("wsSession.readIdleTimeout", 
getId());
+if (log.isDebugEnabled()) {
+log.debug(msg);
+}
+doClose(new CloseReason(CloseCodes.GOING_AWAY, msg),
+new CloseReason(CloseCodes.CLOSED_ABNORMALLY, msg));
+}
+
+Long idleWriteTimeout = getIdleWriteTimeout();
+
+closeConnection = idleWriteTimeout != null && (currentTime - 
lastWriteTime > idleWriteTimeout);
+
+if (closeConnection) {
+String msg = sm.getString("wsSession.writeIdleTimeout", 
getId());
+if (log.isDebugEnabled()) {
+log.debug(msg);
+}
+doClose(new CloseReason(CloseCodes.GOING_AWAY, msg),
+new CloseReason(CloseCodes.CLOSED_ABNORMALLY, msg));
+}
 }
 }
 
+private Long getIdleReadTimeout() {
+Object readTimeout = 
this.getUserProperties().get(Constants.WS_READ_IDLE_TIMEOUT);
+Long userReadTimeout = null;
+if (readTimeout instanceof Long) {
+userReadTimeout = (Long) readTimeout;
+}
+return userReadTimeout;
+}
+
+private Long getIdleWriteTimeout() {
+Object writeTimeout = 
this.getUserProperties().get(Constants.WS_WRITE_IDLE_TIMEOUT);
+Long userWriteTimeout = null;

Review comment:
   No need for the additional reference here

##
File path: test/org/apache/tomcat/websocket/TestWsWebSocketContainer.java
##
@@ -779,6 +779,104 @@ public void testSessionExpirySession() throws Exception {
 Assert.assertEquals(0, getOpenCount(setA));
 }
 
+@Test
+public void testSessionExpiryOnUserPropertyReadIdleTimeout() throws 
Exception {
+final String readIdleTimeoutParameter = 
org.apache.tomcat.websocket.Constants.WS_READ_IDLE_TIMEOUT;
+
+Tomcat tomcat = getTomcatInstance();
+// No file system docBase required
+Context ctx = tomcat.addContext("", null);
+ctx.addApplicationListener(TesterEchoServer.Config.class.getName());
+Tomcat.addServlet(ctx, "default", new DefaultServlet());
+ctx.addServletMappingDecoded("/", "default");
+
+tomcat.start();
+
+// Need access to implementation methods for configuring unit tests
+WsWebSocketConta

[tomcat] branch 8.5.x updated: Use the correct method to calculate session idle time in PersistentValve

2020-09-01 Thread kfujino
This is an automated email from the ASF dual-hosted git repository.

kfujino 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 d98d5e6  Use the correct method to calculate session idle time in 
PersistentValve
d98d5e6 is described below

commit d98d5e6e563a85f6701f202d7bad240628ff8347
Author: KeiichiFujino 
AuthorDate: Tue Sep 1 21:39:55 2020 +0900

Use the correct method to calculate session idle time in PersistentValve
---
 java/org/apache/catalina/valves/PersistentValve.java | 3 +--
 webapps/docs/changelog.xml   | 4 
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/catalina/valves/PersistentValve.java 
b/java/org/apache/catalina/valves/PersistentValve.java
index 14ed90b..7734e26 100644
--- a/java/org/apache/catalina/valves/PersistentValve.java
+++ b/java/org/apache/catalina/valves/PersistentValve.java
@@ -215,8 +215,7 @@ public class PersistentValve extends ValveBase {
 if (session != null) {
 int maxInactiveInterval = session.getMaxInactiveInterval();
 if (maxInactiveInterval >= 0) {
-int timeIdle = // Truncate, do not round up
-(int) ((timeNow - session.getThisAccessedTime()) / 1000L);
+int timeIdle = (int) (session.getIdleTimeInternal() / 1000L);
 if (timeIdle >= maxInactiveInterval) {
 return true;
 }
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 00b91e1..2108bf2 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -91,6 +91,10 @@
 Added filtering expression for requests that are not supposed to use
 session in PersistentValve. (kfujino)
   
+  
+Use the correct method to calculate session idle time in
+PersistentValve. (kfujino)
+  
 
   
   


-
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: Use the correct method to calculate session idle time in PersistentValve

2020-09-01 Thread kfujino
This is an automated email from the ASF dual-hosted git repository.

kfujino 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 ae03ad5  Use the correct method to calculate session idle time in 
PersistentValve
ae03ad5 is described below

commit ae03ad53dc7a5b143af6e25cb480f3e9814f7b0b
Author: KeiichiFujino 
AuthorDate: Tue Sep 1 21:34:20 2020 +0900

Use the correct method to calculate session idle time in PersistentValve
---
 java/org/apache/catalina/valves/PersistentValve.java | 3 +--
 webapps/docs/changelog.xml   | 4 
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/catalina/valves/PersistentValve.java 
b/java/org/apache/catalina/valves/PersistentValve.java
index 14ed90b..7734e26 100644
--- a/java/org/apache/catalina/valves/PersistentValve.java
+++ b/java/org/apache/catalina/valves/PersistentValve.java
@@ -215,8 +215,7 @@ public class PersistentValve extends ValveBase {
 if (session != null) {
 int maxInactiveInterval = session.getMaxInactiveInterval();
 if (maxInactiveInterval >= 0) {
-int timeIdle = // Truncate, do not round up
-(int) ((timeNow - session.getThisAccessedTime()) / 1000L);
+int timeIdle = (int) (session.getIdleTimeInternal() / 1000L);
 if (timeIdle >= maxInactiveInterval) {
 return true;
 }
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 1e57e6f..3688578 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -97,6 +97,10 @@
 Added filtering expression for requests that are not supposed to use
 session in PersistentValve. (kfujino)
   
+  
+Use the correct method to calculate session idle time in
+PersistentValve. (kfujino)
+  
 
   
   


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



[tomcat] branch master updated: Fix path used by the health check valve

2020-09-01 Thread remm
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new 9609da1  Fix path used by the health check valve
9609da1 is described below

commit 9609da111f99ec387d64067d251669787620cff4
Author: remm 
AuthorDate: Tue Sep 1 14:29:58 2020 +0200

Fix path used by the health check valve

When not associated with a Context, it should use the full URI.
---
 .../apache/catalina/valves/HealthCheckValve.java   | 23 --
 webapps/docs/changelog.xml |  4 
 2 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/catalina/valves/HealthCheckValve.java 
b/java/org/apache/catalina/valves/HealthCheckValve.java
index 481e8bc..be9c487 100644
--- a/java/org/apache/catalina/valves/HealthCheckValve.java
+++ b/java/org/apache/catalina/valves/HealthCheckValve.java
@@ -20,6 +20,8 @@ import java.io.IOException;
 
 import jakarta.servlet.ServletException;
 
+import org.apache.catalina.Context;
+import org.apache.catalina.LifecycleException;
 import org.apache.catalina.connector.Request;
 import org.apache.catalina.connector.Response;
 import org.apache.tomcat.util.buf.MessageBytes;
@@ -35,8 +37,14 @@ public class HealthCheckValve extends ValveBase {
 "  \"status\": \"UP\",\n" +
 "  \"checks\": []\n" +
 "}";
+
 private String path = "/health";
 
+/**
+ * Will be set to true if the valve is associated with a context.
+ */
+protected boolean context = false;
+
 public HealthCheckValve() {
 super(true);
 }
@@ -50,10 +58,21 @@ public class HealthCheckValve extends ValveBase {
 }
 
 @Override
+protected synchronized void startInternal() throws LifecycleException {
+super.startInternal();
+if (getContainer() instanceof Context) {
+context = true;
+} else {
+context = false;
+}
+}
+
+@Override
 public void invoke(Request request, Response response)
 throws IOException, ServletException {
-MessageBytes requestPathMB = request.getRequestPathMB();
-if (requestPathMB.equals(path)) {
+MessageBytes urlMB =
+context ? request.getRequestPathMB() : 
request.getDecodedRequestURIMB();
+if (urlMB.equals(path)) {
 response.setContentType("application/json");
 response.getOutputStream().print(UP);
 } else {
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index dae52f6..d3327d7 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -101,6 +101,10 @@
 Use the correct method to calculate session idle time in
 PersistentValve. (kfujino)
   
+  
+Fix path used by the health check valve when it is not associated with
+a Context. (remm)
+  
 
   
   


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



[tomcat] branch master updated: Use the correct method to calculate session idle time in PersistentValve

2020-09-01 Thread kfujino
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new 0f1e263  Use the correct method to calculate session idle time in 
PersistentValve
0f1e263 is described below

commit 0f1e263073d97e562972e7a0a4f72d9c1698dbd4
Author: KeiichiFujino 
AuthorDate: Tue Sep 1 21:24:20 2020 +0900

Use the correct method to calculate session idle time in PersistentValve
---
 java/org/apache/catalina/valves/PersistentValve.java | 3 +--
 webapps/docs/changelog.xml   | 4 
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/catalina/valves/PersistentValve.java 
b/java/org/apache/catalina/valves/PersistentValve.java
index ac1df10..d3db2cd 100644
--- a/java/org/apache/catalina/valves/PersistentValve.java
+++ b/java/org/apache/catalina/valves/PersistentValve.java
@@ -215,8 +215,7 @@ public class PersistentValve extends ValveBase {
 if (session != null) {
 int maxInactiveInterval = session.getMaxInactiveInterval();
 if (maxInactiveInterval >= 0) {
-int timeIdle = // Truncate, do not round up
-(int) ((timeNow - session.getThisAccessedTime()) / 1000L);
+int timeIdle = (int) (session.getIdleTimeInternal() / 1000L);
 if (timeIdle >= maxInactiveInterval) {
 return true;
 }
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index a3daa60..dae52f6 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -97,6 +97,10 @@
 Added filtering expression for requests that are not supposed to use
 session in PersistentValve. (kfujino)
   
+  
+Use the correct method to calculate session idle time in
+PersistentValve. (kfujino)
+  
 
   
   


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



[GitHub] [tomcat] markt-asf commented on pull request #346: Bug 64644 add custom properties to close connections on readIdletimeout

2020-09-01 Thread GitBox


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


   No need for another PR. I'll just work directly on master.



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

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



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



[GitHub] [tomcat] sakshamverma commented on pull request #346: Bug 64644 add custom properties to close connections on readIdletimeout

2020-09-01 Thread GitBox


sakshamverma commented on pull request #346:
URL: https://github.com/apache/tomcat/pull/346#issuecomment-684738615


   @markt-asf 
   
   Thanks for your comment. 
   Do you want me to raise the PR for master branch? or would you be raising 
that with the tweaks you have in mind?



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

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



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



[GitHub] [tomcat] markt-asf commented on pull request #346: Bug 64644 add custom properties to close connections on readIdletimeout

2020-09-01 Thread GitBox


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


   Thanks for the updated PR. This needs to be applied to 10.0.x (master) first 
and then back-ported. There are also a few small things I'd like to tweak so 
I'll apply this manually rather than merging it. I'll start on that process now.



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

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



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



[GitHub] [tomcat] markt-asf closed pull request #340: Optimize server startup time

2020-09-01 Thread GitBox


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


   



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

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



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



[GitHub] [tomcat] markt-asf commented on pull request #340: Optimize server startup time

2020-09-01 Thread GitBox


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


   New PRs #348 and #349 submitted.



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

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



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



[GitHub] [tomcat] markt-asf commented on a change in pull request #348: Optimize server startup time using Bloom Filter

2020-09-01 Thread GitBox


markt-asf commented on a change in pull request #348:
URL: https://github.com/apache/tomcat/pull/348#discussion_r481007112



##
File path: java/org/apache/catalina/webresources/AbstractArchiveResourceSet.java
##
@@ -283,7 +310,7 @@ public final WebResource getResource(String path) {
 protected abstract boolean isMultiRelease();
 
 protected abstract WebResource createArchiveResource(JarEntry jarEntry,
-String webAppPath, Manifest manifest);
+ String webAppPath, 
Manifest manifest);

Review comment:
   Revert change to indent





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

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



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



[Bug 60030] Run away CPU with JSSE / OpenSSL with IE8

2020-09-01 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=60030

--- Comment #5 from Rory Meguri  ---
Banyak jenis keunggulan yang ada dalam situs bermain judi poker online di link
https://199.192.31.67  yang terpercaya ini pastiya kalian akan mendapatkan
bukti testimoni atau hasil kemenangan yang sudah di dapatkan beberapa member.
Semua member akan mendapatkan fasilitas yang sama antar satu dengan lainnya.
Anda juga dapat melihat secara langsung penggemar yang sedang aktif dan
menjalankan permainan di https://199.192.26.4. Bahkan kalian bisa memanfaatkan
berbagai jenis fasilitas layanan yang tersedia di dalamnya, akan ada seorang
admin customer service yang berjalan selama 24 jam penuh dan memberi kemudahan
kepada membernya.

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