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 <ma...@apache.org> 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