You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2020/10/01 09:21:50 UTC
[tomcat] 02/03: Refactor: remove unused parameter,
separate frame create and frame write
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
commit d9f9933c2c2b8b8b4226ff23bdc31ae16838ba0f
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Oct 1 10:18:01 2020 +0100
Refactor: remove unused parameter, separate frame create and frame write
---
test/org/apache/coyote/http2/Http2TestBase.java | 18 ++++++++----------
test/org/apache/coyote/http2/TestHttp2Section_6_8.java | 2 +-
2 files changed, 9 insertions(+), 11 deletions(-)
diff --git a/test/org/apache/coyote/http2/Http2TestBase.java b/test/org/apache/coyote/http2/Http2TestBase.java
index 167fd94..807c4a5 100644
--- a/test/org/apache/coyote/http2/Http2TestBase.java
+++ b/test/org/apache/coyote/http2/Http2TestBase.java
@@ -813,14 +813,9 @@ public abstract class Http2TestBase extends TomcatBaseTest {
}
- void sendGoaway(int streamId, int lastStreamId, long errorCode, byte[] debug)
- throws IOException {
+ byte[] buildGoaway(int streamId, int lastStreamId, long errorCode) {
byte[] goawayFrame = new byte[17];
- int len = 8;
- if (debug != null) {
- len += debug.length;
- }
- ByteUtil.setThreeBytes(goawayFrame, 0, len);
+ ByteUtil.setThreeBytes(goawayFrame, 0, 8);
// Type
goawayFrame[3] = FrameType.GOAWAY.getIdByte();
// No flags
@@ -829,10 +824,13 @@ public abstract class Http2TestBase extends TomcatBaseTest {
// Last stream
ByteUtil.set31Bits(goawayFrame, 9, lastStreamId);
ByteUtil.setFourBytes(goawayFrame, 13, errorCode);
+ return goawayFrame;
+ }
+
+
+ void sendGoaway(int streamId, int lastStreamId, long errorCode) throws IOException {
+ byte[] goawayFrame = buildGoaway(streamId, lastStreamId, errorCode);
os.write(goawayFrame);
- if (debug != null && debug.length > 0) {
- os.write(debug);
- }
os.flush();
}
diff --git a/test/org/apache/coyote/http2/TestHttp2Section_6_8.java b/test/org/apache/coyote/http2/TestHttp2Section_6_8.java
index c43a0b5..b80b1a9 100644
--- a/test/org/apache/coyote/http2/TestHttp2Section_6_8.java
+++ b/test/org/apache/coyote/http2/TestHttp2Section_6_8.java
@@ -76,7 +76,7 @@ public class TestHttp2Section_6_8 extends Http2TestBase {
// HTTP2 upgrade
http2Connect();
- sendGoaway(1, 1, Http2Error.NO_ERROR.getCode(), null);
+ sendGoaway(1, 1, Http2Error.NO_ERROR.getCode());
handleGoAwayResponse(1);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org