[tomcat] branch master updated: Fix test failure on Windows

2019-09-13 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 f3af77e  Fix test failure on Windows
f3af77e is described below

commit f3af77e465381489dafe4946bc1fe7d86bf4067a
Author: Mark Thomas 
AuthorDate: Fri Sep 13 18:05:47 2019 +0100

Fix test failure on Windows
---
 test/org/apache/coyote/http2/TestStreamProcessor.java | 19 ++-
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/test/org/apache/coyote/http2/TestStreamProcessor.java 
b/test/org/apache/coyote/http2/TestStreamProcessor.java
index 5f9651a..a4dd5f1 100644
--- a/test/org/apache/coyote/http2/TestStreamProcessor.java
+++ b/test/org/apache/coyote/http2/TestStreamProcessor.java
@@ -35,6 +35,7 @@ import org.junit.Test;
 import org.apache.catalina.Context;
 import org.apache.catalina.Wrapper;
 import org.apache.catalina.startup.Tomcat;
+import org.apache.tomcat.util.compat.JrePlatform;
 import org.apache.tomcat.util.http.FastHttpDateFormat;
 
 public class TestStreamProcessor extends Http2TestBase {
@@ -150,11 +151,19 @@ public class TestStreamProcessor extends Http2TestBase {
 
 parser.readFrame(true);
 
-Assert.assertEquals("3-HeadersStart\n" +
-"3-Header-[:status]-[304]\n" +
-"3-Header-[etag]-[W/\"934-1447269522000\"]\n" +
-"3-Header-[date]-[Wed, 11 Nov 2015 19:18:42 GMT]\n" +
-"3-HeadersEnd\n", output.getTrace());
+StringBuilder expected = new StringBuilder();
+expected.append("3-HeadersStart\n");
+expected.append("3-Header-[:status]-[304]\n");
+// Different line-endings -> different files size -> different weak 
eTag
+if (JrePlatform.IS_WINDOWS) {
+expected.append("3-Header-[etag]-[W/\"957-1447269522000\"]\n");
+} else {
+expected.append("3-Header-[etag]-[W/\"934-1447269522000\"]\n");
+}
+expected.append("3-Header-[date]-[Wed, 11 Nov 2015 19:18:42 GMT]\n");
+expected.append("3-HeadersEnd\n");
+
+Assert.assertEquals(expected.toString(), output.getTrace());
 }
 
 


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



[GitHub] [tomcat] KangZhiDong closed pull request #206: Fix typo

2019-09-13 Thread GitBox
KangZhiDong closed pull request #206: Fix typo
URL: https://github.com/apache/tomcat/pull/206
 
 
   


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


With regards,
Apache Git Services

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



[GitHub] [tomcat] KangZhiDong opened a new pull request #206: Fix typo

2019-09-13 Thread GitBox
KangZhiDong opened a new pull request #206: Fix typo
URL: https://github.com/apache/tomcat/pull/206
 
 
   remove redundant javadoc for clean


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


With regards,
Apache Git Services

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



buildbot success in on tomcat-trunk

2019-09-13 Thread buildbot
The Buildbot has detected a restored build on builder tomcat-trunk while 
building tomcat. Full details are available at:
https://ci.apache.org/builders/tomcat-trunk/builds/4604

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

Buildslave for this Build: asf946_ubuntu

Build Reason: The AnyBranchScheduler scheduler named 'on-tomcat-commit' 
triggered this build
Build Source Stamp: [branch master] 3aa05baa6b9cd3c907ecd55e1ebb340d8c9689ab
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



[Bug 63682] Async servlet over HTTP/2 non-blocking write hanging on certain flow control window update pattern from client

2019-09-13 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=63682

Mark Thomas  changed:

   What|Removed |Added

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

--- Comment #2 from Mark Thomas  ---
Thanks for the test case. There was a timing factor at play here that would
have made this rather tricky to track down without the test case.

Fixed in:
- master for 9.0.25 onwards
- 8.5.x for 8.5.46 onwards

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



[tomcat] 01/02: Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=63682 HTTP/2 hang

2019-09-13 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

commit d57e1ca2fc25c9234caed8d74ec741585ff59256
Author: Mark Thomas 
AuthorDate: Fri Sep 13 16:37:55 2019 +0100

Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=63682 HTTP/2 hang

Fix a potential hang when using the asynchronous Servlet API to write
the response body and the stream and/or connection window reaches 0
bytes in size.
---
 java/org/apache/coyote/http2/Stream.java| 12 +---
 .../apache/coyote/http2/WindowAllocationManager.java| 17 +
 webapps/docs/changelog.xml  |  5 +
 3 files changed, 31 insertions(+), 3 deletions(-)

diff --git a/java/org/apache/coyote/http2/Stream.java 
b/java/org/apache/coyote/http2/Stream.java
index a25edfe..6b6eb93 100644
--- a/java/org/apache/coyote/http2/Stream.java
+++ b/java/org/apache/coyote/http2/Stream.java
@@ -937,12 +937,18 @@ public class Stream extends AbstractStream implements 
HeaderEmitter {
 }
 
 synchronized boolean isReady() {
-if (getWindowSize() > 0 && handler.getWindowSize() > 0 && 
!dataLeft) {
-return true;
-} else {
+// Bug 63682
+// Only want to return false if the window size is zero AND we are
+// already waiting for an allocation.
+if (getWindowSize() > 0 && allocationManager.isWaitingForStream() 
||
+handler.getWindowSize() > 0 && 
allocationManager.isWaitingForConnection() ||
+dataLeft) {
 writeInterest = true;
 return false;
+} else {
+return true;
 }
+
 }
 
 synchronized boolean isRegisteredForWrite() {
diff --git a/java/org/apache/coyote/http2/WindowAllocationManager.java 
b/java/org/apache/coyote/http2/WindowAllocationManager.java
index da7aebe..f286430 100644
--- a/java/org/apache/coyote/http2/WindowAllocationManager.java
+++ b/java/org/apache/coyote/http2/WindowAllocationManager.java
@@ -119,6 +119,23 @@ class WindowAllocationManager {
 }
 
 
+boolean isWaitingForStream() {
+return isWaitingFor(STREAM);
+}
+
+
+boolean isWaitingForConnection() {
+return isWaitingFor(CONNECTION);
+}
+
+
+private boolean isWaitingFor(int waitTarget) {
+synchronized (stream) {
+return (waitingFor & waitTarget) > 0;
+}
+}
+
+
 private void waitFor(int waitTarget, long timeout) throws 
InterruptedException {
 synchronized (stream) {
 if (waitingFor != NONE) {
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index a0e538e..75c640c 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -62,6 +62,11 @@
   
 
   
+63682: Fix a potential hang when using the asynchronous
+Servlet API to write the response body and the stream and/or connection
+window reaches 0 bytes in size. (markt)
+  
+  
 63690: Use the average of the current and previous sizes 
when
 calculating overhead for HTTP/2 DATA and
 WINDOW_UPDATE frames to avoid false positives as a result


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



[tomcat] 02/02: Clean-up. Remove unused code. Align with 9.0.x.

2019-09-13 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

commit 5ee1614cfe9ee6511d77c422957eadc486db1dc8
Author: Mark Thomas 
AuthorDate: Fri Sep 13 16:56:09 2019 +0100

Clean-up. Remove unused code. Align with 9.0.x.
---
 java/org/apache/coyote/http2/Stream.java | 14 +-
 1 file changed, 1 insertion(+), 13 deletions(-)

diff --git a/java/org/apache/coyote/http2/Stream.java 
b/java/org/apache/coyote/http2/Stream.java
index 6b6eb93..32de3fe 100644
--- a/java/org/apache/coyote/http2/Stream.java
+++ b/java/org/apache/coyote/http2/Stream.java
@@ -376,7 +376,7 @@ public class Stream extends AbstractStream implements 
HeaderEmitter {
 headerState = HEADER_STATE_REGULAR;
 }
 
-switch(name) {
+switch (name) {
 case ":method": {
 if (coyoteRequest.method().isNull()) {
 coyoteRequest.method().setString(value);
@@ -777,7 +777,6 @@ public class Stream extends AbstractStream implements 
HeaderEmitter {
 private volatile boolean closed = false;
 private volatile StreamException reset = null;
 private volatile boolean endOfStreamSent = false;
-private volatile boolean writeInterest = false;
 
 /* The write methods are synchronized to ensure that only one thread at
  * a time is able to access the buffer. Without this protection, a
@@ -943,21 +942,10 @@ public class Stream extends AbstractStream implements 
HeaderEmitter {
 if (getWindowSize() > 0 && allocationManager.isWaitingForStream() 
||
 handler.getWindowSize() > 0 && 
allocationManager.isWaitingForConnection() ||
 dataLeft) {
-writeInterest = true;
 return false;
 } else {
 return true;
 }
-
-}
-
-synchronized boolean isRegisteredForWrite() {
-if (writeInterest) {
-writeInterest = false;
-return true;
-} else {
-return false;
-}
 }
 
 @Override


-
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 (cc10604 -> 5ee1614)

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

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


from cc10604  eTags vary. Force HTTP/2 tests to use a constant value.
 new d57e1ca  Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=63682 
HTTP/2 hang
 new 5ee1614  Clean-up. Remove unused code. Align with 9.0.x.

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:
 java/org/apache/coyote/http2/Stream.java   | 22 --
 .../coyote/http2/WindowAllocationManager.java  | 17 +
 webapps/docs/changelog.xml |  5 +
 3 files changed, 30 insertions(+), 14 deletions(-)


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



[tomcat] branch master updated: Revert debugging changes for testing BZ 63682

2019-09-13 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 3aa05ba  Revert debugging changes for testing BZ 63682
3aa05ba is described below

commit 3aa05baa6b9cd3c907ecd55e1ebb340d8c9689ab
Author: Mark Thomas 
AuthorDate: Fri Sep 13 16:48:04 2019 +0100

Revert debugging changes for testing BZ 63682
---
 .../coyote/http2/WindowAllocationManager.java  | 42 +++---
 1 file changed, 21 insertions(+), 21 deletions(-)

diff --git a/java/org/apache/coyote/http2/WindowAllocationManager.java 
b/java/org/apache/coyote/http2/WindowAllocationManager.java
index ee865b0..f286430 100644
--- a/java/org/apache/coyote/http2/WindowAllocationManager.java
+++ b/java/org/apache/coyote/http2/WindowAllocationManager.java
@@ -65,40 +65,40 @@ class WindowAllocationManager {
 }
 
 void waitForStream(long timeout) throws InterruptedException {
-//if (log.isDebugEnabled()) {
-log.info(sm.getString("windowAllocationManager.waitFor.stream",
+if (log.isDebugEnabled()) {
+log.debug(sm.getString("windowAllocationManager.waitFor.stream",
 stream.getConnectionId(), stream.getIdentifier(), 
Long.toString(timeout)));
-//}
+}
 
 waitFor(STREAM, timeout);
 }
 
 
 void waitForConnection(long timeout) throws InterruptedException {
-//if (log.isDebugEnabled()) {
-log.info(sm.getString("windowAllocationManager.waitFor.connection",
+if (log.isDebugEnabled()) {
+
log.debug(sm.getString("windowAllocationManager.waitFor.connection",
 stream.getConnectionId(), stream.getIdentifier(), 
Long.toString(timeout)));
-//}
+}
 
 waitFor(CONNECTION, timeout);
 }
 
 
 void waitForStreamNonBlocking() {
-//if (log.isDebugEnabled()) {
-
log.info(sm.getString("windowAllocationManager.waitForNonBlocking.stream",
+if (log.isDebugEnabled()) {
+
log.debug(sm.getString("windowAllocationManager.waitForNonBlocking.stream",
 stream.getConnectionId(), stream.getIdentifier()));
-//}
+}
 
 waitForNonBlocking(STREAM);
 }
 
 
 void waitForConnectionNonBlocking() {
-//if (log.isDebugEnabled()) {
-
log.info(sm.getString("windowAllocationManager.waitForNonBlocking.connection",
+if (log.isDebugEnabled()) {
+
log.debug(sm.getString("windowAllocationManager.waitForNonBlocking.connection",
 stream.getConnectionId(), stream.getIdentifier()));
-//}
+}
 
 waitForNonBlocking(CONNECTION);
 }
@@ -171,10 +171,10 @@ class WindowAllocationManager {
 
 
 private void notify(int notifyTarget) {
-//if (log.isDebugEnabled()) {
-log.info(sm.getString("windowAllocationManager.notify", 
stream.getConnectionId(),
+if (log.isDebugEnabled()) {
+log.debug(sm.getString("windowAllocationManager.notify", 
stream.getConnectionId(),
 stream.getIdentifier(), Integer.toString(waitingFor), 
Integer.toString(notifyTarget)));
-//}
+}
 
 synchronized (stream) {
 if ((notifyTarget & waitingFor) > NONE) {
@@ -186,17 +186,17 @@ class WindowAllocationManager {
 waitingFor = NONE;
 if (stream.getCoyoteResponse().getWriteListener() == null) {
 // Blocking, so use notify to release StreamOutputBuffer
-//if (log.isDebugEnabled()) {
-
log.info(sm.getString("windowAllocationManager.notified",
+if (log.isDebugEnabled()) {
+
log.debug(sm.getString("windowAllocationManager.notified",
 stream.getConnectionId(), 
stream.getIdentifier()));
-//}
+}
 stream.notify();
 } else {
 // Non-blocking so dispatch
-//if (log.isDebugEnabled()) {
-
log.info(sm.getString("windowAllocationManager.dispatched",
+if (log.isDebugEnabled()) {
+
log.debug(sm.getString("windowAllocationManager.dispatched",
 stream.getConnectionId(), 
stream.getIdentifier()));
-//}
+}
 
stream.getCoyoteResponse().action(ActionCode.DISPATCH_WRITE, null);
 // Need to explicitly execute dispatches on the 
StreamProcessor
 // as this thread is being processed by an UpgradeProcessor


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

[tomcat] branch master updated: Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=63682 HTTP/2 hang

2019-09-13 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 d3d1dc6  Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=63682 
HTTP/2 hang
d3d1dc6 is described below

commit d3d1dc644ba83ca24c13879cc7d2ca1a8df298bf
Author: Mark Thomas 
AuthorDate: Fri Sep 13 16:37:55 2019 +0100

Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=63682 HTTP/2 hang

Fix a potential hang when using the asynchronous Servlet API to write
the response body and the stream and/or connection window reaches 0
bytes in size.
---
 java/org/apache/coyote/http2/Stream.java   | 11 ++--
 .../coyote/http2/WindowAllocationManager.java  | 59 ++
 webapps/docs/changelog.xml |  5 ++
 3 files changed, 51 insertions(+), 24 deletions(-)

diff --git a/java/org/apache/coyote/http2/Stream.java 
b/java/org/apache/coyote/http2/Stream.java
index 3de2b9f..65d636d 100644
--- a/java/org/apache/coyote/http2/Stream.java
+++ b/java/org/apache/coyote/http2/Stream.java
@@ -958,10 +958,15 @@ class Stream extends AbstractStream implements 
HeaderEmitter {
 }
 
 final synchronized boolean isReady() {
-if (getWindowSize() > 0 && handler.getWindowSize() > 0 && 
!dataLeft) {
-return true;
-} else {
+// Bug 63682
+// Only want to return false if the window size is zero AND we are
+// already waiting for an allocation.
+if (getWindowSize() > 0 && allocationManager.isWaitingForStream() 
||
+handler.getWindowSize() > 0 && 
allocationManager.isWaitingForConnection() ||
+dataLeft) {
 return false;
+} else {
+return true;
 }
 }
 
diff --git a/java/org/apache/coyote/http2/WindowAllocationManager.java 
b/java/org/apache/coyote/http2/WindowAllocationManager.java
index da7aebe..ee865b0 100644
--- a/java/org/apache/coyote/http2/WindowAllocationManager.java
+++ b/java/org/apache/coyote/http2/WindowAllocationManager.java
@@ -65,40 +65,40 @@ class WindowAllocationManager {
 }
 
 void waitForStream(long timeout) throws InterruptedException {
-if (log.isDebugEnabled()) {
-log.debug(sm.getString("windowAllocationManager.waitFor.stream",
+//if (log.isDebugEnabled()) {
+log.info(sm.getString("windowAllocationManager.waitFor.stream",
 stream.getConnectionId(), stream.getIdentifier(), 
Long.toString(timeout)));
-}
+//}
 
 waitFor(STREAM, timeout);
 }
 
 
 void waitForConnection(long timeout) throws InterruptedException {
-if (log.isDebugEnabled()) {
-
log.debug(sm.getString("windowAllocationManager.waitFor.connection",
+//if (log.isDebugEnabled()) {
+log.info(sm.getString("windowAllocationManager.waitFor.connection",
 stream.getConnectionId(), stream.getIdentifier(), 
Long.toString(timeout)));
-}
+//}
 
 waitFor(CONNECTION, timeout);
 }
 
 
 void waitForStreamNonBlocking() {
-if (log.isDebugEnabled()) {
-
log.debug(sm.getString("windowAllocationManager.waitForNonBlocking.stream",
+//if (log.isDebugEnabled()) {
+
log.info(sm.getString("windowAllocationManager.waitForNonBlocking.stream",
 stream.getConnectionId(), stream.getIdentifier()));
-}
+//}
 
 waitForNonBlocking(STREAM);
 }
 
 
 void waitForConnectionNonBlocking() {
-if (log.isDebugEnabled()) {
-
log.debug(sm.getString("windowAllocationManager.waitForNonBlocking.connection",
+//if (log.isDebugEnabled()) {
+
log.info(sm.getString("windowAllocationManager.waitForNonBlocking.connection",
 stream.getConnectionId(), stream.getIdentifier()));
-}
+//}
 
 waitForNonBlocking(CONNECTION);
 }
@@ -119,6 +119,23 @@ class WindowAllocationManager {
 }
 
 
+boolean isWaitingForStream() {
+return isWaitingFor(STREAM);
+}
+
+
+boolean isWaitingForConnection() {
+return isWaitingFor(CONNECTION);
+}
+
+
+private boolean isWaitingFor(int waitTarget) {
+synchronized (stream) {
+return (waitingFor & waitTarget) > 0;
+}
+}
+
+
 private void waitFor(int waitTarget, long timeout) throws 
InterruptedException {
 synchronized (stream) {
 if (waitingFor != NONE) {
@@ -154,10 +171,10 @@ class WindowAllocationManager {
 
 
 private void notify(int notifyTarget) {
-if (log.isDebugEnabled()) {
-log.debug(sm.getString("windowAllocationManager.notify", 
stream.getConnectionId(),
+//if (log.isDebugEnabled()) {
+  

[Bug 63682] Async servlet over HTTP/2 non-blocking write hanging on certain flow control window update pattern from client

2019-09-13 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=63682

--- Comment #1 from Mark Thomas  ---
Sorry I haven't responded to this for a while. It has been on the TODO list for
before the next release and I have been working on it on and off but I only
made progress today.

I believe I have identified the root cause. Hopefully I'll have a patch for
this shortly.

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



buildbot success in on tomcat-85-trunk

2019-09-13 Thread buildbot
The Buildbot has detected a restored build on builder tomcat-85-trunk while 
building tomcat. Full details are available at:
https://ci.apache.org/builders/tomcat-85-trunk/builds/1934

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

Buildslave for this Build: asf946_ubuntu

Build Reason: The AnyBranchScheduler scheduler named 'on-tomcat-85-commit' 
triggered this build
Build Source Stamp: [branch 8.5.x] cc106048805fd4f4bcc306648d5b33d2914ebdb8
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



[Bug 63747] Incorrect link for "First webapp" in User Guide section

2019-09-13 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=63747

Mark Thomas  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |INVALID

--- Comment #1 from Mark Thomas  ---
That link has been the correct value of "appdev/index.html" for the last 13
years.

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



[tomcat] branch 8.5.x updated: eTags vary. Force HTTP/2 tests to use a constant value.

2019-09-13 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 cc10604  eTags vary. Force HTTP/2 tests to use a constant value.
cc10604 is described below

commit cc106048805fd4f4bcc306648d5b33d2914ebdb8
Author: Mark Thomas 
AuthorDate: Fri Sep 13 09:09:30 2019 +0100

eTags vary. Force HTTP/2 tests to use a constant value.
---
 test/org/apache/coyote/http2/Http2TestBase.java   | 10 +-
 test/org/apache/coyote/http2/TestStreamProcessor.java |  2 +-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/test/org/apache/coyote/http2/Http2TestBase.java 
b/test/org/apache/coyote/http2/Http2TestBase.java
index 4630804..8ff1176 100644
--- a/test/org/apache/coyote/http2/Http2TestBase.java
+++ b/test/org/apache/coyote/http2/Http2TestBase.java
@@ -50,6 +50,7 @@ import org.apache.coyote.http2.HpackDecoder.HeaderEmitter;
 import org.apache.coyote.http2.Http2Parser.Input;
 import org.apache.coyote.http2.Http2Parser.Output;
 import org.apache.tomcat.util.codec.binary.Base64;
+import org.apache.tomcat.util.http.FastHttpDateFormat;
 import org.apache.tomcat.util.http.MimeHeaders;
 
 /**
@@ -62,6 +63,7 @@ public abstract class Http2TestBase extends TomcatBaseTest {
 // test that demonstrated that most HTTP/2 tests were failing because the
 // response now included a date header
 protected static final String DEFAULT_DATE = "Wed, 11 Nov 2015 19:18:42 
GMT";
+protected static final long DEFAULT_TIME = 
FastHttpDateFormat.parseDate(DEFAULT_DATE);
 
 private static final String HEADER_IGNORED = "x-ignore";
 
@@ -1025,9 +1027,15 @@ public abstract class Http2TestBase extends 
TomcatBaseTest {
 
 @Override
 public void emitHeader(String name, String value) {
-// Date headers will always change so use a hard-coded default
 if ("date".equals(name)) {
+// Date headers will always change so use a hard-coded default
 value = DEFAULT_DATE;
+} else if ("etag".equals(name) && value.startsWith("W/\"")) {
+// etag headers will vary depending on when the source was
+// checked out, unpacked, copied etc so use the same default as
+// for date headers
+int startOfTime = value.indexOf('-');
+value = value.substring(0, startOfTime + 1) + DEFAULT_TIME + 
"\"";
 }
 // Some header values vary so ignore them
 if (HEADER_IGNORED.equals(name)) {
diff --git a/test/org/apache/coyote/http2/TestStreamProcessor.java 
b/test/org/apache/coyote/http2/TestStreamProcessor.java
index 821fa40..5f9651a 100644
--- a/test/org/apache/coyote/http2/TestStreamProcessor.java
+++ b/test/org/apache/coyote/http2/TestStreamProcessor.java
@@ -152,7 +152,7 @@ public class TestStreamProcessor extends Http2TestBase {
 
 Assert.assertEquals("3-HeadersStart\n" +
 "3-Header-[:status]-[304]\n" +
-"3-Header-[etag]-[W/\"934-1567674491000\"]\n" +
+"3-Header-[etag]-[W/\"934-1447269522000\"]\n" +
 "3-Header-[date]-[Wed, 11 Nov 2015 19:18:42 GMT]\n" +
 "3-HeadersEnd\n", output.getTrace());
 }


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



[tomcat] branch master updated: eTags vary. Force HTTP/2 tests to use a constant value.

2019-09-13 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 fc7001a  eTags vary. Force HTTP/2 tests to use a constant value.
fc7001a is described below

commit fc7001a3da69608f98726883e03321eb6eddb50d
Author: Mark Thomas 
AuthorDate: Fri Sep 13 09:09:30 2019 +0100

eTags vary. Force HTTP/2 tests to use a constant value.
---
 test/org/apache/coyote/http2/Http2TestBase.java   | 10 +-
 test/org/apache/coyote/http2/TestStreamProcessor.java |  2 +-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/test/org/apache/coyote/http2/Http2TestBase.java 
b/test/org/apache/coyote/http2/Http2TestBase.java
index 92ee6e0..a394927 100644
--- a/test/org/apache/coyote/http2/Http2TestBase.java
+++ b/test/org/apache/coyote/http2/Http2TestBase.java
@@ -51,6 +51,7 @@ import org.apache.coyote.http2.Http2Parser.Input;
 import org.apache.coyote.http2.Http2Parser.Output;
 import org.apache.tomcat.util.codec.binary.Base64;
 import org.apache.tomcat.util.compat.JrePlatform;
+import org.apache.tomcat.util.http.FastHttpDateFormat;
 import org.apache.tomcat.util.http.MimeHeaders;
 
 /**
@@ -69,6 +70,7 @@ public abstract class Http2TestBase extends TomcatBaseTest {
 // test that demonstrated that most HTTP/2 tests were failing because the
 // response now included a date header
 protected static final String DEFAULT_DATE = "Wed, 11 Nov 2015 19:18:42 
GMT";
+protected static final long DEFAULT_TIME = 
FastHttpDateFormat.parseDate(DEFAULT_DATE);
 
 private static final String HEADER_IGNORED = "x-ignore";
 
@@ -1022,9 +1024,15 @@ public abstract class Http2TestBase extends 
TomcatBaseTest {
 
 @Override
 public void emitHeader(String name, String value) {
-// Date headers will always change so use a hard-coded default
 if ("date".equals(name)) {
+// Date headers will always change so use a hard-coded default
 value = DEFAULT_DATE;
+} else if ("etag".equals(name) && value.startsWith("W/\"")) {
+// etag headers will vary depending on when the source was
+// checked out, unpacked, copied etc so use the same default as
+// for date headers
+int startOfTime = value.indexOf('-');
+value = value.substring(0, startOfTime + 1) + DEFAULT_TIME + 
"\"";
 }
 // Some header values vary so ignore them
 if (HEADER_IGNORED.equals(name)) {
diff --git a/test/org/apache/coyote/http2/TestStreamProcessor.java 
b/test/org/apache/coyote/http2/TestStreamProcessor.java
index 821fa40..5f9651a 100644
--- a/test/org/apache/coyote/http2/TestStreamProcessor.java
+++ b/test/org/apache/coyote/http2/TestStreamProcessor.java
@@ -152,7 +152,7 @@ public class TestStreamProcessor extends Http2TestBase {
 
 Assert.assertEquals("3-HeadersStart\n" +
 "3-Header-[:status]-[304]\n" +
-"3-Header-[etag]-[W/\"934-1567674491000\"]\n" +
+"3-Header-[etag]-[W/\"934-1447269522000\"]\n" +
 "3-Header-[date]-[Wed, 11 Nov 2015 19:18:42 GMT]\n" +
 "3-HeadersEnd\n", output.getTrace());
 }


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