[Bug 65851] DefaultServlet.checkIfNoneMatch return 400

2022-02-16 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=65851

james  changed:

   What|Removed |Added

 Resolution|INVALID |FIXED

--- Comment #5 from james  ---
Thanks for reply, the application is causing the problem:

before xss filter:
If-None-Match: W/"30248-1644904299670" 

after xss filter:
If-None-Match: W/“30248-1644904299670“

Because " escape to “,HttpParser parse value is null, and response send error
400, but tomcat 8.5.57 don't send error,   8.5.73-75 send error.


// Note: RFC 2616 allowed quoted string
//   RFC 7232 does not allow " in the entity-tag
String value = HttpParser.readQuotedString(input, true);

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



ULRStreamHandlerFactory proposal

2022-02-16 Thread Raymond Augé
Hello all,

There has been a long standing limitation in the JDK w.r.t. the handling of
URLStreamHandlerFactory. Beyond Java 17 this API becomes even more locked
down making dynamic use cases or coordination among frameworks next to
impossible. It appears unlikely to ever be resolved in the JDK.

The OSGi community shares a desire [1] (with others in the wider Java
community) to address this. We were thinking this might happen in a way
that Tomcat may benefit from, since it appears to also have the same issue
[2].

Here is the idea.

We thought that a library could become the de facto implementation which,
by acting as the primordial URLStreamHandlerFactory (which directly
integrates with the JVM), provides the dynamism necessary for any number of
downstream consumers are able to orchestrate a set of protocol handlers
without clobbering everyone else or worse failing outright in those
scenarios where someone else beat you to the punch.

How might this be accomplished? Tom Watson from IBM suggested that by
providing a protocol of it's own which one could obtain by doing something
like `new URL("ushfm:").openConnection()` returning an instance which is
castable (or used reflectively) to a management-like interface.

We imagined that such a library could potentially replace the current
implementation in tomcat, or at least help it to accomplish its goals. This
would enable scenarios where OSGi is embedded in a WAR (my company for
instance), or where tomcat is embedded (and that env already has said
library deployed) or any combination of those. Of course there is room here
for all fallbacks to kick in. If the "lookup" fails, then obviously there
is no such implementation present and you keep doing what you were doing.

Ideally such a library would live in an open source project where there is
credibility for a wide audience, such as Apache.

Thoughts?

Ray

[1] https://github.com/osgi/osgi/issues/226
[2]
https://github.com/apache/tomcat/blob/9.0.x/java/org/apache/catalina/webresources/TomcatURLStreamHandlerFactory.java


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

2022-02-16 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 14129d1  Align with 9.0.x
14129d1 is described below

commit 14129d1ef2e8b4f6a0302aca28d26d1fdb072743
Author: Mark Thomas 
AuthorDate: Wed Feb 16 20:25:28 2022 +

Align with 9.0.x
---
 java/org/apache/tomcat/util/net/AbstractEndpoint.java | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/java/org/apache/tomcat/util/net/AbstractEndpoint.java 
b/java/org/apache/tomcat/util/net/AbstractEndpoint.java
index 9b9102c..1ce26b7 100644
--- a/java/org/apache/tomcat/util/net/AbstractEndpoint.java
+++ b/java/org/apache/tomcat/util/net/AbstractEndpoint.java
@@ -449,7 +449,7 @@ public abstract class AbstractEndpoint {
  * Unused.
  *
  * @deprecated  This attribute is hard-coded to {@code 1} and is no longer
- *  configurable.
+ *  configurable. It will be removed in Tomcat 10.1.
  */
 @Deprecated
 protected int acceptorThreadCount = 1;
@@ -460,7 +460,7 @@ public abstract class AbstractEndpoint {
  * @param acceptorThreadCount   Ignored
  *
  * @deprecated  This attribute is hard-coded to {@code 1} and is no longer
- *  configurable.
+ *  configurable. This setter will be removed in Tomcat 10.
  */
 @Deprecated
 public void setAcceptorThreadCount(int acceptorThreadCount) {
@@ -473,7 +473,7 @@ public abstract class AbstractEndpoint {
  * @return  Always returns {@code 1}
  *
  * @deprecated  This attribute is hard-coded to {@code 1} and is no longer
- *  configurable.
+ *  configurable. This getter will be removed in Tomcat 10.
  */
 @Deprecated
 public int getAcceptorThreadCount() {

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



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

2022-02-16 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 2d82048  Align with 8.5.x
2d82048 is described below

commit 2d82048126b4bb0a651f1618bbe18655825f11bb
Author: Mark Thomas 
AuthorDate: Wed Feb 16 20:25:07 2022 +

Align with 8.5.x
---
 .../apache/tomcat/util/net/AbstractEndpoint.java   | 28 +++---
 1 file changed, 19 insertions(+), 9 deletions(-)

diff --git a/java/org/apache/tomcat/util/net/AbstractEndpoint.java 
b/java/org/apache/tomcat/util/net/AbstractEndpoint.java
index 98f07e7..6ff8ada 100644
--- a/java/org/apache/tomcat/util/net/AbstractEndpoint.java
+++ b/java/org/apache/tomcat/util/net/AbstractEndpoint.java
@@ -464,29 +464,39 @@ public abstract class AbstractEndpoint {
 
 
 /**
- * Acceptor thread count.
+ * Unused.
+ *
+ * @deprecated  This attribute is hard-coded to {@code 1} and is no longer
+ *  configurable. It will be removed in Tomcat 10.1.
  */
+@Deprecated
 protected int acceptorThreadCount = 1;
 
 /**
- * NO-OP.
+ * Unused.
  *
- * @param acceptorThreadCount Unused
+ * @param acceptorThreadCount   Ignored
  *
- * @deprecated Will be removed in Tomcat 10.
+ * @deprecated  This attribute is hard-coded to {@code 1} and is no longer
+ *  configurable. This setter will be removed in Tomcat 10.
  */
 @Deprecated
-public void setAcceptorThreadCount(int acceptorThreadCount) {}
+public void setAcceptorThreadCount(int acceptorThreadCount) {
+// NO-OP;
+}
 
 /**
- * Always returns 1.
+ * Unused.
  *
- * @return Always 1.
+ * @return  Always returns {@code 1}
  *
- * @deprecated Will be removed in Tomcat 10.
+ * @deprecated  This attribute is hard-coded to {@code 1} and is no longer
+ *  configurable. This getter will be removed in Tomcat 10.
  */
 @Deprecated
-public int getAcceptorThreadCount() { return 1; }
+public int getAcceptorThreadCount() {
+return 1;
+}
 
 
 /**

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



[tomcat] branch 10.0.x updated: Deprecate unsued field

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

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


The following commit(s) were added to refs/heads/10.0.x by this push:
 new 8a73bd4  Deprecate unsued field
8a73bd4 is described below

commit 8a73bd4a6e94c1289668d012d36b7acc328e02ec
Author: Mark Thomas 
AuthorDate: Wed Feb 16 20:24:39 2022 +

Deprecate unsued field
---
 java/org/apache/tomcat/util/net/AbstractEndpoint.java | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/tomcat/util/net/AbstractEndpoint.java 
b/java/org/apache/tomcat/util/net/AbstractEndpoint.java
index 92b392e..572901a 100644
--- a/java/org/apache/tomcat/util/net/AbstractEndpoint.java
+++ b/java/org/apache/tomcat/util/net/AbstractEndpoint.java
@@ -453,8 +453,12 @@ public abstract class AbstractEndpoint {
 
 
 /**
- * Acceptor thread count.
+ * Unused.
+ *
+ * @deprecated  This attribute is hard-coded to {@code 1} and is no longer
+ *  configurable. It will be removed in Tomcat 10.1.
  */
+@Deprecated
 protected int acceptorThreadCount = 1;
 
 

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



[tomcat] branch main updated: Remove unused, deprecated field

2022-02-16 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 a82e8c6  Remove unused, deprecated field
a82e8c6 is described below

commit a82e8c6c887eacc04062a94f26ff8c935e39d934
Author: Mark Thomas 
AuthorDate: Wed Feb 16 20:23:59 2022 +

Remove unused, deprecated field
---
 java/org/apache/tomcat/util/net/AbstractEndpoint.java | 6 --
 1 file changed, 6 deletions(-)

diff --git a/java/org/apache/tomcat/util/net/AbstractEndpoint.java 
b/java/org/apache/tomcat/util/net/AbstractEndpoint.java
index e2875c1..da280ce 100644
--- a/java/org/apache/tomcat/util/net/AbstractEndpoint.java
+++ b/java/org/apache/tomcat/util/net/AbstractEndpoint.java
@@ -453,12 +453,6 @@ public abstract class AbstractEndpoint {
 
 
 /**
- * Acceptor thread count.
- */
-protected int acceptorThreadCount = 1;
-
-
-/**
  * Priority of the acceptor threads.
  */
 protected int acceptorThreadPriority = Thread.NORM_PRIORITY;

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



[tomcat] branch 8.5.x updated: Align with 9.0.x onwards

2022-02-16 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 e7d446b  Align with 9.0.x onwards
e7d446b is described below

commit e7d446bae35f5a0ef6bca294c336158b784f6390
Author: Mark Thomas 
AuthorDate: Wed Feb 16 19:58:46 2022 +

Align with 9.0.x onwards
---
 java/org/apache/tomcat/util/net/Nio2Channel.java |  5 ++---
 java/org/apache/tomcat/util/net/NioChannel.java  | 10 --
 2 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/java/org/apache/tomcat/util/net/Nio2Channel.java 
b/java/org/apache/tomcat/util/net/Nio2Channel.java
index bc5a8b3..f5dd0f3 100644
--- a/java/org/apache/tomcat/util/net/Nio2Channel.java
+++ b/java/org/apache/tomcat/util/net/Nio2Channel.java
@@ -35,9 +35,9 @@ public class Nio2Channel implements AsynchronousByteChannel {
 
 protected static final ByteBuffer emptyBuf = ByteBuffer.allocate(0);
 
+protected final SocketBufferHandler bufHandler;
 protected AsynchronousSocketChannel sc = null;
 protected SocketWrapperBase socket = null;
-protected final SocketBufferHandler bufHandler;
 
 public Nio2Channel(SocketBufferHandler bufHandler) {
 this.bufHandler = bufHandler;
@@ -135,7 +135,7 @@ public class Nio2Channel implements AsynchronousByteChannel 
{
 
 @Override
 public String toString() {
-return super.toString()+":"+this.sc.toString();
+return super.toString() + ":" + sc.toString();
 }
 
 @Override
@@ -213,7 +213,6 @@ public class Nio2Channel implements AsynchronousByteChannel 
{
 return DONE;
 }
 
-
 private ApplicationBufferHandler appReadBufHandler;
 public void setAppReadBufHandler(ApplicationBufferHandler handler) {
 this.appReadBufHandler = handler;
diff --git a/java/org/apache/tomcat/util/net/NioChannel.java 
b/java/org/apache/tomcat/util/net/NioChannel.java
index 9b9509f..8f97802 100644
--- a/java/org/apache/tomcat/util/net/NioChannel.java
+++ b/java/org/apache/tomcat/util/net/NioChannel.java
@@ -39,10 +39,10 @@ public class NioChannel implements ByteChannel, 
ScatteringByteChannel, Gathering
 
 protected static final ByteBuffer emptyBuf = ByteBuffer.allocate(0);
 
+protected final SocketBufferHandler bufHandler;
 protected SocketChannel sc = null;
 protected SocketWrapperBase socketWrapper = null;
 
-protected final SocketBufferHandler bufHandler;
 
 protected Poller poller;
 
@@ -110,11 +110,10 @@ public class NioChannel implements ByteChannel, 
ScatteringByteChannel, Gathering
  * Close the connection.
  *
  * @param force Should the underlying socket be forcibly closed?
- *
  * @throws IOException If closing the secure channel fails.
  */
 public void close(boolean force) throws IOException {
-if (isOpen() || force ) {
+if (isOpen() || force) {
 close();
 }
 }
@@ -229,7 +228,7 @@ public class NioChannel implements ByteChannel, 
ScatteringByteChannel, Gathering
 
 @Override
 public String toString() {
-return super.toString()+":"+this.sc.toString();
+return super.toString() + ":" + sc.toString();
 }
 
 public int getOutboundRemaining() {
@@ -240,7 +239,6 @@ public class NioChannel implements ByteChannel, 
ScatteringByteChannel, Gathering
  * Return true if the buffer wrote data. NO-OP for non-secure channel.
  *
  * @return Always returns {@code false} for non-secure channel
- *
  * @throws IOException Never for non-secure channel
  */
 public boolean flushOutbound() throws IOException {
@@ -256,6 +254,7 @@ public class NioChannel implements ByteChannel, 
ScatteringByteChannel, Gathering
  * socket is removed from the poller without the socket being selected. 
This
  * results in a connection limit leak for NIO as the endpoint expects the
  * socket to be selected even in error conditions.
+ *
  * @throws IOException If the current thread was interrupted
  */
 protected void checkInterruptStatus() throws IOException {
@@ -264,7 +263,6 @@ public class NioChannel implements ByteChannel, 
ScatteringByteChannel, Gathering
 }
 }
 
-
 private ApplicationBufferHandler appReadBufHandler;
 public void setAppReadBufHandler(ApplicationBufferHandler handler) {
 this.appReadBufHandler = handler;

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



[tomcat] branch 8.5.x updated: Align with 9.0.x onwards

2022-02-16 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 496b19a  Align with 9.0.x onwards
496b19a is described below

commit 496b19a42fba7ae18457577da35149940591df85
Author: Mark Thomas 
AuthorDate: Wed Feb 16 19:48:08 2022 +

Align with 9.0.x onwards
---
 java/org/apache/tomcat/util/net/AbstractEndpoint.java | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/java/org/apache/tomcat/util/net/AbstractEndpoint.java 
b/java/org/apache/tomcat/util/net/AbstractEndpoint.java
index 73cfbfb..9b9102c 100644
--- a/java/org/apache/tomcat/util/net/AbstractEndpoint.java
+++ b/java/org/apache/tomcat/util/net/AbstractEndpoint.java
@@ -506,8 +506,7 @@ public abstract class AbstractEndpoint {
 initializeConnectionLatch();
 }
 }
-
-public int  getMaxConnections() { return this.maxConnections; }
+public int getMaxConnections() { return this.maxConnections; }
 
 /**
  * Return the current count of connections handled by this endpoint, if the

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