Re: [tomcat] branch master updated: Change forcedRemainingCapacity from Integer to int

2020-08-28 Thread Martin Grigorov
Hi Chris,

On Thu, Aug 27, 2020 at 8:51 PM Christopher Schultz <
ch...@christopherschultz.net> wrote:

> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA256
>
> Martin,
>
> On 8/27/20 07:55, mgrigo...@apache.org wrote:
> > This is an automated email from the ASF dual-hosted git
> > repository.
> >
> > mgrigorov 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 2cef8f1  Change forcedRemainingCapacity from Integer to
> > int 2cef8f1 is described below
> >
> > commit 2cef8f18dee7b7bca3d03b3301fbe8e733e728fa Author: Martin
> > Tzvetanov Grigorov  AuthorDate: Tue Aug 25
> > 14:36:23 2020 +0300
> >
> > Change forcedRemainingCapacity from Integer to int
> >
> > No need to create object (or use Integer cache) and cast it to
> > primitive int. 'forcedRemainingCapacity' can do its job with a
> > primitive int, since Queue's capacity cannot be negative value ---
> > java/org/apache/tomcat/util/threads/TaskQueue.java| 15
> > ++-
> > .../apache/tomcat/util/threads/ThreadPoolExecutor.java|  4
> > ++-- 2 files changed, 12 insertions(+), 7 deletions(-)
> >
> > diff --git a/java/org/apache/tomcat/util/threads/TaskQueue.java
> > b/java/org/apache/tomcat/util/threads/TaskQueue.java index
> > 87c93a9..35f1d89 100644 ---
> > a/java/org/apache/tomcat/util/threads/TaskQueue.java +++
> > b/java/org/apache/tomcat/util/threads/TaskQueue.java @@ -35,12
> > +35,13 @@ public class TaskQueue extends
> > LinkedBlockingQueue { private static final long
> > serialVersionUID = 1L; protected static final StringManager sm =
> > StringManager .getManager("org.apache.tomcat.util.threads.res"); +
> > private static final int DEFAULT_FORCED_REMAINING_CAPACITY = -1;
> >
> > private transient volatile ThreadPoolExecutor parent = null;
> >
> > // No need to be volatile. This is written and read in a single
> > thread -// (when stopping a context and firing the  listeners)
> > -private Integer forcedRemainingCapacity = null; +// (when
> > stopping a context and firing the listeners) +private int
> > forcedRemainingCapacity = -1;
> >
> > public TaskQueue() { super(); @@ -109,18 +110,22 @@ public class
> > TaskQueue extends LinkedBlockingQueue {
> >
> > @Override public int remainingCapacity() { -if
> > (forcedRemainingCapacity != null) { +if
> > (forcedRemainingCapacity > DEFAULT_FORCED_REMAINING_CAPACITY) { //
> > ThreadPoolExecutor.setCorePoolSize checks that //
> > remainingCapacity==0 to allow to interrupt idle threads // I don't
> > see why, but this hack allows to conform to this // "requirement" -
> > return forcedRemainingCapacity.intValue(); +return
> > forcedRemainingCapacity; } return super.remainingCapacity(); }
> >
> > -public void setForcedRemainingCapacity(Integer
> > forcedRemainingCapacity) { +public void
> > setForcedRemainingCapacity(int forcedRemainingCapacity) {
> > this.forcedRemainingCapacity = forcedRemainingCapacity; }
>
> Technically, this could cause a problem for anyone who has binaries
> built against the current code. My guess is that it's very unlikely
> for anyone to be using this code directly so it's not really a big deal.
>

Mark had the same comment in the PR:
https://github.com/apache/tomcat/pull/344#discussion_r476517292
I also think this API is too low level for anyone, even for Spring Boot
people.


>
> But in general, it would be better to add a new set(Integer) method
> which calls the old one and deprecate the old one to be as consistent
> as possible for a point-release.
>
> - -chris
> -BEGIN PGP SIGNATURE-
> Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/
>
> iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAl9H8m4ACgkQHPApP6U8
> pFhVwQ/+MyrOmzl8+ragnuyamOlDkGSzhULnJpAnF43OScVBkCfjIbfO3S6ZxZSA
> N/uzXg4c2/zXO/qN1BMCRRHi8/bbb02y54h4jT8h/2OyIdbmlFJhOWAGPpkA7A8D
> GwgSpG5YbEtnpEg0nodtrbWzF1VqKw1x1Wa65tx2wFeSJCVVTlECGlQc1w3sewuV
> o3rpLuupamg/3gOzHlPHaBNYOFY8IEeXtTGmdpTeKmpsh2tbkNvsctcH5IiPvaox
> 8M1mz3IJpK0xb/epBADf7N+hNe+4dT7r+jsDcMyuvRD5CIsLvuKDa2Az8MgamNLQ
> Jd4J1LpxY8PmWsF3EV51DIJmyijxeHEvPu9YXZQ+eR7k4vxFn7CLdfDe3p0SdhKO
> z2m3Sr3BW23tKJBBRQmHLgT7N3ZlnVdoMmQ9jy+vzbb+QWYEQGO3Oc8P1tZbKEjK
> CBKOYmfkBlfB6vcsX/n8pC4gFU6R/V2qKhYG6KiHGjviEoRy0gWLi+5OpD9y+dYS
> u7FjQcB1NrT/kVghOSAkUcvKaIXtB/dM1Se2t/77DnVb7YrjDk97/1Jjbk7rrS6T
> myaXIzsZMgI2d26wtBQSTr+AyyFvNw2h/LnooAc4bIlDJiFju6nSoVqcBPHHZ1mt
> FaIwTzmRSGsSu2EX+S0HEOhHI/kHl5gCP4OVsvZDfBMZN3tKTog=
> =GjCI
> -END PGP SIGNATURE-
>
> -
> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: dev-h...@tomcat.apache.org
>
>


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

2020-08-28 Thread GitBox


martin-g commented on a change in pull request #346:
URL: https://github.com/apache/tomcat/pull/346#discussion_r478870589



##
File path: java/org/apache/tomcat/websocket/Constants.java
##
@@ -114,6 +114,22 @@
 // Milliseconds so this is 20 seconds
 public static final long DEFAULT_BLOCKING_SEND_TIMEOUT = 20 * 1000;
 
+// Configuration for idle read timeout on websocket channel
+public static final String WS_READ_IDLE_TIMEOUT =
+"org.apache.tomcat.websocket.WS_READ_IDLE_TIMEOUT";
+
+// Configuration for idle write timeout on websocket channel
+public static final String WS_WRITE_IDLE_TIMEOUT =
+"org.apache.tomcat.websocket.WS_WRITE_IDLE_TIMEOUT";
+
+// Configuration for idle write timeout on websocket channel

Review comment:
   This comment is exactly the same as for the previous constant

##
File path: java/org/apache/tomcat/websocket/Constants.java
##
@@ -114,6 +114,22 @@
 // Milliseconds so this is 20 seconds
 public static final long DEFAULT_BLOCKING_SEND_TIMEOUT = 20 * 1000;
 
+// Configuration for idle read timeout on websocket channel
+public static final String WS_READ_IDLE_TIMEOUT =
+"org.apache.tomcat.websocket.WS_READ_IDLE_TIMEOUT";
+
+// Configuration for idle write timeout on websocket channel
+public static final String WS_WRITE_IDLE_TIMEOUT =
+"org.apache.tomcat.websocket.WS_WRITE_IDLE_TIMEOUT";
+
+// Configuration for idle write timeout on websocket channel
+public static final String WS_CLOSE_READ_IDLE_TIMEOUT =
+"org.apache.tomcat.websocket.WS_CLOSE_READ_IDLE_TIMEOUT";
+
+// Configuration for idle write timeout on websocket channel

Review comment:
   Same copy/paste error 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.

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] martin-g commented on a change in pull request #346: Bug 64644 add custom properties to close connections on readIdletimeout

2020-08-28 Thread GitBox


martin-g commented on a change in pull request #346:
URL: https://github.com/apache/tomcat/pull/346#discussion_r478872675



##
File path: java/org/apache/tomcat/websocket/Constants.java
##
@@ -114,6 +114,22 @@
 // Milliseconds so this is 20 seconds
 public static final long DEFAULT_BLOCKING_SEND_TIMEOUT = 20 * 1000;
 
+// Configuration for idle read timeout on websocket channel
+public static final String WS_READ_IDLE_TIMEOUT =
+"org.apache.tomcat.websocket.WS_READ_IDLE_TIMEOUT";
+
+// Configuration for idle write timeout on websocket channel
+public static final String WS_WRITE_IDLE_TIMEOUT =
+"org.apache.tomcat.websocket.WS_WRITE_IDLE_TIMEOUT";
+
+// Configuration for idle write timeout on websocket channel

Review comment:
   What is the purpose of the following two constants ? They are not used 
below.





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: Send WINDOW_UPDATE frames correctly when a DATA frame includes padding

2020-08-28 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 03a1ccf  Send WINDOW_UPDATE frames correctly when a DATA frame 
includes padding
03a1ccf is described below

commit 03a1ccfa7c3cc48bb9dd4cc134b42cbb4a306c7d
Author: Mark Thomas 
AuthorDate: Fri Aug 28 13:04:43 2020 +0100

Send WINDOW_UPDATE frames correctly when a DATA frame includes padding

When a Stream was closed the window update frame was not sent for the
connection. When zero length padding was used, an update frame was not
sent. In both cases the result would be a smaller flow control window
than intended.

Bugs detected by Travis CI
---
 .../coyote/http2/Http2AsyncUpgradeHandler.java | 27 
 java/org/apache/coyote/http2/Http2Parser.java  |  2 +-
 .../apache/coyote/http2/Http2UpgradeHandler.java   | 27 
 test/org/apache/coyote/http2/Http2TestBase.java| 28 +
 .../apache/coyote/http2/TestHttp2Section_6_1.java  | 36 +-
 webapps/docs/changelog.xml | 10 ++
 6 files changed, 91 insertions(+), 39 deletions(-)

diff --git a/java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java 
b/java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java
index 3d17d98..ff58a7e 100644
--- a/java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java
+++ b/java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java
@@ -229,23 +229,26 @@ public class Http2AsyncUpgradeHandler extends 
Http2UpgradeHandler {
 @Override
 void writeWindowUpdate(Stream stream, int increment, boolean 
applicationInitiated)
 throws IOException {
-if (!stream.canWrite()) {
-return;
-}
 // Build window update frame for stream 0
 byte[] frame = new byte[13];
 ByteUtil.setThreeBytes(frame, 0,  4);
 frame[3] = FrameType.WINDOW_UPDATE.getIdByte();
 ByteUtil.set31Bits(frame, 9, increment);
-// Change stream Id
-byte[] frame2 = new byte[13];
-ByteUtil.setThreeBytes(frame2, 0,  4);
-frame2[3] = FrameType.WINDOW_UPDATE.getIdByte();
-ByteUtil.set31Bits(frame2, 9, increment);
-ByteUtil.set31Bits(frame2, 5, stream.getIdAsInt());
-socketWrapper.write(BlockingMode.SEMI_BLOCK, 
protocol.getWriteTimeout(),
-TimeUnit.MILLISECONDS, null, SocketWrapperBase.COMPLETE_WRITE, 
errorCompletion,
-ByteBuffer.wrap(frame), ByteBuffer.wrap(frame2));
+if (stream.canWrite()) {
+// Change stream Id
+byte[] frame2 = new byte[13];
+ByteUtil.setThreeBytes(frame2, 0,  4);
+frame2[3] = FrameType.WINDOW_UPDATE.getIdByte();
+ByteUtil.set31Bits(frame2, 9, increment);
+ByteUtil.set31Bits(frame2, 5, stream.getIdAsInt());
+socketWrapper.write(BlockingMode.SEMI_BLOCK, 
protocol.getWriteTimeout(),
+TimeUnit.MILLISECONDS, null, 
SocketWrapperBase.COMPLETE_WRITE, errorCompletion,
+ByteBuffer.wrap(frame), ByteBuffer.wrap(frame2));
+} else {
+socketWrapper.write(BlockingMode.SEMI_BLOCK, 
protocol.getWriteTimeout(),
+TimeUnit.MILLISECONDS, null, 
SocketWrapperBase.COMPLETE_WRITE, errorCompletion,
+ByteBuffer.wrap(frame));
+}
 handleAsyncException();
 }
 
diff --git a/java/org/apache/coyote/http2/Http2Parser.java 
b/java/org/apache/coyote/http2/Http2Parser.java
index fa828c9..6b2369b 100644
--- a/java/org/apache/coyote/http2/Http2Parser.java
+++ b/java/org/apache/coyote/http2/Http2Parser.java
@@ -207,7 +207,7 @@ class Http2Parser {
 output.endRequestBodyFrame(streamId);
 }
 }
-if (padLength > 0) {
+if (Flags.hasPadding(flags)) {
 output.swallowedPadding(streamId, padLength);
 }
 }
diff --git a/java/org/apache/coyote/http2/Http2UpgradeHandler.java 
b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
index bb5e038..99792dc 100644
--- a/java/org/apache/coyote/http2/Http2UpgradeHandler.java
+++ b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
@@ -795,9 +795,6 @@ class Http2UpgradeHandler extends AbstractStream implements 
InternalHttpUpgradeH
  */
 void writeWindowUpdate(Stream stream, int increment, boolean 
applicationInitiated)
 throws IOException {
-if (!stream.canWrite()) {
-return;
-}
 synchronized (socketWrapper) {
 // Build window update frame for stream 0
 byte[] frame = new byte[13];
@@ -805,17 +802,21 @@ class Http2UpgradeHandler extends AbstractStream 
implements InternalHttpUpgradeH
 frame[3] = FrameType.WINDOW_UPDATE.getIdByte();
 ByteUtil

[tomcat] branch 9.0.x updated: Send WINDOW_UPDATE frames correctly when a DATA frame includes padding

2020-08-28 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 c9856e0  Send WINDOW_UPDATE frames correctly when a DATA frame 
includes padding
c9856e0 is described below

commit c9856e0851519e7eee6c3d680e9ffe05f27e205e
Author: Mark Thomas 
AuthorDate: Fri Aug 28 13:04:43 2020 +0100

Send WINDOW_UPDATE frames correctly when a DATA frame includes padding

When a Stream was closed the window update frame was not sent for the
connection. When zero length padding was used, an update frame was not
sent. In both cases the result would be a smaller flow control window
than intended.

Bugs detected by Travis CI
---
 .../coyote/http2/Http2AsyncUpgradeHandler.java | 27 
 java/org/apache/coyote/http2/Http2Parser.java  |  2 +-
 .../apache/coyote/http2/Http2UpgradeHandler.java   | 27 
 test/org/apache/coyote/http2/Http2TestBase.java| 28 +
 .../apache/coyote/http2/TestHttp2Section_6_1.java  | 36 +-
 webapps/docs/changelog.xml | 10 ++
 6 files changed, 91 insertions(+), 39 deletions(-)

diff --git a/java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java 
b/java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java
index 545292f..e730737 100644
--- a/java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java
+++ b/java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java
@@ -229,23 +229,26 @@ public class Http2AsyncUpgradeHandler extends 
Http2UpgradeHandler {
 @Override
 void writeWindowUpdate(Stream stream, int increment, boolean 
applicationInitiated)
 throws IOException {
-if (!stream.canWrite()) {
-return;
-}
 // Build window update frame for stream 0
 byte[] frame = new byte[13];
 ByteUtil.setThreeBytes(frame, 0,  4);
 frame[3] = FrameType.WINDOW_UPDATE.getIdByte();
 ByteUtil.set31Bits(frame, 9, increment);
-// Change stream Id
-byte[] frame2 = new byte[13];
-ByteUtil.setThreeBytes(frame2, 0,  4);
-frame2[3] = FrameType.WINDOW_UPDATE.getIdByte();
-ByteUtil.set31Bits(frame2, 9, increment);
-ByteUtil.set31Bits(frame2, 5, stream.getIdAsInt());
-socketWrapper.write(BlockingMode.SEMI_BLOCK, 
protocol.getWriteTimeout(),
-TimeUnit.MILLISECONDS, null, SocketWrapperBase.COMPLETE_WRITE, 
errorCompletion,
-ByteBuffer.wrap(frame), ByteBuffer.wrap(frame2));
+if (stream.canWrite()) {
+// Change stream Id
+byte[] frame2 = new byte[13];
+ByteUtil.setThreeBytes(frame2, 0,  4);
+frame2[3] = FrameType.WINDOW_UPDATE.getIdByte();
+ByteUtil.set31Bits(frame2, 9, increment);
+ByteUtil.set31Bits(frame2, 5, stream.getIdAsInt());
+socketWrapper.write(BlockingMode.SEMI_BLOCK, 
protocol.getWriteTimeout(),
+TimeUnit.MILLISECONDS, null, 
SocketWrapperBase.COMPLETE_WRITE, errorCompletion,
+ByteBuffer.wrap(frame), ByteBuffer.wrap(frame2));
+} else {
+socketWrapper.write(BlockingMode.SEMI_BLOCK, 
protocol.getWriteTimeout(),
+TimeUnit.MILLISECONDS, null, 
SocketWrapperBase.COMPLETE_WRITE, errorCompletion,
+ByteBuffer.wrap(frame));
+}
 handleAsyncException();
 }
 
diff --git a/java/org/apache/coyote/http2/Http2Parser.java 
b/java/org/apache/coyote/http2/Http2Parser.java
index 38f0b13..4725a1f 100644
--- a/java/org/apache/coyote/http2/Http2Parser.java
+++ b/java/org/apache/coyote/http2/Http2Parser.java
@@ -207,7 +207,7 @@ class Http2Parser {
 output.endRequestBodyFrame(streamId);
 }
 }
-if (padLength > 0) {
+if (Flags.hasPadding(flags)) {
 output.swallowedPadding(streamId, padLength);
 }
 }
diff --git a/java/org/apache/coyote/http2/Http2UpgradeHandler.java 
b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
index a1feb4d..e63f174 100644
--- a/java/org/apache/coyote/http2/Http2UpgradeHandler.java
+++ b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
@@ -795,9 +795,6 @@ class Http2UpgradeHandler extends AbstractStream implements 
InternalHttpUpgradeH
  */
 void writeWindowUpdate(Stream stream, int increment, boolean 
applicationInitiated)
 throws IOException {
-if (!stream.canWrite()) {
-return;
-}
 synchronized (socketWrapper) {
 // Build window update frame for stream 0
 byte[] frame = new byte[13];
@@ -805,17 +802,21 @@ class Http2UpgradeHandler extends AbstractStream 
implements InternalHttpUpgradeH
 frame[3] = FrameType.WINDOW_UPDATE.getIdByte();
 ByteUtil.s

[tomcat] branch 8.5.x updated: Send WINDOW_UPDATE frames correctly when a DATA frame includes padding

2020-08-28 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 63c1d4e  Send WINDOW_UPDATE frames correctly when a DATA frame 
includes padding
63c1d4e is described below

commit 63c1d4e607e6aaa7ca12cd9c8a09b16765adcd25
Author: Mark Thomas 
AuthorDate: Fri Aug 28 13:04:43 2020 +0100

Send WINDOW_UPDATE frames correctly when a DATA frame includes padding

When a Stream was closed the window update frame was not sent for the
connection. When zero length padding was used, an update frame was not
sent. In both cases the result would be a smaller flow control window
than intended.

Bugs detected by Travis CI
---
 java/org/apache/coyote/http2/Http2Parser.java  |  2 +-
 .../apache/coyote/http2/Http2UpgradeHandler.java   | 27 
 test/org/apache/coyote/http2/Http2TestBase.java| 28 +
 .../apache/coyote/http2/TestHttp2Section_6_1.java  | 36 +-
 webapps/docs/changelog.xml | 10 ++
 5 files changed, 76 insertions(+), 27 deletions(-)

diff --git a/java/org/apache/coyote/http2/Http2Parser.java 
b/java/org/apache/coyote/http2/Http2Parser.java
index 68dd528..a20ee33 100644
--- a/java/org/apache/coyote/http2/Http2Parser.java
+++ b/java/org/apache/coyote/http2/Http2Parser.java
@@ -195,7 +195,7 @@ class Http2Parser {
 output.endRequestBodyFrame(streamId);
 }
 }
-if (padLength > 0) {
+if (Flags.hasPadding(flags)) {
 output.swallowedPadding(streamId, padLength);
 }
 }
diff --git a/java/org/apache/coyote/http2/Http2UpgradeHandler.java 
b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
index 62e1423..2d1957a 100644
--- a/java/org/apache/coyote/http2/Http2UpgradeHandler.java
+++ b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
@@ -792,9 +792,6 @@ public class Http2UpgradeHandler extends AbstractStream 
implements InternalHttpU
  */
 void writeWindowUpdate(Stream stream, int increment, boolean 
applicationInitiated)
 throws IOException {
-if (!stream.canWrite()) {
-return;
-}
 synchronized (socketWrapper) {
 // Build window update frame for stream 0
 byte[] frame = new byte[13];
@@ -802,17 +799,21 @@ public class Http2UpgradeHandler extends AbstractStream 
implements InternalHttpU
 frame[3] = FrameType.WINDOW_UPDATE.getIdByte();
 ByteUtil.set31Bits(frame, 9, increment);
 socketWrapper.write(true, frame, 0, frame.length);
-// Change stream Id and re-use
-ByteUtil.set31Bits(frame, 5, stream.getIdAsInt());
-try {
-socketWrapper.write(true, frame, 0, frame.length);
-socketWrapper.flush(true);
-} catch (IOException ioe) {
-if (applicationInitiated) {
-handleAppInitiatedIOException(ioe);
-} else {
-throw ioe;
+if  (stream.canWrite()) {
+// Change stream Id and re-use
+ByteUtil.set31Bits(frame, 5, stream.getIdAsInt());
+try {
+socketWrapper.write(true, frame, 0, frame.length);
+socketWrapper.flush(true);
+} catch (IOException ioe) {
+if (applicationInitiated) {
+handleAppInitiatedIOException(ioe);
+} else {
+throw ioe;
+}
 }
+} else {
+socketWrapper.flush(true);
 }
 }
 }
diff --git a/test/org/apache/coyote/http2/Http2TestBase.java 
b/test/org/apache/coyote/http2/Http2TestBase.java
index ff70953..ce61d4b 100644
--- a/test/org/apache/coyote/http2/Http2TestBase.java
+++ b/test/org/apache/coyote/http2/Http2TestBase.java
@@ -459,19 +459,35 @@ public abstract class Http2TestBase extends 
TomcatBaseTest {
 
 
 protected void readSimplePostResponse(boolean padding) throws 
Http2Exception, IOException {
-if (padding) {
-// Window updates for padding
-parser.readFrame(true);
-parser.readFrame(true);
-}
+/*
+ * If there is padding there will always be a window update for the
+ * connection and, depending on timing, there may be an update for the
+ * stream. The Window updates for padding (if present) may appear at 
any
+ * time. The comments in the code below are only indicative of what the
+ * frames are likely to contain. Actual frame order with padding may be
+ * different.
+ */
+
 // Connection window update after reading request body
 parser.readFrame(true);
 // Stream 

[tomcat] branch 7.0.x updated: Align with 8.5.x & fix compilation after backport

2020-08-28 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 38d1eb1  Align with 8.5.x & fix compilation after backport
38d1eb1 is described below

commit 38d1eb17eb80e9418480241d25fe4ec9737e4751
Author: Mark Thomas 
AuthorDate: Fri Aug 28 13:22:10 2020 +0100

Align with 8.5.x & fix compilation after backport
---
 java/org/apache/tomcat/util/threads/LimitLatch.java  | 5 +
 .../apache/tomcat/util/threads/StopPooledThreadException.java| 2 +-
 java/org/apache/tomcat/util/threads/TaskQueue.java   | 9 +++--
 java/org/apache/tomcat/util/threads/TaskThreadFactory.java   | 9 +
 java/org/apache/tomcat/util/threads/ThreadPoolExecutor.java  | 6 +++---
 java/org/apache/tomcat/util/threads/res/LocalStrings.properties  | 3 +++
 .../apache/tomcat/util/threads/res/LocalStrings_fr.properties| 3 +++
 .../apache/tomcat/util/threads/res/LocalStrings_ja.properties| 3 +++
 .../apache/tomcat/util/threads/res/LocalStrings_ko.properties| 3 +++
 .../apache/tomcat/util/threads/res/LocalStrings_zh_CN.properties | 3 +++
 10 files changed, 36 insertions(+), 10 deletions(-)

diff --git a/java/org/apache/tomcat/util/threads/LimitLatch.java 
b/java/org/apache/tomcat/util/threads/LimitLatch.java
index 6ef2e64..840ec55 100644
--- a/java/org/apache/tomcat/util/threads/LimitLatch.java
+++ b/java/org/apache/tomcat/util/threads/LimitLatch.java
@@ -82,6 +82,7 @@ public class LimitLatch {
 
 /**
  * Obtain the current limit.
+ * @return the limit
  */
 public long getLimit() {
 return limit;
@@ -107,6 +108,7 @@ public class LimitLatch {
 /**
  * Acquires a shared latch if one is available or waits for one if no 
shared
  * latch is current available.
+ * @throws InterruptedException If the current thread is interrupted
  */
 public void countUpOrAwait() throws InterruptedException {
 if (log.isDebugEnabled()) {
@@ -131,6 +133,7 @@ public class LimitLatch {
 /**
  * Releases all waiting threads and causes the {@link #limit} to be ignored
  * until {@link #reset()} is called.
+ * @return true if release was done
  */
 public boolean releaseAll() {
 released = true;
@@ -149,6 +152,7 @@ public class LimitLatch {
 /**
  * Returns true if there is at least one thread waiting to
  * acquire the shared lock, otherwise returns false.
+ * @return true if threads are waiting
  */
 public boolean hasQueuedThreads() {
 return sync.hasQueuedThreads();
@@ -157,6 +161,7 @@ public class LimitLatch {
 /**
  * Provide access to the list of threads waiting to acquire this limited
  * shared latch.
+ * @return a collection of threads
  */
 public Collection getQueuedThreads() {
 return sync.getQueuedThreads();
diff --git a/java/org/apache/tomcat/util/threads/StopPooledThreadException.java 
b/java/org/apache/tomcat/util/threads/StopPooledThreadException.java
index e1447e2..95b9c38 100644
--- a/java/org/apache/tomcat/util/threads/StopPooledThreadException.java
+++ b/java/org/apache/tomcat/util/threads/StopPooledThreadException.java
@@ -26,6 +26,6 @@ public class StopPooledThreadException extends 
RuntimeException {
 private static final long serialVersionUID = 1L;
 
 public StopPooledThreadException(String msg) {
-super(msg, null, false, false);
+super(msg, null);
 }
 }
diff --git a/java/org/apache/tomcat/util/threads/TaskQueue.java 
b/java/org/apache/tomcat/util/threads/TaskQueue.java
index cdd0bc2..35f1d89 100644
--- a/java/org/apache/tomcat/util/threads/TaskQueue.java
+++ b/java/org/apache/tomcat/util/threads/TaskQueue.java
@@ -21,6 +21,8 @@ import java.util.concurrent.LinkedBlockingQueue;
 import java.util.concurrent.RejectedExecutionException;
 import java.util.concurrent.TimeUnit;
 
+import org.apache.tomcat.util.res.StringManager;
+
 /**
  * As task queue specifically designed to run with a thread pool executor. The
  * task queue is optimised to properly utilize threads within a thread pool
@@ -31,6 +33,9 @@ import java.util.concurrent.TimeUnit;
 public class TaskQueue extends LinkedBlockingQueue {
 
 private static final long serialVersionUID = 1L;
+protected static final StringManager sm = StringManager
+.getManager("org.apache.tomcat.util.threads.res");
+private static final int DEFAULT_FORCED_REMAINING_CAPACITY = -1;
 
 private transient volatile ThreadPoolExecutor parent = null;
 
@@ -55,12 +60,12 @@ public class TaskQueue extends 
LinkedBlockingQueue {
 }
 
 public boolean force(Runnable o) {
-if (parent == null || parent.isShutdown()) throw new 
RejectedExecutionException("Executor not running, can't force a command into 
the queue");
+if (parent == null || parent.isShutdo

[tomcat] branch master updated: Additional log information for failing test

2020-08-28 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 ddaf37d  Additional log information for failing test
ddaf37d is described below

commit ddaf37ddeb917c02fa8fb0c1f2423b1b7ee79296
Author: Mark Thomas 
AuthorDate: Fri Aug 28 16:12:37 2020 +0100

Additional log information for failing test
---
 .../group/interceptors/TestNonBlockingCoordinator.java  | 13 +
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git 
a/test/org/apache/catalina/tribes/group/interceptors/TestNonBlockingCoordinator.java
 
b/test/org/apache/catalina/tribes/group/interceptors/TestNonBlockingCoordinator.java
index 4b202a9..4c0d0ed 100644
--- 
a/test/org/apache/catalina/tribes/group/interceptors/TestNonBlockingCoordinator.java
+++ 
b/test/org/apache/catalina/tribes/group/interceptors/TestNonBlockingCoordinator.java
@@ -25,9 +25,13 @@ import org.apache.catalina.tribes.Channel;
 import org.apache.catalina.tribes.Member;
 import org.apache.catalina.tribes.TesterUtil;
 import org.apache.catalina.tribes.group.GroupChannel;
+import org.apache.juli.logging.Log;
+import org.apache.juli.logging.LogFactory;
 
 public class TestNonBlockingCoordinator {
 
+private static final Log log = 
LogFactory.getLog(TestNonBlockingCoordinator.class);
+
 private static final int CHANNEL_COUNT = 10;
 
 private GroupChannel[] channels = null;
@@ -35,7 +39,7 @@ public class TestNonBlockingCoordinator {
 
 @Before
 public void setUp() throws Exception {
-System.out.println("Setup");
+log.info("Setup");
 channels = new GroupChannel[CHANNEL_COUNT];
 coordinators = new NonBlockingCoordinator[CHANNEL_COUNT];
 Thread[] threads = new Thread[CHANNEL_COUNT];
@@ -70,8 +74,9 @@ public class TestNonBlockingCoordinator {
 @Test
 public void testCoord1() throws Exception {
 int expectedCount = channels[0].getMembers().length;
+log.info("Expecting each channel to have [" + expectedCount + "] 
members");
 for (int i = 1; i < CHANNEL_COUNT; i++) {
-Assert.assertEquals("Message count expected to be equal.", 
expectedCount,
+Assert.assertEquals("Member count expected to be equal.", 
expectedCount,
 channels[i].getMembers().length);
 }
 Member member = coordinators[0].getCoordinator();
@@ -84,10 +89,10 @@ public class TestNonBlockingCoordinator {
 /* Ignore */
 }
 }
+log.info("Coordinator[0] is:" + member);
 for (int i = 0; i < CHANNEL_COUNT; i++) {
-Assert.assertEquals(member, coordinators[i].getCoordinator());
+Assert.assertEquals("Local member" + 
channels[i].getLocalMember(false), member, coordinators[i].getCoordinator());
 }
-System.out.println("Coordinator[1] is:" + member);
 }
 
 @Test


-
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: Additional log information for failing test

2020-08-28 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 9902a98  Additional log information for failing test
9902a98 is described below

commit 9902a984cf1453f6e5232e62dcd01c819e676303
Author: Mark Thomas 
AuthorDate: Fri Aug 28 16:12:37 2020 +0100

Additional log information for failing test
---
 .../group/interceptors/TestNonBlockingCoordinator.java  | 13 +
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git 
a/test/org/apache/catalina/tribes/group/interceptors/TestNonBlockingCoordinator.java
 
b/test/org/apache/catalina/tribes/group/interceptors/TestNonBlockingCoordinator.java
index 4b202a9..4c0d0ed 100644
--- 
a/test/org/apache/catalina/tribes/group/interceptors/TestNonBlockingCoordinator.java
+++ 
b/test/org/apache/catalina/tribes/group/interceptors/TestNonBlockingCoordinator.java
@@ -25,9 +25,13 @@ import org.apache.catalina.tribes.Channel;
 import org.apache.catalina.tribes.Member;
 import org.apache.catalina.tribes.TesterUtil;
 import org.apache.catalina.tribes.group.GroupChannel;
+import org.apache.juli.logging.Log;
+import org.apache.juli.logging.LogFactory;
 
 public class TestNonBlockingCoordinator {
 
+private static final Log log = 
LogFactory.getLog(TestNonBlockingCoordinator.class);
+
 private static final int CHANNEL_COUNT = 10;
 
 private GroupChannel[] channels = null;
@@ -35,7 +39,7 @@ public class TestNonBlockingCoordinator {
 
 @Before
 public void setUp() throws Exception {
-System.out.println("Setup");
+log.info("Setup");
 channels = new GroupChannel[CHANNEL_COUNT];
 coordinators = new NonBlockingCoordinator[CHANNEL_COUNT];
 Thread[] threads = new Thread[CHANNEL_COUNT];
@@ -70,8 +74,9 @@ public class TestNonBlockingCoordinator {
 @Test
 public void testCoord1() throws Exception {
 int expectedCount = channels[0].getMembers().length;
+log.info("Expecting each channel to have [" + expectedCount + "] 
members");
 for (int i = 1; i < CHANNEL_COUNT; i++) {
-Assert.assertEquals("Message count expected to be equal.", 
expectedCount,
+Assert.assertEquals("Member count expected to be equal.", 
expectedCount,
 channels[i].getMembers().length);
 }
 Member member = coordinators[0].getCoordinator();
@@ -84,10 +89,10 @@ public class TestNonBlockingCoordinator {
 /* Ignore */
 }
 }
+log.info("Coordinator[0] is:" + member);
 for (int i = 0; i < CHANNEL_COUNT; i++) {
-Assert.assertEquals(member, coordinators[i].getCoordinator());
+Assert.assertEquals("Local member" + 
channels[i].getLocalMember(false), member, coordinators[i].getCoordinator());
 }
-System.out.println("Coordinator[1] is:" + member);
 }
 
 @Test


-
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: Additional log information for failing test

2020-08-28 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 8b42056  Additional log information for failing test
8b42056 is described below

commit 8b4205696e28034061a6e693ed9fa2258f3f483e
Author: Mark Thomas 
AuthorDate: Fri Aug 28 16:12:37 2020 +0100

Additional log information for failing test
---
 .../group/interceptors/TestNonBlockingCoordinator.java  | 13 +
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git 
a/test/org/apache/catalina/tribes/group/interceptors/TestNonBlockingCoordinator.java
 
b/test/org/apache/catalina/tribes/group/interceptors/TestNonBlockingCoordinator.java
index 4b202a9..4c0d0ed 100644
--- 
a/test/org/apache/catalina/tribes/group/interceptors/TestNonBlockingCoordinator.java
+++ 
b/test/org/apache/catalina/tribes/group/interceptors/TestNonBlockingCoordinator.java
@@ -25,9 +25,13 @@ import org.apache.catalina.tribes.Channel;
 import org.apache.catalina.tribes.Member;
 import org.apache.catalina.tribes.TesterUtil;
 import org.apache.catalina.tribes.group.GroupChannel;
+import org.apache.juli.logging.Log;
+import org.apache.juli.logging.LogFactory;
 
 public class TestNonBlockingCoordinator {
 
+private static final Log log = 
LogFactory.getLog(TestNonBlockingCoordinator.class);
+
 private static final int CHANNEL_COUNT = 10;
 
 private GroupChannel[] channels = null;
@@ -35,7 +39,7 @@ public class TestNonBlockingCoordinator {
 
 @Before
 public void setUp() throws Exception {
-System.out.println("Setup");
+log.info("Setup");
 channels = new GroupChannel[CHANNEL_COUNT];
 coordinators = new NonBlockingCoordinator[CHANNEL_COUNT];
 Thread[] threads = new Thread[CHANNEL_COUNT];
@@ -70,8 +74,9 @@ public class TestNonBlockingCoordinator {
 @Test
 public void testCoord1() throws Exception {
 int expectedCount = channels[0].getMembers().length;
+log.info("Expecting each channel to have [" + expectedCount + "] 
members");
 for (int i = 1; i < CHANNEL_COUNT; i++) {
-Assert.assertEquals("Message count expected to be equal.", 
expectedCount,
+Assert.assertEquals("Member count expected to be equal.", 
expectedCount,
 channels[i].getMembers().length);
 }
 Member member = coordinators[0].getCoordinator();
@@ -84,10 +89,10 @@ public class TestNonBlockingCoordinator {
 /* Ignore */
 }
 }
+log.info("Coordinator[0] is:" + member);
 for (int i = 0; i < CHANNEL_COUNT; i++) {
-Assert.assertEquals(member, coordinators[i].getCoordinator());
+Assert.assertEquals("Local member" + 
channels[i].getLocalMember(false), member, coordinators[i].getCoordinator());
 }
-System.out.println("Coordinator[1] is:" + member);
 }
 
 @Test


-
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: Additional log information for failing test

2020-08-28 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 03545f7  Additional log information for failing test
03545f7 is described below

commit 03545f76e685e071066c9937ef06d7abafae94e9
Author: Mark Thomas 
AuthorDate: Fri Aug 28 16:12:37 2020 +0100

Additional log information for failing test
---
 .../group/interceptors/TestNonBlockingCoordinator.java  | 13 +
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git 
a/test/org/apache/catalina/tribes/group/interceptors/TestNonBlockingCoordinator.java
 
b/test/org/apache/catalina/tribes/group/interceptors/TestNonBlockingCoordinator.java
index 4b202a9..4c0d0ed 100644
--- 
a/test/org/apache/catalina/tribes/group/interceptors/TestNonBlockingCoordinator.java
+++ 
b/test/org/apache/catalina/tribes/group/interceptors/TestNonBlockingCoordinator.java
@@ -25,9 +25,13 @@ import org.apache.catalina.tribes.Channel;
 import org.apache.catalina.tribes.Member;
 import org.apache.catalina.tribes.TesterUtil;
 import org.apache.catalina.tribes.group.GroupChannel;
+import org.apache.juli.logging.Log;
+import org.apache.juli.logging.LogFactory;
 
 public class TestNonBlockingCoordinator {
 
+private static final Log log = 
LogFactory.getLog(TestNonBlockingCoordinator.class);
+
 private static final int CHANNEL_COUNT = 10;
 
 private GroupChannel[] channels = null;
@@ -35,7 +39,7 @@ public class TestNonBlockingCoordinator {
 
 @Before
 public void setUp() throws Exception {
-System.out.println("Setup");
+log.info("Setup");
 channels = new GroupChannel[CHANNEL_COUNT];
 coordinators = new NonBlockingCoordinator[CHANNEL_COUNT];
 Thread[] threads = new Thread[CHANNEL_COUNT];
@@ -70,8 +74,9 @@ public class TestNonBlockingCoordinator {
 @Test
 public void testCoord1() throws Exception {
 int expectedCount = channels[0].getMembers().length;
+log.info("Expecting each channel to have [" + expectedCount + "] 
members");
 for (int i = 1; i < CHANNEL_COUNT; i++) {
-Assert.assertEquals("Message count expected to be equal.", 
expectedCount,
+Assert.assertEquals("Member count expected to be equal.", 
expectedCount,
 channels[i].getMembers().length);
 }
 Member member = coordinators[0].getCoordinator();
@@ -84,10 +89,10 @@ public class TestNonBlockingCoordinator {
 /* Ignore */
 }
 }
+log.info("Coordinator[0] is:" + member);
 for (int i = 0; i < CHANNEL_COUNT; i++) {
-Assert.assertEquals(member, coordinators[i].getCoordinator());
+Assert.assertEquals("Local member" + 
channels[i].getLocalMember(false), member, coordinators[i].getCoordinator());
 }
-System.out.println("Coordinator[1] is:" + member);
 }
 
 @Test


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



[GitHub] [tomcat] kamnani commented on a change in pull request #331: Remove White Spaces and extra lines from the JSP files

2020-08-28 Thread GitBox


kamnani commented on a change in pull request #331:
URL: https://github.com/apache/tomcat/pull/331#discussion_r471563836



##
File path: java/org/apache/jasper/compiler/NewlineReductionServletWriter.java
##
@@ -0,0 +1,40 @@
+package org.apache.jasper.compiler;
+
+import java.io.PrintWriter;
+
+/**
+ * This class filters duplicate newlines instructions from the compiler output,
+ * and therefore from the runtime JSP. The duplicates typically happen because
+ * the compiler has multiple branches that write them, but they operate
+ * independently and don't realize that the previous output was identical.
+ *
+ * Removing these lines makes the JSP more efficient by executing fewer 
operations during runtime.
+ *
+ * @author Engebretson, John
+ * @author Kamnani, Jatin
+ *
+ */
+public class NewlineReductionServletWriter extends ServletWriter {
+private static final String NEWLINE_WRITE_TEXT = "out.write('\\n');";

Review comment:
   SMAP Support defaults to false, and this feature has a property which 
can be default to false as well. 
   Can you provide me the links where I can write the information on this patch 
?
   This pattern is generated if the JSP files have "\n" and the extra "\n" are 
trimmed of.
@markt-asf 
   





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

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



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



buildbot success in on tomcat-7-trunk

2020-08-28 Thread buildbot
The Buildbot has detected a restored build on builder tomcat-7-trunk while 
building tomcat. Full details are available at:
https://ci.apache.org/builders/tomcat-7-trunk/builds/1764

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

Buildslave for this Build: asf946_ubuntu

Build Reason: The AnyBranchScheduler scheduler named 'on-tomcat-7-commit' 
triggered this build
Build Source Stamp: [branch 7.0.x] 8b4205696e28034061a6e693ed9fa2258f3f483e
Blamelist: Mark Thomas 

Build succeeded!

Sincerely,
 -The Buildbot




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



Re: Fwd: Security concern about Tomcat's default value for HSTS MaxAge

2020-08-28 Thread Dave Wichers
So have you guys decided what you are going to do? Is there a dev ticket
open (that is public) that I can see and follow the progress on?

I'd like to get off this mailing list, as it generates lots of email that I
don't care about, but before I leave it, I'd like to understand the plan,
and how to track progress.

Thanks, Dave


On Wed, Aug 26, 2020 at 1:37 PM Dave Wichers  wrote:

> OK. Fair point. If you believe it is dangerous to just turn it on for
> real, as someone might do that in prod without knowing what they are doing,
> then I think Tomcat should generate a WARNING during startup that explains
> that HSTS is ON, but not yet doing anything, and maybe point them to an
> article that explains the uses/dangers of HSTS and how to configure it
> right, and test it thoroughly, before they actually turn it on in prod.
>
> As I said, I think turning it ON, but not really, and being silent about
> it is dangerous to the non-expert. And you say turning it ON automatically
> for the non-expert is dangerous too, and I agree. So what do you think
> about generating some kind of warning during startup along the lines I
> suggest?
>
> Maybe point them at an article like this:
> https://www.globalsign.com/en/blog/what-is-hsts-and-how-do-i-use-it -
> Although I would prefer a vendor neutral article provided by Apache or
> OWASP or something like that. I couldn't find one I liked with a quick
> Google search.
>
> -Dave
>
>
> On Wed, Aug 26, 2020 at 1:01 PM Christopher Schultz <
> ch...@christopherschultz.net> wrote:
>
>> -BEGIN PGP SIGNED MESSAGE-
>> Hash: SHA256
>>
>> Dave,
>>
>> On 8/25/20 14:05, Dave Wichers wrote:
>> > Per:
>> > https://tomcat.apache.org/tomcat-9.0-doc/config/filter.html#HTTP_Heade
>> r_Security_Filter
>> >
>> >
>> and
>> https://tomcat.apache.org/tomcat-8.5-doc/config/filter.html#HTTP_Header_
>> Security_Filter
>> >
>> > they both say:
>> >
>> > hstsMaxAgeSeconds  - The max age value that should be used in the
>> > HSTS header. Negative values will be treated as zero. If not
>> > specified, the default value of 0 will be used.
>> >
>> > So, if a Tomcat user (like I did at first), configures
>> > hstsEnabled=true, the HSTS response header is set by Tomcat, but
>> > with a max age of zero (since that is the default).
>> >
>> > However, per the HSTS RFC:
>> > https://tools.ietf.org/html/rfc6797#section-6.1.1 it says:
>> >
>> > NOTE:  A max-age value of zero (i.e., "max-age=0") signals the UA
>> > to cease regarding the host as a Known HSTS Host, including the
>> > includeSubDomains directive (if asserted for that HSTS Host).
>> >
>> > I noticed this problem when I first enabled HSTS on my Tomcat dev
>> > instance, and then passively scanned my web app with OWASP ZAP
>> > (https://owasp.org/www-project-zap/). ZAP, correctly I believe,
>> > pointed out that enabling HSTS with a MaxAge of zero is effectively
>> > a no-op. (i.e., does nothing).
>>
>> Correct.
>>
>> > If I'm correct, then I think having a default of zero is dangerous
>> > and should instead default to something useful and effective.
>>
>> I disagree.
>>
>> > Such as one year (in seconds) which is what many developers
>> > set/configure this value.  Otherwise, I think turning HSTS ON in
>> > Tomcat might be giving people a false sense of security because it
>> > really doesn't doing anything unless you also set MaxAge (which to
>> > me isn't intuitive that you should have to do that).
>> >
>> > Do you agree with me that this is a problem that should be fixed?
>> Here's why I disagree: if you configure your server to reply with
>> HSTS=on with a meaningful expiration, then the browser is *going to
>> enforce it*. If you have not configured it correctly, or you are just
>> testing, you can basically lock your site out from all clients for
>> e.g. a year before they are willing to re-connect to you.
>>
>> AFAIK, there is no recognized mitigation for "oops we enabled HSTS for
>> our site but actually we need parts of it to remain non-encrypted so
>> please please please forget we ever said anything about HSTS". If you
>> enable it and don't know what you are doing, you can SERIOUSLY fubar
>> your infrastructure.
>>
>> - -chris
>> -BEGIN PGP SIGNATURE-
>> Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/
>>
>> iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAl9GlU0ACgkQHPApP6U8
>> pFgQfQ//XnGay5wOwEIixUb/8PoioJHNLZLgqwShePVRnAkgyzCxRl+yWDonC7pX
>> BcA4MwI5d/UcivGILor2VH5WXZYeI0e/zlneMT5P9hz9cBrUM4YTSx/wdUNA8a12
>> mznC7T9fRZiUrgCHhEcgJaAL+rrPXDSAMVq6vVZBhTQBPd0igLmqxf1I8vA2hc8p
>> Rk8oa6mb2YLSNvIjJAGqYaV1VIg4oMyNjowi5RmpFn/4h3Kk3rnPWY3kFlvi8t3W
>> JGM3l7tGU8aFxrdCEVO+ypsCCtNsRbGWFGCaETITAHwYVnXEwk9wZNnOA51sJeQE
>> aRyyo6KyJi7nqKEjlsXV2DBqCmjv8ToWv1INyZrGxJXNojThbeWhexKjrKu8FOXW
>> RZMnOc6BMfQPb8673lGjLoGzcyjlgLSRhUTNwHaIwTGV8a6nK5+E/GNPr+x00Wei
>> KumMnm/AB1haBLRPgX+A5elneOnedPweWE00KqH7uBOkUbHCquwOf/9YnmsJBji+
>> KGIXecNk5pC2bwZF17ULYoC25UEBePyDbJNV5wEOZGLL+ayUtNFhtCSYB30+AWJT
>> 3CqbHb0oMsb9kGQkEqScklzOBRsmHx

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

2020-08-28 Thread GitBox


sakshamverma commented on a change in pull request #346:
URL: https://github.com/apache/tomcat/pull/346#discussion_r479393276



##
File path: java/org/apache/tomcat/websocket/Constants.java
##
@@ -114,6 +114,22 @@
 // Milliseconds so this is 20 seconds
 public static final long DEFAULT_BLOCKING_SEND_TIMEOUT = 20 * 1000;
 
+// Configuration for idle read timeout on websocket channel
+public static final String WS_READ_IDLE_TIMEOUT =
+"org.apache.tomcat.websocket.WS_READ_IDLE_TIMEOUT";
+
+// Configuration for idle write timeout on websocket channel
+public static final String WS_WRITE_IDLE_TIMEOUT =
+"org.apache.tomcat.websocket.WS_WRITE_IDLE_TIMEOUT";
+
+// Configuration for idle write timeout on websocket channel

Review comment:
   These were part of initial draft. 
   I intended to remove them. 
   Will do in next commit.





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 a change in pull request #346: Bug 64644 add custom properties to close connections on readIdletimeout

2020-08-28 Thread GitBox


sakshamverma commented on a change in pull request #346:
URL: https://github.com/apache/tomcat/pull/346#discussion_r479406856



##
File path: java/org/apache/tomcat/websocket/Constants.java
##
@@ -114,6 +114,22 @@
 // Milliseconds so this is 20 seconds
 public static final long DEFAULT_BLOCKING_SEND_TIMEOUT = 20 * 1000;
 
+// Configuration for idle read timeout on websocket channel
+public static final String WS_READ_IDLE_TIMEOUT =
+"org.apache.tomcat.websocket.WS_READ_IDLE_TIMEOUT";
+
+// Configuration for idle write timeout on websocket channel
+public static final String WS_WRITE_IDLE_TIMEOUT =
+"org.apache.tomcat.websocket.WS_WRITE_IDLE_TIMEOUT";
+
+// Configuration for idle write timeout on websocket channel
+public static final String WS_CLOSE_READ_IDLE_TIMEOUT =
+"org.apache.tomcat.websocket.WS_CLOSE_READ_IDLE_TIMEOUT";
+
+// Configuration for idle write timeout on websocket channel

Review comment:
   Removed the parameters which are not used





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] kamnani opened a new pull request #347: Jsp white space trim patch

2020-08-28 Thread GitBox


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


   The changes enables the compiler to remove excess white spaces and new lines 
from the JSP files & thus reduce the JVM metadata.
   
   This can be controlled by providing context init params inside `web.xml` 
file. For Example: 
   
   
   
   JSPWhiteSpaceTrimming
   true

   
   
   By Default this remains false, and thus the source JSP files will not 
reflect any changes compared to the previous builds.
   
   Note: 
   1 ) The changes do not affect to the  tags, to protect the 
behavioral changes on the tag. 
   2 ) This change is for Tomcat 9 Version. 
   3 ) Link to previous PR: https://github.com/apache/tomcat/pull/331
   
   If any official documentation is required, can you attach the links on the 
PR? 



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] kamnani closed pull request #347: Jsp white space trim patch

2020-08-28 Thread GitBox


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


   



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



Need to merge The patch for Bug 64644

2020-08-28 Thread Saksham Verma
Hi,

I am a thingworx developer and many of our customers are struggling due to
the bug https://bz.apache.org/bugzilla/show_bug.cgi?id=64644.

I have raised a PR
https://github.com/apache/tomcat/pull/346
It has one approval.

The PR is according to the suggestion from Mark on the bug
https://bz.apache.org/bugzilla/show_bug.cgi?id=64644#c4

It will be a great help to us (Thingworx) and to our customers if we could
get this merged and release it soon.

Could someone please review it and let me know what are the next steps to
get it merged?

Thanks,
Saksham


[GitHub] [tomcat] sakshamverma commented on pull request #330: BZ-64644 throw an Idle Session Event on idle timeout

2020-08-28 Thread GitBox


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


   @markt-asf 
   
   I have raised another PR https://github.com/apache/tomcat/pull/346 as per 
your suggestion. 
   
   Could you please let me know what are the next steps for it to merge? It 
will be a great help for our product (Thingworx) which uses tomcat as the 
webserver.



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