Re: [PR] Add unit tests for AsyncStateMachine's asyncPostProcess method [tomcat]

2025-02-24 Thread via GitHub


markt-asf commented on PR #828:
URL: https://github.com/apache/tomcat/pull/828#issuecomment-2677681461

   The code coverage of `AsyncStateMachine` is already fairly good. I'd prefer 
to see some tests using real requests that exercised the few code paths 
(excluding trace level logging and `IllegalStateException`) that are not 
currently covered.


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

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

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


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



Re: [PR] Add unit tests for AsyncStateMachine's asyncPostProcess method [tomcat]

2025-02-24 Thread via GitHub


rmaucher commented on PR #828:
URL: https://github.com/apache/tomcat/pull/828#issuecomment-2677710733

   BTW, the code coverage report is here: 
https://nightlies.apache.org/tomcat/tomcat-12.0.x/coverage/index.html#dn-a
   It can be generated using test.coverage=true property in build.properties, 
to see improvements.


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

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

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


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



Re: [PR] BZ69504 move force recycle from log access method [tomcat]

2025-02-24 Thread via GitHub


markt-asf closed pull request #821: BZ69504 move force recycle from log access 
method
URL: https://github.com/apache/tomcat/pull/821


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

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

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


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



Re: [PR] BZ69504 move force recycle from log access method [tomcat]

2025-02-24 Thread via GitHub


markt-asf commented on PR #821:
URL: https://github.com/apache/tomcat/pull/821#issuecomment-2677711179

   I share Rémy's concerns. I see multiple concerns being addressed in this PR.
   Correct recycling is critical to the correct operation of Tomcat and log 
still recycles the request/response in some circumstances.
   
   I'm not against refactoring to make the code cleaner and/or clearer but this 
needs to be done in small steps that can be verified as the refactoring 
progresses.


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

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

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


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



(tomcat) 01/02: Add connection ID to the ExtendedAccessLogValve

2025-02-24 Thread markt
This is an automated email from the ASF dual-hosted git repository.

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

commit 987f737afe4f08da939d870b5b1ec4b96010d926
Author: Mark Thomas 
AuthorDate: Mon Feb 24 12:25:31 2025 +

Add connection ID to the ExtendedAccessLogValve
---
 java/org/apache/catalina/valves/ExtendedAccessLogValve.java | 8 
 webapps/docs/changelog.xml  | 6 ++
 webapps/docs/config/valve.xml   | 1 +
 3 files changed, 15 insertions(+)

diff --git a/java/org/apache/catalina/valves/ExtendedAccessLogValve.java 
b/java/org/apache/catalina/valves/ExtendedAccessLogValve.java
index 28e6d2e5c6..819096df0e 100644
--- a/java/org/apache/catalina/valves/ExtendedAccessLogValve.java
+++ b/java/org/apache/catalina/valves/ExtendedAccessLogValve.java
@@ -70,6 +70,7 @@ import org.apache.tomcat.util.ExceptionUtils;
  * For any of the x-H(...) the following method will be called from the 
HttpServletRequest object
  * x-H(authType): getAuthType
  * x-H(characterEncoding): getCharacterEncoding
+ * x-H(connectionId): getConnectionId
  * x-H(contentLength): getContentLength
  * x-H(locale): getLocale
  * x-H(protocol): getProtocol
@@ -767,6 +768,13 @@ public class ExtendedAccessLogValve extends AccessLogValve 
{
 buf.append(wrap("" + request.getContentLengthLong()));
 }
 };
+} else if ("connectionId".equals(parameter)) {
+return new AccessLogElement() {
+@Override
+public void addElement(CharArrayWriter buf, Date date, Request 
request, Response response, long time) {
+buf.append(wrap("" + 
request.getServletConnection().getConnectionId()));
+}
+};
 } else if ("characterEncoding".equals(parameter)) {
 return new AccessLogElement() {
 @Override
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index e24c2e8cc3..b9188c4249 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -159,6 +159,12 @@
 HttpServletRequest.login(String username, String password)
 when the realm is configured to use GSSAPI authentication. (markt)
   
+  
+Add support for logging the connection ID (as returned by
+ServletRequest.getServletConnection().getConnectionId())
+with the ExtendedAccessLogValve. Based on pull request
+814 by Dmole. (markt)
+  
 
   
   
diff --git a/webapps/docs/config/valve.xml b/webapps/docs/config/valve.xml
index da28586791..09c346563d 100644
--- a/webapps/docs/config/valve.xml
+++ b/webapps/docs/config/valve.xml
@@ -477,6 +477,7 @@
 
 x-H(authType): getAuthType 
 x-H(characterEncoding): getCharacterEncoding 
+x-H(connectionId): 
getServletConnection().getConnectionId
 x-H(contentLength): getContentLength 
 x-H(locale):  getLocale
 x-H(protocol): getProtocol 


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



(tomcat) 02/02: Add ConnectionID to AccessLogValve

2025-02-24 Thread markt
This is an automated email from the ASF dual-hosted git repository.

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

commit 3cfc9bc048109c5a566fc24539e5bb9759c114b6
Author: Mark Thomas 
AuthorDate: Mon Feb 24 12:55:08 2025 +

Add ConnectionID to AccessLogValve
---
 .../catalina/valves/AbstractAccessLogValve.java| 61 --
 webapps/docs/changelog.xml |  5 +-
 webapps/docs/config/valve.xml  |  2 +
 3 files changed, 61 insertions(+), 7 deletions(-)

diff --git a/java/org/apache/catalina/valves/AbstractAccessLogValve.java 
b/java/org/apache/catalina/valves/AbstractAccessLogValve.java
index a0f0163e9a..f6aeeb7e62 100644
--- a/java/org/apache/catalina/valves/AbstractAccessLogValve.java
+++ b/java/org/apache/catalina/valves/AbstractAccessLogValve.java
@@ -115,6 +115,8 @@ import org.apache.tomcat.util.net.IPv6Utils;
  * %{xxx}s xxx is an attribute in the HttpSession
  * %{xxx}t xxx is an enhanced SimpleDateFormat pattern (see 
Configuration Reference document for
  * details on supported time patterns)
+ * %{xxx}L xxx is the identifier to log (see Configuration 
Reference document for details on supported
+ * identifiers)
  * %{xxx}T xxx is the unit for the time taken to process the 
request (see Configuration Reference
  * document for details on supported units)
  * 
@@ -167,7 +169,12 @@ public abstract class AbstractAccessLogValve extends 
ValveBase implements Access
 PEER
 }
 
-// -- Constructor
+private enum IdentifierType {
+CONNECTION,
+UNKNOWN
+}
+
+
 public AbstractAccessLogValve() {
 super(true);
 }
@@ -1675,6 +1682,48 @@ public abstract class AbstractAccessLogValve extends 
ValveBase implements Access
 }
 }
 
+
+
+/**
+ * Write identifier element %{xxx}L
+ */
+protected class IdentifierElement implements AccessLogElement {
+
+/**
+ * Type of identifier to log
+ */
+private final IdentifierType identifierType;
+
+public IdentifierElement() {
+this(null);
+}
+
+
+public IdentifierElement(String type) {
+switch (type) {
+case "c":
+identifierType = IdentifierType.CONNECTION;
+break;
+default:
+
log.error(sm.getString("accessLogValve.invalidIdentifierType", type));
+identifierType = IdentifierType.UNKNOWN;
+break;
+}
+}
+
+@Override
+public void addElement(CharArrayWriter buf, Date date, Request 
request, Response response, long time) {
+switch(identifierType) {
+case CONNECTION:
+
buf.append(request.getServletConnection().getConnectionId());
+break;
+case UNKNOWN:
+buf.append("???");
+}
+}
+}
+
+
 /**
  * Parse pattern string and create the array of AccessLogElement.
  *
@@ -1747,14 +1796,16 @@ public abstract class AbstractAccessLogValve extends 
ValveBase implements Access
  */
 protected AccessLogElement createAccessLogElement(String name, char 
pattern) {
 switch (pattern) {
-case 'i':
-return new HeaderElement(name);
+case 'a':
+return new RemoteAddrElement(name);
 case 'c':
 return new CookieElement(name);
+case 'i':
+return new HeaderElement(name);
+case 'L':
+return new IdentifierElement(name);
 case 'o':
 return new ResponseHeaderElement(name);
-case 'a':
-return new RemoteAddrElement(name);
 case 'p':
 return new PortElement(name);
 case 'r':
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index b9188c4249..5f0741cc28 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -162,8 +162,9 @@
   
 Add support for logging the connection ID (as returned by
 ServletRequest.getServletConnection().getConnectionId())
-with the ExtendedAccessLogValve. Based on pull request
-814 by Dmole. (markt)
+with the AccessLogValve and
+ExtendedAccessLogValve. Based on pull request 814
+by Dmole. (markt)
   
 
   
diff --git a/webapps/docs/config/valve.xml b/webapps/docs/config/valve.xml
index 09c346563d..add9753ecf 100644
--- a/webapps/docs/config/valve.xml
+++ b/webapps/docs/config/valve.xml
@@ -337,6 +337,8 @@
 remote (client) port (xxx=remote)
 %{xxx}t write timestamp at the end of the request 
formatted using the
 enhanced SimpleDateFormat pattern xxx
+%{xxx}L write an identifier associated with the 

(tomcat) branch main updated (e3d05323c5 -> 3cfc9bc048)

2025-02-24 Thread markt
This is an automated email from the ASF dual-hosted git repository.

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


from e3d05323c5 Add specific test for TE parsing
 new 987f737afe Add connection ID to the ExtendedAccessLogValve
 new 3cfc9bc048 Add ConnectionID to AccessLogValve

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../catalina/valves/AbstractAccessLogValve.java| 61 --
 .../catalina/valves/ExtendedAccessLogValve.java|  8 +++
 webapps/docs/changelog.xml |  7 +++
 webapps/docs/config/valve.xml  |  3 ++
 4 files changed, 74 insertions(+), 5 deletions(-)


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



(tomcat) branch 11.0.x updated: Add ConnectionID to AccessLogValve

2025-02-24 Thread markt
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/11.0.x by this push:
 new 22b99bac65 Add ConnectionID to AccessLogValve
22b99bac65 is described below

commit 22b99bac657df05b3d228e0bca3a68aed9cb402b
Author: Mark Thomas 
AuthorDate: Mon Feb 24 12:55:08 2025 +

Add ConnectionID to AccessLogValve
---
 .../catalina/valves/AbstractAccessLogValve.java| 61 --
 webapps/docs/changelog.xml |  7 +++
 webapps/docs/config/valve.xml  |  2 +
 3 files changed, 65 insertions(+), 5 deletions(-)

diff --git a/java/org/apache/catalina/valves/AbstractAccessLogValve.java 
b/java/org/apache/catalina/valves/AbstractAccessLogValve.java
index a0f0163e9a..f6aeeb7e62 100644
--- a/java/org/apache/catalina/valves/AbstractAccessLogValve.java
+++ b/java/org/apache/catalina/valves/AbstractAccessLogValve.java
@@ -115,6 +115,8 @@ import org.apache.tomcat.util.net.IPv6Utils;
  * %{xxx}s xxx is an attribute in the HttpSession
  * %{xxx}t xxx is an enhanced SimpleDateFormat pattern (see 
Configuration Reference document for
  * details on supported time patterns)
+ * %{xxx}L xxx is the identifier to log (see Configuration 
Reference document for details on supported
+ * identifiers)
  * %{xxx}T xxx is the unit for the time taken to process the 
request (see Configuration Reference
  * document for details on supported units)
  * 
@@ -167,7 +169,12 @@ public abstract class AbstractAccessLogValve extends 
ValveBase implements Access
 PEER
 }
 
-// -- Constructor
+private enum IdentifierType {
+CONNECTION,
+UNKNOWN
+}
+
+
 public AbstractAccessLogValve() {
 super(true);
 }
@@ -1675,6 +1682,48 @@ public abstract class AbstractAccessLogValve extends 
ValveBase implements Access
 }
 }
 
+
+
+/**
+ * Write identifier element %{xxx}L
+ */
+protected class IdentifierElement implements AccessLogElement {
+
+/**
+ * Type of identifier to log
+ */
+private final IdentifierType identifierType;
+
+public IdentifierElement() {
+this(null);
+}
+
+
+public IdentifierElement(String type) {
+switch (type) {
+case "c":
+identifierType = IdentifierType.CONNECTION;
+break;
+default:
+
log.error(sm.getString("accessLogValve.invalidIdentifierType", type));
+identifierType = IdentifierType.UNKNOWN;
+break;
+}
+}
+
+@Override
+public void addElement(CharArrayWriter buf, Date date, Request 
request, Response response, long time) {
+switch(identifierType) {
+case CONNECTION:
+
buf.append(request.getServletConnection().getConnectionId());
+break;
+case UNKNOWN:
+buf.append("???");
+}
+}
+}
+
+
 /**
  * Parse pattern string and create the array of AccessLogElement.
  *
@@ -1747,14 +1796,16 @@ public abstract class AbstractAccessLogValve extends 
ValveBase implements Access
  */
 protected AccessLogElement createAccessLogElement(String name, char 
pattern) {
 switch (pattern) {
-case 'i':
-return new HeaderElement(name);
+case 'a':
+return new RemoteAddrElement(name);
 case 'c':
 return new CookieElement(name);
+case 'i':
+return new HeaderElement(name);
+case 'L':
+return new IdentifierElement(name);
 case 'o':
 return new ResponseHeaderElement(name);
-case 'a':
-return new RemoteAddrElement(name);
 case 'p':
 return new PortElement(name);
 case 'r':
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 24b96e60b5..044ffad14e 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -133,6 +133,13 @@
 Fix a bug in the JRE compatibility detection that incorrectly 
identified
 Java 19 and Java 20 as supporting Java 21 features. (markt)
   
+  
+Add support for logging the connection ID (as returned by
+ServletRequest.getServletConnection().getConnectionId())
+with the AccessLogValve and
+ExtendedAccessLogValve. Based on pull request 814
+by Dmole. (markt)
+  
 
   
   
diff --git a/webapps/docs/config/valve.xml b/webapps/docs/config/valve.xml
index da28586791..def558f94e 100644
--- a/webapps/docs/config/valve.xml
+++ b/webapps/docs/config/valve.xml
@@ -337,6

(tomcat) branch 10.1.x updated: Add ConnectionID to AccessLogValve

2025-02-24 Thread markt
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/10.1.x by this push:
 new 65551ce98f Add ConnectionID to AccessLogValve
65551ce98f is described below

commit 65551ce98f2a653f6b7045d1fca9a2ddafc3f374
Author: Mark Thomas 
AuthorDate: Mon Feb 24 12:55:08 2025 +

Add ConnectionID to AccessLogValve
---
 .../catalina/valves/AbstractAccessLogValve.java| 61 --
 webapps/docs/changelog.xml |  7 +++
 webapps/docs/config/valve.xml  |  2 +
 3 files changed, 65 insertions(+), 5 deletions(-)

diff --git a/java/org/apache/catalina/valves/AbstractAccessLogValve.java 
b/java/org/apache/catalina/valves/AbstractAccessLogValve.java
index 2b1b064ca8..b462ebc470 100644
--- a/java/org/apache/catalina/valves/AbstractAccessLogValve.java
+++ b/java/org/apache/catalina/valves/AbstractAccessLogValve.java
@@ -115,6 +115,8 @@ import org.apache.tomcat.util.net.IPv6Utils;
  * %{xxx}s xxx is an attribute in the HttpSession
  * %{xxx}t xxx is an enhanced SimpleDateFormat pattern (see 
Configuration Reference document for
  * details on supported time patterns)
+ * %{xxx}L xxx is the identifier to log (see Configuration 
Reference document for details on supported
+ * identifiers)
  * %{xxx}T xxx is the unit for the time taken to process the 
request (see Configuration Reference
  * document for details on supported units)
  * 
@@ -167,7 +169,12 @@ public abstract class AbstractAccessLogValve extends 
ValveBase implements Access
 PEER
 }
 
-// -- Constructor
+private enum IdentifierType {
+CONNECTION,
+UNKNOWN
+}
+
+
 public AbstractAccessLogValve() {
 super(true);
 }
@@ -1677,6 +1684,48 @@ public abstract class AbstractAccessLogValve extends 
ValveBase implements Access
 }
 }
 
+
+
+/**
+ * Write identifier element %{xxx}L
+ */
+protected class IdentifierElement implements AccessLogElement {
+
+/**
+ * Type of identifier to log
+ */
+private final IdentifierType identifierType;
+
+public IdentifierElement() {
+this(null);
+}
+
+
+public IdentifierElement(String type) {
+switch (type) {
+case "c":
+identifierType = IdentifierType.CONNECTION;
+break;
+default:
+
log.error(sm.getString("accessLogValve.invalidIdentifierType", type));
+identifierType = IdentifierType.UNKNOWN;
+break;
+}
+}
+
+@Override
+public void addElement(CharArrayWriter buf, Date date, Request 
request, Response response, long time) {
+switch(identifierType) {
+case CONNECTION:
+
buf.append(request.getServletConnection().getConnectionId());
+break;
+case UNKNOWN:
+buf.append("???");
+}
+}
+}
+
+
 /**
  * Parse pattern string and create the array of AccessLogElement.
  *
@@ -1749,14 +1798,16 @@ public abstract class AbstractAccessLogValve extends 
ValveBase implements Access
  */
 protected AccessLogElement createAccessLogElement(String name, char 
pattern) {
 switch (pattern) {
-case 'i':
-return new HeaderElement(name);
+case 'a':
+return new RemoteAddrElement(name);
 case 'c':
 return new CookieElement(name);
+case 'i':
+return new HeaderElement(name);
+case 'L':
+return new IdentifierElement(name);
 case 'o':
 return new ResponseHeaderElement(name);
-case 'a':
-return new RemoteAddrElement(name);
 case 'p':
 return new PortElement(name);
 case 'r':
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 8ad82411bd..1e358d206e 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -133,6 +133,13 @@
 Improve the checks for exposure to and protection against 
CVE-2024-56337
 so that reflection is not used unless required. (markt)
   
+  
+Add support for logging the connection ID (as returned by
+ServletRequest.getServletConnection().getConnectionId())
+with the AccessLogValve and
+ExtendedAccessLogValve. Based on pull request 814
+by Dmole. (markt)
+  
 
   
   
diff --git a/webapps/docs/config/valve.xml b/webapps/docs/config/valve.xml
index 1c9ae867b8..24963a9938 100644
--- a/webapps/docs/config/valve.xml
+++ b/webapps/docs/config/valve.xml
@@ -337,6 +33

(tomcat) branch 11.0.x updated: Add connection ID to the ExtendedAccessLogValve

2025-02-24 Thread markt
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/11.0.x by this push:
 new 3b0ba0fce3 Add connection ID to the ExtendedAccessLogValve
3b0ba0fce3 is described below

commit 3b0ba0fce33de9dea4f4d9ab109c018a2662868f
Author: Mark Thomas 
AuthorDate: Mon Feb 24 12:25:31 2025 +

Add connection ID to the ExtendedAccessLogValve
---
 java/org/apache/catalina/valves/ExtendedAccessLogValve.java | 8 
 webapps/docs/config/valve.xml   | 1 +
 2 files changed, 9 insertions(+)

diff --git a/java/org/apache/catalina/valves/ExtendedAccessLogValve.java 
b/java/org/apache/catalina/valves/ExtendedAccessLogValve.java
index 28e6d2e5c6..819096df0e 100644
--- a/java/org/apache/catalina/valves/ExtendedAccessLogValve.java
+++ b/java/org/apache/catalina/valves/ExtendedAccessLogValve.java
@@ -70,6 +70,7 @@ import org.apache.tomcat.util.ExceptionUtils;
  * For any of the x-H(...) the following method will be called from the 
HttpServletRequest object
  * x-H(authType): getAuthType
  * x-H(characterEncoding): getCharacterEncoding
+ * x-H(connectionId): getConnectionId
  * x-H(contentLength): getContentLength
  * x-H(locale): getLocale
  * x-H(protocol): getProtocol
@@ -767,6 +768,13 @@ public class ExtendedAccessLogValve extends AccessLogValve 
{
 buf.append(wrap("" + request.getContentLengthLong()));
 }
 };
+} else if ("connectionId".equals(parameter)) {
+return new AccessLogElement() {
+@Override
+public void addElement(CharArrayWriter buf, Date date, Request 
request, Response response, long time) {
+buf.append(wrap("" + 
request.getServletConnection().getConnectionId()));
+}
+};
 } else if ("characterEncoding".equals(parameter)) {
 return new AccessLogElement() {
 @Override
diff --git a/webapps/docs/config/valve.xml b/webapps/docs/config/valve.xml
index def558f94e..add9753ecf 100644
--- a/webapps/docs/config/valve.xml
+++ b/webapps/docs/config/valve.xml
@@ -479,6 +479,7 @@
 
 x-H(authType): getAuthType 
 x-H(characterEncoding): getCharacterEncoding 
+x-H(connectionId): 
getServletConnection().getConnectionId
 x-H(contentLength): getContentLength 
 x-H(locale):  getLocale
 x-H(protocol): getProtocol 


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



(tomcat) branch 10.1.x updated: Add connection ID to the ExtendedAccessLogValve

2025-02-24 Thread markt
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/10.1.x by this push:
 new fe3409fd2f Add connection ID to the ExtendedAccessLogValve
fe3409fd2f is described below

commit fe3409fd2f64b97ecf0af519ea4c148c4ff3d509
Author: Mark Thomas 
AuthorDate: Mon Feb 24 12:25:31 2025 +

Add connection ID to the ExtendedAccessLogValve
---
 java/org/apache/catalina/valves/ExtendedAccessLogValve.java | 8 
 webapps/docs/config/valve.xml   | 1 +
 2 files changed, 9 insertions(+)

diff --git a/java/org/apache/catalina/valves/ExtendedAccessLogValve.java 
b/java/org/apache/catalina/valves/ExtendedAccessLogValve.java
index 936ab5c2cc..17143c6f98 100644
--- a/java/org/apache/catalina/valves/ExtendedAccessLogValve.java
+++ b/java/org/apache/catalina/valves/ExtendedAccessLogValve.java
@@ -70,6 +70,7 @@ import org.apache.tomcat.util.ExceptionUtils;
  * For any of the x-H(...) the following method will be called from the 
HttpServletRequest object
  * x-H(authType): getAuthType
  * x-H(characterEncoding): getCharacterEncoding
+ * x-H(connectionId): getConnectionId
  * x-H(contentLength): getContentLength
  * x-H(locale): getLocale
  * x-H(protocol): getProtocol
@@ -761,6 +762,13 @@ public class ExtendedAccessLogValve extends AccessLogValve 
{
 buf.append(wrap("" + request.getContentLengthLong()));
 }
 };
+} else if ("connectionId".equals(parameter)) {
+return new AccessLogElement() {
+@Override
+public void addElement(CharArrayWriter buf, Date date, Request 
request, Response response, long time) {
+buf.append(wrap("" + 
request.getServletConnection().getConnectionId()));
+}
+};
 } else if ("characterEncoding".equals(parameter)) {
 return new AccessLogElement() {
 @Override
diff --git a/webapps/docs/config/valve.xml b/webapps/docs/config/valve.xml
index 24963a9938..d4d461c717 100644
--- a/webapps/docs/config/valve.xml
+++ b/webapps/docs/config/valve.xml
@@ -479,6 +479,7 @@
 
 x-H(authType): getAuthType 
 x-H(characterEncoding): getCharacterEncoding 
+x-H(connectionId): 
getServletConnection().getConnectionId
 x-H(contentLength): getContentLength 
 x-H(locale):  getLocale
 x-H(protocol): getProtocol 


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



Re: [PR] log connectionId [tomcat]

2025-02-24 Thread via GitHub


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


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

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

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


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



Re: [PR] log connectionId [tomcat]

2025-02-24 Thread via GitHub


markt-asf commented on PR #814:
URL: https://github.com/apache/tomcat/pull/814#issuecomment-2678517529

   Manually applied as there were a few things I needed to add/change
   - %{xxx}L is for ID attributes not connection attributes
   - new settings needed to be added to the docs
   - change log entry was required
   - The CachedElement interface does not apply here


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

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

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


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



Re: [PR] log connectionId [tomcat]

2025-02-24 Thread via GitHub


Dmole commented on PR #814:
URL: https://github.com/apache/tomcat/pull/814#issuecomment-2678622306

   
https://github.com/apache/tomcat/commit/3cfc9bc048109c5a566fc24539e5bb9759c114b6
   
   
https://github.com/apache/tomcat/commit/987f737afe4f08da939d870b5b1ec4b96010d926


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

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

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


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



[PR] Fix info-then-debug logging in Http2UpgradeHandler [tomcat]

2025-02-24 Thread via GitHub


bergander opened a new pull request, #830:
URL: https://github.com/apache/tomcat/pull/830

   Fix info-then-debug logging in `Http2UpgradeHandler` by making the 
`UserDataHelper` static. Otherwise the _lastInfoTime_ in `UserDataHelper` will 
be per HTTP2-connection, but it should be a global scoped timestamp.
   
   This also makes it consistant with how `UserDataHelper` is used in `Cookie`.


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

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

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


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



[Bug 69479] The HTTP2 header data is confused in H2C, resulting in parsing failure

2025-02-24 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=69479

--- Comment #10 from Thomas  ---
Please see the repo for the test case to reproduce the problem.
https://github.com/qingdaoheze/tomcat-header-mix

One solution to resolve the problem:
https://github.com/qingdaoheze/tomcat/pull/1

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



[Bug 69479] The HTTP2 header data is confused in H2C, resulting in parsing failure

2025-02-24 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=69479

--- Comment #11 from Remy Maucherat  ---
(In reply to Thomas from comment #10)
> Please see the repo for the test case to reproduce the problem.
> https://github.com/qingdaoheze/tomcat-header-mix
> 
> One solution to resolve the problem:
> https://github.com/qingdaoheze/tomcat/pull/1

This is wrong, so this change will not be considered.

However, your investigations might demonstrate that the current implementation
of removeHeader has bad side effects.

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



[Bug 69479] The HTTP2 header data is confused in H2C, resulting in parsing failure

2025-02-24 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=69479

--- Comment #12 from Thomas  ---
OK, so you will give the better solution, right?

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



Re: [PR] Fix info-then-debug logging in Http2UpgradeHandler [tomcat]

2025-02-24 Thread via GitHub


markt-asf commented on PR #830:
URL: https://github.com/apache/tomcat/pull/830#issuecomment-2679115250

   Tx. Well-spotted.


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

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

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


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



(tomcat) branch 11.0.x updated: Fix info-then-debug logging in Http2UpgradeHandler by making the UserDataHelper static (#830)

2025-02-24 Thread markt
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/11.0.x by this push:
 new 3b1019df74 Fix info-then-debug logging in Http2UpgradeHandler by 
making the UserDataHelper static (#830)
3b1019df74 is described below

commit 3b1019df74d08ad42a32d750370bbb1beac1c021
Author: bergander 
AuthorDate: Mon Feb 24 18:05:09 2025 +0100

Fix info-then-debug logging in Http2UpgradeHandler by making the 
UserDataHelper static (#830)
---
 java/org/apache/coyote/http2/Http2UpgradeHandler.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/coyote/http2/Http2UpgradeHandler.java 
b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
index 6a496ca918..5883095240 100644
--- a/java/org/apache/coyote/http2/Http2UpgradeHandler.java
+++ b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
@@ -89,6 +89,8 @@ class Http2UpgradeHandler extends AbstractStream implements 
InternalHttpUpgradeH
 
 protected static final HeaderSink HEADER_SINK = new HeaderSink();
 
+protected static final UserDataHelper userDataHelper = new 
UserDataHelper(log);
+
 protected final String connectionId;
 
 protected final Http2Protocol protocol;
@@ -136,8 +138,6 @@ class Http2UpgradeHandler extends AbstractStream implements 
InternalHttpUpgradeH
 private volatile int lastNonFinalDataPayload;
 private volatile int lastWindowUpdate;
 
-protected final UserDataHelper userDataHelper = new UserDataHelper(log);
-
 
 Http2UpgradeHandler(Http2Protocol protocol, Adapter adapter, Request 
coyoteRequest,
 SocketWrapperBase socketWrapper) {


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



Re: [PR] Fix info-then-debug logging in Http2UpgradeHandler [tomcat]

2025-02-24 Thread via GitHub


markt-asf merged PR #830:
URL: https://github.com/apache/tomcat/pull/830


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

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

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


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



(tomcat) branch 10.1.x updated: Fix info-then-debug logging in Http2UpgradeHandler by making the UserDataHelper static (#830)

2025-02-24 Thread markt
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/10.1.x by this push:
 new 8f59b0b3c2 Fix info-then-debug logging in Http2UpgradeHandler by 
making the UserDataHelper static (#830)
8f59b0b3c2 is described below

commit 8f59b0b3c20d405a5b3df59f3771efff06a6a4e0
Author: bergander 
AuthorDate: Mon Feb 24 18:05:09 2025 +0100

Fix info-then-debug logging in Http2UpgradeHandler by making the 
UserDataHelper static (#830)
---
 java/org/apache/coyote/http2/Http2UpgradeHandler.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/coyote/http2/Http2UpgradeHandler.java 
b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
index a2e6fedf80..cd22268304 100644
--- a/java/org/apache/coyote/http2/Http2UpgradeHandler.java
+++ b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
@@ -89,6 +89,8 @@ class Http2UpgradeHandler extends AbstractStream implements 
InternalHttpUpgradeH
 
 protected static final HeaderSink HEADER_SINK = new HeaderSink();
 
+protected static final UserDataHelper userDataHelper = new 
UserDataHelper(log);
+
 protected final String connectionId;
 
 protected final Http2Protocol protocol;
@@ -137,8 +139,6 @@ class Http2UpgradeHandler extends AbstractStream implements 
InternalHttpUpgradeH
 private volatile int lastNonFinalDataPayload;
 private volatile int lastWindowUpdate;
 
-protected final UserDataHelper userDataHelper = new UserDataHelper(log);
-
 
 Http2UpgradeHandler(Http2Protocol protocol, Adapter adapter, Request 
coyoteRequest,
 SocketWrapperBase socketWrapper) {


-
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 info-then-debug logging in Http2UpgradeHandler by making the UserDataHelper static (#830)

2025-02-24 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 5c00c0be74 Fix info-then-debug logging in Http2UpgradeHandler by 
making the UserDataHelper static (#830)
5c00c0be74 is described below

commit 5c00c0be7447020c2e7192ce25df71454cf4c4b0
Author: bergander 
AuthorDate: Mon Feb 24 18:05:09 2025 +0100

Fix info-then-debug logging in Http2UpgradeHandler by making the 
UserDataHelper static (#830)
---
 java/org/apache/coyote/http2/Http2UpgradeHandler.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/coyote/http2/Http2UpgradeHandler.java 
b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
index a45a3547b8..581319cb75 100644
--- a/java/org/apache/coyote/http2/Http2UpgradeHandler.java
+++ b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
@@ -89,6 +89,8 @@ class Http2UpgradeHandler extends AbstractStream implements 
InternalHttpUpgradeH
 
 protected static final HeaderSink HEADER_SINK = new HeaderSink();
 
+protected static final UserDataHelper userDataHelper = new 
UserDataHelper(log);
+
 protected final String connectionId;
 
 protected final Http2Protocol protocol;
@@ -137,8 +139,6 @@ class Http2UpgradeHandler extends AbstractStream implements 
InternalHttpUpgradeH
 private volatile int lastNonFinalDataPayload;
 private volatile int lastWindowUpdate;
 
-protected final UserDataHelper userDataHelper = new UserDataHelper(log);
-
 
 Http2UpgradeHandler(Http2Protocol protocol, Adapter adapter, Request 
coyoteRequest) {
 super(STREAM_ID_ZERO);


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



(tomcat) branch main updated: Fix info-then-debug logging in Http2UpgradeHandler by making the UserDataHelper static (#830)

2025-02-24 Thread markt
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/main by this push:
 new 688e6cc286 Fix info-then-debug logging in Http2UpgradeHandler by 
making the UserDataHelper static (#830)
688e6cc286 is described below

commit 688e6cc286733a3c7405b61df341280d60d2641a
Author: bergander 
AuthorDate: Mon Feb 24 18:05:09 2025 +0100

Fix info-then-debug logging in Http2UpgradeHandler by making the 
UserDataHelper static (#830)
---
 java/org/apache/coyote/http2/Http2UpgradeHandler.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/coyote/http2/Http2UpgradeHandler.java 
b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
index 6a496ca918..5883095240 100644
--- a/java/org/apache/coyote/http2/Http2UpgradeHandler.java
+++ b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
@@ -89,6 +89,8 @@ class Http2UpgradeHandler extends AbstractStream implements 
InternalHttpUpgradeH
 
 protected static final HeaderSink HEADER_SINK = new HeaderSink();
 
+protected static final UserDataHelper userDataHelper = new 
UserDataHelper(log);
+
 protected final String connectionId;
 
 protected final Http2Protocol protocol;
@@ -136,8 +138,6 @@ class Http2UpgradeHandler extends AbstractStream implements 
InternalHttpUpgradeH
 private volatile int lastNonFinalDataPayload;
 private volatile int lastWindowUpdate;
 
-protected final UserDataHelper userDataHelper = new UserDataHelper(log);
-
 
 Http2UpgradeHandler(Http2Protocol protocol, Adapter adapter, Request 
coyoteRequest,
 SocketWrapperBase socketWrapper) {


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



[Bug 69479] The HTTP2 header data is confused in H2C, resulting in parsing failure

2025-02-24 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=69479

Mark Thomas  changed:

   What|Removed |Added

 Status|NEEDINFO|NEW

--- Comment #13 from Mark Thomas  ---
I agree with Rémy that the proposed fix doesn't look right.

We will take a look at the test case (thank you for that) and update the issue
when we have some useful information to report.

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



[Bug 69479] The HTTP2 header data is confused in H2C, resulting in parsing failure

2025-02-24 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=69479

Mark Thomas  changed:

   What|Removed |Added

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

--- Comment #14 from Mark Thomas  ---
9.0.65 was released in July 2022.

When this issue was opened you were asked to test with the current Tomcat 9 by
multiple committers.

Some 3 months after this issue was opened and a test case provided it took me
less than 20 minutes to reproduce the issue with 9.0.65, update to 9.0.100 and
see that the issue no longer occurs.

When we ask people to test with the latest version, it isn't an attempt to fob
them off. It is a recognition that Tomcat has bugs, those bugs get fixed and
that over a period of more than 2 years quite a few bugs will have been fixed.

If you are using an old version we don't want to waste our time investigating
an issue that has already been fixed and you don't have to waste your time if a
fix is already available.

If I had to guess at which fix it was in the changelog, my guess would be this
fix from 9.0.79:

"Correct a race condition that could cause spurious RST messages to be sent
after the response had been written to an HTTP/2 stream."

but I haven't done anything to confirm that.

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