Removed redundant ClienetSpecConfig, reused and extend exists config.Config
This commit is contained in:
Родитель
29ced674e0
Коммит
42eb36f845
|
@ -11,7 +11,7 @@ func StartingHTTP2() *spec.ClientTestGroup {
|
||||||
tg.AddTestCase(&spec.ClientTestCase{
|
tg.AddTestCase(&spec.ClientTestCase{
|
||||||
Desc: "Sends a client connection preface",
|
Desc: "Sends a client connection preface",
|
||||||
Requirement: "The endpoint MUST accept client connection preface.",
|
Requirement: "The endpoint MUST accept client connection preface.",
|
||||||
Run: func(c *config.ClientSpecConfig, conn *spec.Conn, req *spec.Request) error {
|
Run: func(c *config.Config, conn *spec.Conn, req *spec.Request) error {
|
||||||
conn.WriteSuccessResponse(req.StreamID, c)
|
conn.WriteSuccessResponse(req.StreamID, c)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -14,7 +14,7 @@ func FrameFormat() *spec.ClientTestGroup {
|
||||||
tg.AddTestCase(&spec.ClientTestCase{
|
tg.AddTestCase(&spec.ClientTestCase{
|
||||||
Desc: "Sends a frame with unknown type",
|
Desc: "Sends a frame with unknown type",
|
||||||
Requirement: "The endpoint MUST ignore and discard any frame that has a type that is unknown.",
|
Requirement: "The endpoint MUST ignore and discard any frame that has a type that is unknown.",
|
||||||
Run: func(c *config.ClientSpecConfig, conn *spec.Conn, req *spec.Request) error {
|
Run: func(c *config.Config, conn *spec.Conn, req *spec.Request) error {
|
||||||
// UNKONWN Frame:
|
// UNKONWN Frame:
|
||||||
// Length: 8, Type: 255, Flags: 0, R: 0, StreamID: 0
|
// Length: 8, Type: 255, Flags: 0, R: 0, StreamID: 0
|
||||||
conn.Send([]byte("\x00\x00\x08\x16\x00\x00\x00\x00\x00"))
|
conn.Send([]byte("\x00\x00\x08\x16\x00\x00\x00\x00\x00"))
|
||||||
|
@ -36,7 +36,7 @@ func FrameFormat() *spec.ClientTestGroup {
|
||||||
tg.AddTestCase(&spec.ClientTestCase{
|
tg.AddTestCase(&spec.ClientTestCase{
|
||||||
Desc: "Sends a frame with undefined flag",
|
Desc: "Sends a frame with undefined flag",
|
||||||
Requirement: "The endpoint MUST ignore any flags that is undefined.",
|
Requirement: "The endpoint MUST ignore any flags that is undefined.",
|
||||||
Run: func(c *config.ClientSpecConfig, conn *spec.Conn, req *spec.Request) error {
|
Run: func(c *config.Config, conn *spec.Conn, req *spec.Request) error {
|
||||||
// PING Frame:
|
// PING Frame:
|
||||||
// Length: 8, Type: 6, Flags: 255, R: 0, StreamID: 0
|
// Length: 8, Type: 6, Flags: 255, R: 0, StreamID: 0
|
||||||
conn.Send([]byte("\x00\x00\x08\x06\x16\x00\x00\x00\x00"))
|
conn.Send([]byte("\x00\x00\x08\x06\x16\x00\x00\x00\x00"))
|
||||||
|
@ -54,7 +54,7 @@ func FrameFormat() *spec.ClientTestGroup {
|
||||||
tg.AddTestCase(&spec.ClientTestCase{
|
tg.AddTestCase(&spec.ClientTestCase{
|
||||||
Desc: "Sends a frame with reserved field bit",
|
Desc: "Sends a frame with reserved field bit",
|
||||||
Requirement: "The endpoint MUST ignore the value of reserved field.",
|
Requirement: "The endpoint MUST ignore the value of reserved field.",
|
||||||
Run: func(c *config.ClientSpecConfig, conn *spec.Conn, req *spec.Request) error {
|
Run: func(c *config.Config, conn *spec.Conn, req *spec.Request) error {
|
||||||
// PING Frame:
|
// PING Frame:
|
||||||
// Length: 8, Type: 6, Flags: 255, R: 1, StreamID: 0
|
// Length: 8, Type: 6, Flags: 255, R: 1, StreamID: 0
|
||||||
conn.Send([]byte("\x00\x00\x08\x06\x16\x80\x00\x00\x00"))
|
conn.Send([]byte("\x00\x00\x08\x06\x16\x80\x00\x00\x00"))
|
||||||
|
|
|
@ -15,7 +15,7 @@ func FrameSize() *spec.ClientTestGroup {
|
||||||
tg.AddTestCase(&spec.ClientTestCase{
|
tg.AddTestCase(&spec.ClientTestCase{
|
||||||
Desc: "Sends a DATA frame with 2^14 octets in length",
|
Desc: "Sends a DATA frame with 2^14 octets in length",
|
||||||
Requirement: "The endpoint MUST be capable of receiving and minimally processing frames up to 2^14 octets in length.",
|
Requirement: "The endpoint MUST be capable of receiving and minimally processing frames up to 2^14 octets in length.",
|
||||||
Run: func(c *config.ClientSpecConfig, conn *spec.Conn, req *spec.Request) error {
|
Run: func(c *config.Config, conn *spec.Conn, req *spec.Request) error {
|
||||||
headers := spec.CommonRespHeaders(c)
|
headers := spec.CommonRespHeaders(c)
|
||||||
|
|
||||||
hp := http2.HeadersFrameParam{
|
hp := http2.HeadersFrameParam{
|
||||||
|
@ -44,7 +44,7 @@ func FrameSize() *spec.ClientTestGroup {
|
||||||
tg.AddTestCase(&spec.ClientTestCase{
|
tg.AddTestCase(&spec.ClientTestCase{
|
||||||
Desc: "Sends a large size DATA frame that exceeds the SETTINGS_MAX_FRAME_SIZE",
|
Desc: "Sends a large size DATA frame that exceeds the SETTINGS_MAX_FRAME_SIZE",
|
||||||
Requirement: "The endpoint MUST send an error code of FRAME_SIZE_ERROR.",
|
Requirement: "The endpoint MUST send an error code of FRAME_SIZE_ERROR.",
|
||||||
Run: func(c *config.ClientSpecConfig, conn *spec.Conn, req *spec.Request) error {
|
Run: func(c *config.Config, conn *spec.Conn, req *spec.Request) error {
|
||||||
headers := spec.CommonRespHeaders(c)
|
headers := spec.CommonRespHeaders(c)
|
||||||
|
|
||||||
hp := http2.HeadersFrameParam{
|
hp := http2.HeadersFrameParam{
|
||||||
|
@ -71,7 +71,7 @@ func FrameSize() *spec.ClientTestGroup {
|
||||||
tg.AddTestCase(&spec.ClientTestCase{
|
tg.AddTestCase(&spec.ClientTestCase{
|
||||||
Desc: "Sends a large size HEADERS frame that exceeds the SETTINGS_MAX_FRAME_SIZE",
|
Desc: "Sends a large size HEADERS frame that exceeds the SETTINGS_MAX_FRAME_SIZE",
|
||||||
Requirement: "The endpoint MUST respond with a connection error of type FRAME_SIZE_ERROR.",
|
Requirement: "The endpoint MUST respond with a connection error of type FRAME_SIZE_ERROR.",
|
||||||
Run: func(c *config.ClientSpecConfig, conn *spec.Conn, req *spec.Request) error {
|
Run: func(c *config.Config, conn *spec.Conn, req *spec.Request) error {
|
||||||
headers := spec.CommonRespHeaders(c)
|
headers := spec.CommonRespHeaders(c)
|
||||||
headers = append(headers, spec.DummyRespHeaders(c, 5)...)
|
headers = append(headers, spec.DummyRespHeaders(c, 5)...)
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ func HeaderCompressionAndDecompression() *spec.ClientTestGroup {
|
||||||
tg.AddTestCase(&spec.ClientTestCase{
|
tg.AddTestCase(&spec.ClientTestCase{
|
||||||
Desc: "Sends invalid header block fragment",
|
Desc: "Sends invalid header block fragment",
|
||||||
Requirement: "The endpoint MUST terminate the connection with a connection error of type COMPRESSION_ERROR.",
|
Requirement: "The endpoint MUST terminate the connection with a connection error of type COMPRESSION_ERROR.",
|
||||||
Run: func(c *config.ClientSpecConfig, conn *spec.Conn, req *spec.Request) error {
|
Run: func(c *config.Config, conn *spec.Conn, req *spec.Request) error {
|
||||||
// Literal Header Field with Incremental Indexing without
|
// Literal Header Field with Incremental Indexing without
|
||||||
// Length and String segment.
|
// Length and String segment.
|
||||||
data := new(bytes.Buffer)
|
data := new(bytes.Buffer)
|
||||||
|
|
|
@ -15,7 +15,7 @@ func StreamIdentifiers() *spec.ClientTestGroup {
|
||||||
tg.AddTestCase(&spec.ClientTestCase{
|
tg.AddTestCase(&spec.ClientTestCase{
|
||||||
Desc: "Sends odd-numbered stream identifier",
|
Desc: "Sends odd-numbered stream identifier",
|
||||||
Requirement: "The endpoint MUST respond with a connection error of type PROTOCOL_ERROR.",
|
Requirement: "The endpoint MUST respond with a connection error of type PROTOCOL_ERROR.",
|
||||||
Run: func(c *config.ClientSpecConfig, conn *spec.Conn, req *spec.Request) error {
|
Run: func(c *config.Config, conn *spec.Conn, req *spec.Request) error {
|
||||||
headers := spec.CommonRespHeaders(c)
|
headers := spec.CommonRespHeaders(c)
|
||||||
hp := http2.HeadersFrameParam{
|
hp := http2.HeadersFrameParam{
|
||||||
StreamID: req.StreamID + 2,
|
StreamID: req.StreamID + 2,
|
||||||
|
|
|
@ -16,7 +16,7 @@ func StreamStates() *spec.ClientTestGroup {
|
||||||
tg.AddTestCase(&spec.ClientTestCase{
|
tg.AddTestCase(&spec.ClientTestCase{
|
||||||
Desc: "idle: Sends a DATA frame",
|
Desc: "idle: Sends a DATA frame",
|
||||||
Requirement: "The endpoint MUST treat this as a connection error of type PROTOCOL_ERROR.",
|
Requirement: "The endpoint MUST treat this as a connection error of type PROTOCOL_ERROR.",
|
||||||
Run: func(c *config.ClientSpecConfig, conn *spec.Conn, req *spec.Request) error {
|
Run: func(c *config.Config, conn *spec.Conn, req *spec.Request) error {
|
||||||
conn.WriteData(2, true, []byte("test"))
|
conn.WriteData(2, true, []byte("test"))
|
||||||
|
|
||||||
return spec.VerifyConnectionError(conn, http2.ErrCodeProtocol)
|
return spec.VerifyConnectionError(conn, http2.ErrCodeProtocol)
|
||||||
|
@ -30,7 +30,7 @@ func StreamStates() *spec.ClientTestGroup {
|
||||||
tg.AddTestCase(&spec.ClientTestCase{
|
tg.AddTestCase(&spec.ClientTestCase{
|
||||||
Desc: "idle: Sends a RST_STREAM frame",
|
Desc: "idle: Sends a RST_STREAM frame",
|
||||||
Requirement: "The endpoint MUST treat this as a connection error of type PROTOCOL_ERROR.",
|
Requirement: "The endpoint MUST treat this as a connection error of type PROTOCOL_ERROR.",
|
||||||
Run: func(c *config.ClientSpecConfig, conn *spec.Conn, req *spec.Request) error {
|
Run: func(c *config.Config, conn *spec.Conn, req *spec.Request) error {
|
||||||
conn.WriteRSTStream(2, http2.ErrCodeCancel)
|
conn.WriteRSTStream(2, http2.ErrCodeCancel)
|
||||||
|
|
||||||
return spec.VerifyConnectionError(conn, http2.ErrCodeProtocol)
|
return spec.VerifyConnectionError(conn, http2.ErrCodeProtocol)
|
||||||
|
@ -44,7 +44,7 @@ func StreamStates() *spec.ClientTestGroup {
|
||||||
tg.AddTestCase(&spec.ClientTestCase{
|
tg.AddTestCase(&spec.ClientTestCase{
|
||||||
Desc: "idle: Sends a WINDOW_UPDATE frame",
|
Desc: "idle: Sends a WINDOW_UPDATE frame",
|
||||||
Requirement: "The endpoint MUST treat this as a connection error of type PROTOCOL_ERROR.",
|
Requirement: "The endpoint MUST treat this as a connection error of type PROTOCOL_ERROR.",
|
||||||
Run: func(c *config.ClientSpecConfig, conn *spec.Conn, req *spec.Request) error {
|
Run: func(c *config.Config, conn *spec.Conn, req *spec.Request) error {
|
||||||
conn.WriteWindowUpdate(2, 100)
|
conn.WriteWindowUpdate(2, 100)
|
||||||
|
|
||||||
return spec.VerifyConnectionError(conn, http2.ErrCodeProtocol)
|
return spec.VerifyConnectionError(conn, http2.ErrCodeProtocol)
|
||||||
|
@ -58,7 +58,7 @@ func StreamStates() *spec.ClientTestGroup {
|
||||||
tg.AddTestCase(&spec.ClientTestCase{
|
tg.AddTestCase(&spec.ClientTestCase{
|
||||||
Desc: "idle: Sends a CONTINUATION frame",
|
Desc: "idle: Sends a CONTINUATION frame",
|
||||||
Requirement: "The endpoint MUST treat this as a connection error of type PROTOCOL_ERROR.",
|
Requirement: "The endpoint MUST treat this as a connection error of type PROTOCOL_ERROR.",
|
||||||
Run: func(c *config.ClientSpecConfig, conn *spec.Conn, req *spec.Request) error {
|
Run: func(c *config.Config, conn *spec.Conn, req *spec.Request) error {
|
||||||
headers := spec.CommonRespHeaders(c)
|
headers := spec.CommonRespHeaders(c)
|
||||||
blockFragment := conn.EncodeHeaders(headers)
|
blockFragment := conn.EncodeHeaders(headers)
|
||||||
conn.WriteContinuation(2, true, blockFragment)
|
conn.WriteContinuation(2, true, blockFragment)
|
||||||
|
@ -74,7 +74,7 @@ func StreamStates() *spec.ClientTestGroup {
|
||||||
tg.AddTestCase(&spec.ClientTestCase{
|
tg.AddTestCase(&spec.ClientTestCase{
|
||||||
Desc: "closed: Sends a DATA frame after sending RST_STREAM frame",
|
Desc: "closed: Sends a DATA frame after sending RST_STREAM frame",
|
||||||
Requirement: "The endpoint MUST treat this as a stream error of type STREAM_CLOSED.",
|
Requirement: "The endpoint MUST treat this as a stream error of type STREAM_CLOSED.",
|
||||||
Run: func(c *config.ClientSpecConfig, conn *spec.Conn, req *spec.Request) error {
|
Run: func(c *config.Config, conn *spec.Conn, req *spec.Request) error {
|
||||||
headers := spec.CommonRespHeaders(c)
|
headers := spec.CommonRespHeaders(c)
|
||||||
hp := http2.HeadersFrameParam{
|
hp := http2.HeadersFrameParam{
|
||||||
StreamID: req.StreamID,
|
StreamID: req.StreamID,
|
||||||
|
@ -99,7 +99,7 @@ func StreamStates() *spec.ClientTestGroup {
|
||||||
tg.AddTestCase(&spec.ClientTestCase{
|
tg.AddTestCase(&spec.ClientTestCase{
|
||||||
Desc: "closed: Sends a HEADERS frame after sending RST_STREAM frame",
|
Desc: "closed: Sends a HEADERS frame after sending RST_STREAM frame",
|
||||||
Requirement: "The endpoint MUST treat this as a stream error of type STREAM_CLOSED.",
|
Requirement: "The endpoint MUST treat this as a stream error of type STREAM_CLOSED.",
|
||||||
Run: func(c *config.ClientSpecConfig, conn *spec.Conn, req *spec.Request) error {
|
Run: func(c *config.Config, conn *spec.Conn, req *spec.Request) error {
|
||||||
headers := spec.CommonRespHeaders(c)
|
headers := spec.CommonRespHeaders(c)
|
||||||
hp1 := http2.HeadersFrameParam{
|
hp1 := http2.HeadersFrameParam{
|
||||||
StreamID: req.StreamID,
|
StreamID: req.StreamID,
|
||||||
|
@ -130,7 +130,7 @@ func StreamStates() *spec.ClientTestGroup {
|
||||||
tg.AddTestCase(&spec.ClientTestCase{
|
tg.AddTestCase(&spec.ClientTestCase{
|
||||||
Desc: "closed: Sends a CONTINUATION frame after sending RST_STREAM frame",
|
Desc: "closed: Sends a CONTINUATION frame after sending RST_STREAM frame",
|
||||||
Requirement: "The endpoint MUST treat this as a stream error of type STREAM_CLOSED.",
|
Requirement: "The endpoint MUST treat this as a stream error of type STREAM_CLOSED.",
|
||||||
Run: func(c *config.ClientSpecConfig, conn *spec.Conn, req *spec.Request) error {
|
Run: func(c *config.Config, conn *spec.Conn, req *spec.Request) error {
|
||||||
headers := spec.CommonRespHeaders(c)
|
headers := spec.CommonRespHeaders(c)
|
||||||
hp := http2.HeadersFrameParam{
|
hp := http2.HeadersFrameParam{
|
||||||
StreamID: req.StreamID,
|
StreamID: req.StreamID,
|
||||||
|
@ -160,7 +160,7 @@ func StreamStates() *spec.ClientTestGroup {
|
||||||
tg.AddTestCase(&spec.ClientTestCase{
|
tg.AddTestCase(&spec.ClientTestCase{
|
||||||
Desc: "closed: Sends a DATA frame",
|
Desc: "closed: Sends a DATA frame",
|
||||||
Requirement: "The endpoint MUST treat this as a connection error of type STREAM_CLOSED.",
|
Requirement: "The endpoint MUST treat this as a connection error of type STREAM_CLOSED.",
|
||||||
Run: func(c *config.ClientSpecConfig, conn *spec.Conn, req *spec.Request) error {
|
Run: func(c *config.Config, conn *spec.Conn, req *spec.Request) error {
|
||||||
headers := spec.CommonRespHeaders(c)
|
headers := spec.CommonRespHeaders(c)
|
||||||
hp := http2.HeadersFrameParam{
|
hp := http2.HeadersFrameParam{
|
||||||
StreamID: req.StreamID,
|
StreamID: req.StreamID,
|
||||||
|
@ -183,7 +183,7 @@ func StreamStates() *spec.ClientTestGroup {
|
||||||
tg.AddTestCase(&spec.ClientTestCase{
|
tg.AddTestCase(&spec.ClientTestCase{
|
||||||
Desc: "closed: Sends a HEADERS frame",
|
Desc: "closed: Sends a HEADERS frame",
|
||||||
Requirement: "The endpoint MUST treat this as a connection error of type STREAM_CLOSED.",
|
Requirement: "The endpoint MUST treat this as a connection error of type STREAM_CLOSED.",
|
||||||
Run: func(c *config.ClientSpecConfig, conn *spec.Conn, req *spec.Request) error {
|
Run: func(c *config.Config, conn *spec.Conn, req *spec.Request) error {
|
||||||
headers := spec.CommonRespHeaders(c)
|
headers := spec.CommonRespHeaders(c)
|
||||||
hp := http2.HeadersFrameParam{
|
hp := http2.HeadersFrameParam{
|
||||||
StreamID: req.StreamID,
|
StreamID: req.StreamID,
|
||||||
|
@ -206,7 +206,7 @@ func StreamStates() *spec.ClientTestGroup {
|
||||||
tg.AddTestCase(&spec.ClientTestCase{
|
tg.AddTestCase(&spec.ClientTestCase{
|
||||||
Desc: "closed: Sends a CONTINUATION frame",
|
Desc: "closed: Sends a CONTINUATION frame",
|
||||||
Requirement: "The endpoint MUST treat this as a connection error of type STREAM_CLOSED.",
|
Requirement: "The endpoint MUST treat this as a connection error of type STREAM_CLOSED.",
|
||||||
Run: func(c *config.ClientSpecConfig, conn *spec.Conn, req *spec.Request) error {
|
Run: func(c *config.Config, conn *spec.Conn, req *spec.Request) error {
|
||||||
headers := spec.CommonRespHeaders(c)
|
headers := spec.CommonRespHeaders(c)
|
||||||
hp := http2.HeadersFrameParam{
|
hp := http2.HeadersFrameParam{
|
||||||
StreamID: req.StreamID,
|
StreamID: req.StreamID,
|
||||||
|
|
|
@ -17,7 +17,7 @@ func ConnectionErrorHandling() *spec.ClientTestGroup {
|
||||||
tg.AddTestCase(&spec.ClientTestCase{
|
tg.AddTestCase(&spec.ClientTestCase{
|
||||||
Desc: "Sends an invalid PING frame for connection close",
|
Desc: "Sends an invalid PING frame for connection close",
|
||||||
Requirement: "The endpoint MUST close the TCP connection",
|
Requirement: "The endpoint MUST close the TCP connection",
|
||||||
Run: func(c *config.ClientSpecConfig, conn *spec.Conn, req *spec.Request) error {
|
Run: func(c *config.Config, conn *spec.Conn, req *spec.Request) error {
|
||||||
// PING frame with invalid stream ID
|
// PING frame with invalid stream ID
|
||||||
conn.Send([]byte("\x00\x00\x08\x06\x00\x00\x00\x00\x03"))
|
conn.Send([]byte("\x00\x00\x08\x06\x00\x00\x00\x00\x03"))
|
||||||
conn.Send([]byte("\x00\x00\x00\x00\x00\x00\x00\x00"))
|
conn.Send([]byte("\x00\x00\x00\x00\x00\x00\x00\x00"))
|
||||||
|
@ -32,7 +32,7 @@ func ConnectionErrorHandling() *spec.ClientTestGroup {
|
||||||
tg.AddTestCase(&spec.ClientTestCase{
|
tg.AddTestCase(&spec.ClientTestCase{
|
||||||
Desc: "Sends an invalid PING frame to receive GOAWAY frame",
|
Desc: "Sends an invalid PING frame to receive GOAWAY frame",
|
||||||
Requirement: "An endpoint that encounters a connection error SHOULD first send a GOAWAY frame",
|
Requirement: "An endpoint that encounters a connection error SHOULD first send a GOAWAY frame",
|
||||||
Run: func(c *config.ClientSpecConfig, conn *spec.Conn, req *spec.Request) error {
|
Run: func(c *config.Config, conn *spec.Conn, req *spec.Request) error {
|
||||||
// PING frame with invalid stream ID
|
// PING frame with invalid stream ID
|
||||||
conn.Send([]byte("\x00\x00\x08\x06\x00\x00\x00\x00\x03"))
|
conn.Send([]byte("\x00\x00\x08\x06\x00\x00\x00\x00\x03"))
|
||||||
conn.Send([]byte("\x00\x00\x00\x00\x00\x00\x00\x00"))
|
conn.Send([]byte("\x00\x00\x00\x00\x00\x00\x00\x00"))
|
||||||
|
|
|
@ -11,7 +11,7 @@ func ExtendingHTTP2() *spec.ClientTestGroup {
|
||||||
tg.AddTestCase(&spec.ClientTestCase{
|
tg.AddTestCase(&spec.ClientTestCase{
|
||||||
Desc: "Sends an unknown extension frame",
|
Desc: "Sends an unknown extension frame",
|
||||||
Requirement: "The endpoint MUST ignore unknown or unsupported values in all extensible protocol elements.",
|
Requirement: "The endpoint MUST ignore unknown or unsupported values in all extensible protocol elements.",
|
||||||
Run: func(c *config.ClientSpecConfig, conn *spec.Conn, req *spec.Request) error {
|
Run: func(c *config.Config, conn *spec.Conn, req *spec.Request) error {
|
||||||
|
|
||||||
// UNKONWN Frame:
|
// UNKONWN Frame:
|
||||||
// Length: 8, Type: 255, Flags: 0, R: 0, StreamID: 0
|
// Length: 8, Type: 255, Flags: 0, R: 0, StreamID: 0
|
||||||
|
|
|
@ -18,7 +18,7 @@ func Continuation() *spec.ClientTestGroup {
|
||||||
tg.AddTestCase(&spec.ClientTestCase{
|
tg.AddTestCase(&spec.ClientTestCase{
|
||||||
Desc: "Sends multiple CONTINUATION frames preceded by a HEADERS frame",
|
Desc: "Sends multiple CONTINUATION frames preceded by a HEADERS frame",
|
||||||
Requirement: "The endpoint must accept the frame.",
|
Requirement: "The endpoint must accept the frame.",
|
||||||
Run: func(c *config.ClientSpecConfig, conn *spec.Conn, req *spec.Request) error {
|
Run: func(c *config.Config, conn *spec.Conn, req *spec.Request) error {
|
||||||
headers := spec.CommonRespHeaders(c)
|
headers := spec.CommonRespHeaders(c)
|
||||||
hp := http2.HeadersFrameParam{
|
hp := http2.HeadersFrameParam{
|
||||||
StreamID: req.StreamID,
|
StreamID: req.StreamID,
|
||||||
|
@ -47,7 +47,7 @@ func Continuation() *spec.ClientTestGroup {
|
||||||
tg.AddTestCase(&spec.ClientTestCase{
|
tg.AddTestCase(&spec.ClientTestCase{
|
||||||
Desc: "Sends a CONTINUATION frame followed by any frame other than CONTINUATION",
|
Desc: "Sends a CONTINUATION frame followed by any frame other than CONTINUATION",
|
||||||
Requirement: "The endpoint MUST treat this as a connection error of type PROTOCOL_ERROR.",
|
Requirement: "The endpoint MUST treat this as a connection error of type PROTOCOL_ERROR.",
|
||||||
Run: func(c *config.ClientSpecConfig, conn *spec.Conn, req *spec.Request) error {
|
Run: func(c *config.Config, conn *spec.Conn, req *spec.Request) error {
|
||||||
headers := spec.CommonRespHeaders(c)
|
headers := spec.CommonRespHeaders(c)
|
||||||
|
|
||||||
hp := http2.HeadersFrameParam{
|
hp := http2.HeadersFrameParam{
|
||||||
|
@ -73,7 +73,7 @@ func Continuation() *spec.ClientTestGroup {
|
||||||
tg.AddTestCase(&spec.ClientTestCase{
|
tg.AddTestCase(&spec.ClientTestCase{
|
||||||
Desc: "Sends a CONTINUATION frame with 0x0 stream identifier",
|
Desc: "Sends a CONTINUATION frame with 0x0 stream identifier",
|
||||||
Requirement: "The endpoint MUST respond with a connection error of type PROTOCOL_ERROR.",
|
Requirement: "The endpoint MUST respond with a connection error of type PROTOCOL_ERROR.",
|
||||||
Run: func(c *config.ClientSpecConfig, conn *spec.Conn, req *spec.Request) error {
|
Run: func(c *config.Config, conn *spec.Conn, req *spec.Request) error {
|
||||||
headers := spec.CommonRespHeaders(c)
|
headers := spec.CommonRespHeaders(c)
|
||||||
hp := http2.HeadersFrameParam{
|
hp := http2.HeadersFrameParam{
|
||||||
StreamID: req.StreamID,
|
StreamID: req.StreamID,
|
||||||
|
@ -97,7 +97,7 @@ func Continuation() *spec.ClientTestGroup {
|
||||||
tg.AddTestCase(&spec.ClientTestCase{
|
tg.AddTestCase(&spec.ClientTestCase{
|
||||||
Desc: "Sends a CONTINUATION frame preceded by a HEADERS frame with END_HEADERS flag",
|
Desc: "Sends a CONTINUATION frame preceded by a HEADERS frame with END_HEADERS flag",
|
||||||
Requirement: "The endpoint MUST respond with a connection error of type PROTOCOL_ERROR.",
|
Requirement: "The endpoint MUST respond with a connection error of type PROTOCOL_ERROR.",
|
||||||
Run: func(c *config.ClientSpecConfig, conn *spec.Conn, req *spec.Request) error {
|
Run: func(c *config.Config, conn *spec.Conn, req *spec.Request) error {
|
||||||
headers := spec.CommonRespHeaders(c)
|
headers := spec.CommonRespHeaders(c)
|
||||||
hp := http2.HeadersFrameParam{
|
hp := http2.HeadersFrameParam{
|
||||||
StreamID: req.StreamID,
|
StreamID: req.StreamID,
|
||||||
|
@ -121,7 +121,7 @@ func Continuation() *spec.ClientTestGroup {
|
||||||
tg.AddTestCase(&spec.ClientTestCase{
|
tg.AddTestCase(&spec.ClientTestCase{
|
||||||
Desc: "Sends a CONTINUATION frame preceded by a CONTINUATION frame with END_HEADERS flag",
|
Desc: "Sends a CONTINUATION frame preceded by a CONTINUATION frame with END_HEADERS flag",
|
||||||
Requirement: "The endpoint MUST respond with a connection error of type PROTOCOL_ERROR.",
|
Requirement: "The endpoint MUST respond with a connection error of type PROTOCOL_ERROR.",
|
||||||
Run: func(c *config.ClientSpecConfig, conn *spec.Conn, req *spec.Request) error {
|
Run: func(c *config.Config, conn *spec.Conn, req *spec.Request) error {
|
||||||
headers := spec.CommonRespHeaders(c)
|
headers := spec.CommonRespHeaders(c)
|
||||||
hp := http2.HeadersFrameParam{
|
hp := http2.HeadersFrameParam{
|
||||||
StreamID: req.StreamID,
|
StreamID: req.StreamID,
|
||||||
|
@ -146,7 +146,7 @@ func Continuation() *spec.ClientTestGroup {
|
||||||
tg.AddTestCase(&spec.ClientTestCase{
|
tg.AddTestCase(&spec.ClientTestCase{
|
||||||
Desc: "Sends a CONTINUATION frame preceded by a DATA frame",
|
Desc: "Sends a CONTINUATION frame preceded by a DATA frame",
|
||||||
Requirement: "The endpoint MUST respond with a connection error of type PROTOCOL_ERROR.",
|
Requirement: "The endpoint MUST respond with a connection error of type PROTOCOL_ERROR.",
|
||||||
Run: func(c *config.ClientSpecConfig, conn *spec.Conn, req *spec.Request) error {
|
Run: func(c *config.Config, conn *spec.Conn, req *spec.Request) error {
|
||||||
headers := spec.CommonRespHeaders(c)
|
headers := spec.CommonRespHeaders(c)
|
||||||
|
|
||||||
hp := http2.HeadersFrameParam{
|
hp := http2.HeadersFrameParam{
|
||||||
|
|
|
@ -17,7 +17,7 @@ func Data() *spec.ClientTestGroup {
|
||||||
tg.AddTestCase(&spec.ClientTestCase{
|
tg.AddTestCase(&spec.ClientTestCase{
|
||||||
Desc: "Sends a DATA frame with 0x0 stream identifier",
|
Desc: "Sends a DATA frame with 0x0 stream identifier",
|
||||||
Requirement: "The endpoint MUST respond with a connection error of type PROTOCOL_ERROR.",
|
Requirement: "The endpoint MUST respond with a connection error of type PROTOCOL_ERROR.",
|
||||||
Run: func(c *config.ClientSpecConfig, conn *spec.Conn, req *spec.Request) error {
|
Run: func(c *config.Config, conn *spec.Conn, req *spec.Request) error {
|
||||||
conn.WriteData(0, true, []byte("test"))
|
conn.WriteData(0, true, []byte("test"))
|
||||||
|
|
||||||
return spec.VerifyConnectionError(conn, http2.ErrCodeProtocol)
|
return spec.VerifyConnectionError(conn, http2.ErrCodeProtocol)
|
||||||
|
@ -32,7 +32,7 @@ func Data() *spec.ClientTestGroup {
|
||||||
tg.AddTestCase(&spec.ClientTestCase{
|
tg.AddTestCase(&spec.ClientTestCase{
|
||||||
Desc: "Sends a DATA frame on the stream that is not in \"open\" or \"half-closed (local)\" state",
|
Desc: "Sends a DATA frame on the stream that is not in \"open\" or \"half-closed (local)\" state",
|
||||||
Requirement: "The endpoint MUST respond with a stream error of type STREAM_CLOSED.",
|
Requirement: "The endpoint MUST respond with a stream error of type STREAM_CLOSED.",
|
||||||
Run: func(c *config.ClientSpecConfig, conn *spec.Conn, req *spec.Request) error {
|
Run: func(c *config.Config, conn *spec.Conn, req *spec.Request) error {
|
||||||
headers := spec.CommonRespHeaders(c)
|
headers := spec.CommonRespHeaders(c)
|
||||||
|
|
||||||
hp := http2.HeadersFrameParam{
|
hp := http2.HeadersFrameParam{
|
||||||
|
@ -55,7 +55,7 @@ func Data() *spec.ClientTestGroup {
|
||||||
tg.AddTestCase(&spec.ClientTestCase{
|
tg.AddTestCase(&spec.ClientTestCase{
|
||||||
Desc: "Sends a DATA frame with invalid pad length",
|
Desc: "Sends a DATA frame with invalid pad length",
|
||||||
Requirement: "The endpoint MUST treat this as a connection error of type PROTOCOL_ERROR.",
|
Requirement: "The endpoint MUST treat this as a connection error of type PROTOCOL_ERROR.",
|
||||||
Run: func(c *config.ClientSpecConfig, conn *spec.Conn, req *spec.Request) error {
|
Run: func(c *config.Config, conn *spec.Conn, req *spec.Request) error {
|
||||||
headers := spec.CommonRespHeaders(c)
|
headers := spec.CommonRespHeaders(c)
|
||||||
headers = append(headers, spec.HeaderField("content-length", "4"))
|
headers = append(headers, spec.HeaderField("content-length", "4"))
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ func Headers() *spec.ClientTestGroup {
|
||||||
tg.AddTestCase(&spec.ClientTestCase{
|
tg.AddTestCase(&spec.ClientTestCase{
|
||||||
Desc: "Sends a HEADERS frame without the END_HEADERS flag, and a PRIORITY frame",
|
Desc: "Sends a HEADERS frame without the END_HEADERS flag, and a PRIORITY frame",
|
||||||
Requirement: "The endpoint MUST treat this as a connection error of type PROTOCOL_ERROR.",
|
Requirement: "The endpoint MUST treat this as a connection error of type PROTOCOL_ERROR.",
|
||||||
Run: func(c *config.ClientSpecConfig, conn *spec.Conn, req *spec.Request) error {
|
Run: func(c *config.Config, conn *spec.Conn, req *spec.Request) error {
|
||||||
headers := spec.CommonRespHeaders(c)
|
headers := spec.CommonRespHeaders(c)
|
||||||
hp := http2.HeadersFrameParam{
|
hp := http2.HeadersFrameParam{
|
||||||
StreamID: req.StreamID,
|
StreamID: req.StreamID,
|
||||||
|
@ -52,7 +52,7 @@ func Headers() *spec.ClientTestGroup {
|
||||||
tg.AddTestCase(&spec.ClientTestCase{
|
tg.AddTestCase(&spec.ClientTestCase{
|
||||||
Desc: "Sends a HEADERS frame with 0x0 stream identifier",
|
Desc: "Sends a HEADERS frame with 0x0 stream identifier",
|
||||||
Requirement: "The endpoint MUST respond with a connection error of type PROTOCOL_ERROR.",
|
Requirement: "The endpoint MUST respond with a connection error of type PROTOCOL_ERROR.",
|
||||||
Run: func(c *config.ClientSpecConfig, conn *spec.Conn, req *spec.Request) error {
|
Run: func(c *config.Config, conn *spec.Conn, req *spec.Request) error {
|
||||||
headers := spec.CommonRespHeaders(c)
|
headers := spec.CommonRespHeaders(c)
|
||||||
|
|
||||||
hp := http2.HeadersFrameParam{
|
hp := http2.HeadersFrameParam{
|
||||||
|
@ -75,7 +75,7 @@ func Headers() *spec.ClientTestGroup {
|
||||||
tg.AddTestCase(&spec.ClientTestCase{
|
tg.AddTestCase(&spec.ClientTestCase{
|
||||||
Desc: "Sends a HEADERS frame with invalid pad length",
|
Desc: "Sends a HEADERS frame with invalid pad length",
|
||||||
Requirement: "The endpoint MUST treat this as a connection error of type PROTOCOL_ERROR.",
|
Requirement: "The endpoint MUST treat this as a connection error of type PROTOCOL_ERROR.",
|
||||||
Run: func(c *config.ClientSpecConfig, conn *spec.Conn, req *spec.Request) error {
|
Run: func(c *config.Config, conn *spec.Conn, req *spec.Request) error {
|
||||||
headers := spec.CommonRespHeaders(c)
|
headers := spec.CommonRespHeaders(c)
|
||||||
|
|
||||||
// HEADERS frame:
|
// HEADERS frame:
|
||||||
|
|
|
@ -17,7 +17,7 @@ func Priority() *spec.ClientTestGroup {
|
||||||
tg.AddTestCase(&spec.ClientTestCase{
|
tg.AddTestCase(&spec.ClientTestCase{
|
||||||
Desc: "Sends a PRIORITY frame with 0x0 stream identifier",
|
Desc: "Sends a PRIORITY frame with 0x0 stream identifier",
|
||||||
Requirement: "The endpoint MUST respond with a connection error of type PROTOCOL_ERROR.",
|
Requirement: "The endpoint MUST respond with a connection error of type PROTOCOL_ERROR.",
|
||||||
Run: func(c *config.ClientSpecConfig, conn *spec.Conn, req *spec.Request) error {
|
Run: func(c *config.Config, conn *spec.Conn, req *spec.Request) error {
|
||||||
pp := http2.PriorityParam{
|
pp := http2.PriorityParam{
|
||||||
StreamDep: 0,
|
StreamDep: 0,
|
||||||
Exclusive: false,
|
Exclusive: false,
|
||||||
|
@ -35,7 +35,7 @@ func Priority() *spec.ClientTestGroup {
|
||||||
tg.AddTestCase(&spec.ClientTestCase{
|
tg.AddTestCase(&spec.ClientTestCase{
|
||||||
Desc: "Sends a PRIORITY frame with a length other than 5 octets",
|
Desc: "Sends a PRIORITY frame with a length other than 5 octets",
|
||||||
Requirement: "The endpoint MUST respond with a stream error of type FRAME_SIZE_ERROR.",
|
Requirement: "The endpoint MUST respond with a stream error of type FRAME_SIZE_ERROR.",
|
||||||
Run: func(c *config.ClientSpecConfig, conn *spec.Conn, req *spec.Request) error {
|
Run: func(c *config.Config, conn *spec.Conn, req *spec.Request) error {
|
||||||
headers := spec.CommonRespHeaders(c)
|
headers := spec.CommonRespHeaders(c)
|
||||||
hp := http2.HeadersFrameParam{
|
hp := http2.HeadersFrameParam{
|
||||||
StreamID: req.StreamID,
|
StreamID: req.StreamID,
|
||||||
|
|
|
@ -17,7 +17,7 @@ func RSTStream() *spec.ClientTestGroup {
|
||||||
tg.AddTestCase(&spec.ClientTestCase{
|
tg.AddTestCase(&spec.ClientTestCase{
|
||||||
Desc: "Sends a RST_STREAM frame with 0x0 stream identifier",
|
Desc: "Sends a RST_STREAM frame with 0x0 stream identifier",
|
||||||
Requirement: "The endpoint MUST respond with a connection error of type PROTOCOL_ERROR.",
|
Requirement: "The endpoint MUST respond with a connection error of type PROTOCOL_ERROR.",
|
||||||
Run: func(c *config.ClientSpecConfig, conn *spec.Conn, req *spec.Request) error {
|
Run: func(c *config.Config, conn *spec.Conn, req *spec.Request) error {
|
||||||
conn.WriteRSTStream(0, http2.ErrCodeCancel)
|
conn.WriteRSTStream(0, http2.ErrCodeCancel)
|
||||||
|
|
||||||
return spec.VerifyConnectionError(conn, http2.ErrCodeProtocol)
|
return spec.VerifyConnectionError(conn, http2.ErrCodeProtocol)
|
||||||
|
@ -31,7 +31,7 @@ func RSTStream() *spec.ClientTestGroup {
|
||||||
tg.AddTestCase(&spec.ClientTestCase{
|
tg.AddTestCase(&spec.ClientTestCase{
|
||||||
Desc: "Sends a RST_STREAM frame on a idle stream",
|
Desc: "Sends a RST_STREAM frame on a idle stream",
|
||||||
Requirement: "The endpoint MUST respond with a connection error of type PROTOCOL_ERROR.",
|
Requirement: "The endpoint MUST respond with a connection error of type PROTOCOL_ERROR.",
|
||||||
Run: func(c *config.ClientSpecConfig, conn *spec.Conn, req *spec.Request) error {
|
Run: func(c *config.Config, conn *spec.Conn, req *spec.Request) error {
|
||||||
conn.WriteRSTStream(2, http2.ErrCodeCancel)
|
conn.WriteRSTStream(2, http2.ErrCodeCancel)
|
||||||
|
|
||||||
return spec.VerifyConnectionError(conn, http2.ErrCodeProtocol)
|
return spec.VerifyConnectionError(conn, http2.ErrCodeProtocol)
|
||||||
|
@ -44,7 +44,7 @@ func RSTStream() *spec.ClientTestGroup {
|
||||||
tg.AddTestCase(&spec.ClientTestCase{
|
tg.AddTestCase(&spec.ClientTestCase{
|
||||||
Desc: "Sends a RST_STREAM frame with a length other than 4 octets",
|
Desc: "Sends a RST_STREAM frame with a length other than 4 octets",
|
||||||
Requirement: "The endpoint MUST respond with a connection error of type FRAME_SIZE_ERROR.",
|
Requirement: "The endpoint MUST respond with a connection error of type FRAME_SIZE_ERROR.",
|
||||||
Run: func(c *config.ClientSpecConfig, conn *spec.Conn, req *spec.Request) error {
|
Run: func(c *config.Config, conn *spec.Conn, req *spec.Request) error {
|
||||||
headers := spec.CommonRespHeaders(c)
|
headers := spec.CommonRespHeaders(c)
|
||||||
hp := http2.HeadersFrameParam{
|
hp := http2.HeadersFrameParam{
|
||||||
StreamID: req.StreamID,
|
StreamID: req.StreamID,
|
||||||
|
|
|
@ -17,7 +17,7 @@ func DefinedSETTINGSParameters() *spec.ClientTestGroup {
|
||||||
tg.AddTestCase(&spec.ClientTestCase{
|
tg.AddTestCase(&spec.ClientTestCase{
|
||||||
Desc: "SETTINGS_INITIAL_WINDOW_SIZE (0x4): Sends the value above the maximum flow control window size",
|
Desc: "SETTINGS_INITIAL_WINDOW_SIZE (0x4): Sends the value above the maximum flow control window size",
|
||||||
Requirement: "The endpoint MUST treat this as a connection error of type FLOW_CONTROL_ERROR.",
|
Requirement: "The endpoint MUST treat this as a connection error of type FLOW_CONTROL_ERROR.",
|
||||||
Run: func(c *config.ClientSpecConfig, conn *spec.Conn, req *spec.Request) error {
|
Run: func(c *config.Config, conn *spec.Conn, req *spec.Request) error {
|
||||||
setting := http2.Setting{
|
setting := http2.Setting{
|
||||||
ID: http2.SettingInitialWindowSize,
|
ID: http2.SettingInitialWindowSize,
|
||||||
Val: 2147483648,
|
Val: 2147483648,
|
||||||
|
@ -37,7 +37,7 @@ func DefinedSETTINGSParameters() *spec.ClientTestGroup {
|
||||||
tg.AddTestCase(&spec.ClientTestCase{
|
tg.AddTestCase(&spec.ClientTestCase{
|
||||||
Desc: "SETTINGS_MAX_FRAME_SIZE (0x5): Sends the value below the initial value",
|
Desc: "SETTINGS_MAX_FRAME_SIZE (0x5): Sends the value below the initial value",
|
||||||
Requirement: "The endpoint MUST treat this as a connection error of type PROTOCOL_ERROR.",
|
Requirement: "The endpoint MUST treat this as a connection error of type PROTOCOL_ERROR.",
|
||||||
Run: func(c *config.ClientSpecConfig, conn *spec.Conn, req *spec.Request) error {
|
Run: func(c *config.Config, conn *spec.Conn, req *spec.Request) error {
|
||||||
setting := http2.Setting{
|
setting := http2.Setting{
|
||||||
ID: http2.SettingMaxFrameSize,
|
ID: http2.SettingMaxFrameSize,
|
||||||
Val: 16383,
|
Val: 16383,
|
||||||
|
@ -57,7 +57,7 @@ func DefinedSETTINGSParameters() *spec.ClientTestGroup {
|
||||||
tg.AddTestCase(&spec.ClientTestCase{
|
tg.AddTestCase(&spec.ClientTestCase{
|
||||||
Desc: "SETTINGS_MAX_FRAME_SIZE (0x5): Sends the value above the maximum allowed frame size",
|
Desc: "SETTINGS_MAX_FRAME_SIZE (0x5): Sends the value above the maximum allowed frame size",
|
||||||
Requirement: "The endpoint MUST treat this as a connection error of type PROTOCOL_ERROR.",
|
Requirement: "The endpoint MUST treat this as a connection error of type PROTOCOL_ERROR.",
|
||||||
Run: func(c *config.ClientSpecConfig, conn *spec.Conn, req *spec.Request) error {
|
Run: func(c *config.Config, conn *spec.Conn, req *spec.Request) error {
|
||||||
setting := http2.Setting{
|
setting := http2.Setting{
|
||||||
ID: http2.SettingMaxFrameSize,
|
ID: http2.SettingMaxFrameSize,
|
||||||
Val: 16777216,
|
Val: 16777216,
|
||||||
|
@ -73,7 +73,7 @@ func DefinedSETTINGSParameters() *spec.ClientTestGroup {
|
||||||
tg.AddTestCase(&spec.ClientTestCase{
|
tg.AddTestCase(&spec.ClientTestCase{
|
||||||
Desc: "Sends a SETTINGS frame with unknown identifier",
|
Desc: "Sends a SETTINGS frame with unknown identifier",
|
||||||
Requirement: "The endpoint MUST ignore that setting.",
|
Requirement: "The endpoint MUST ignore that setting.",
|
||||||
Run: func(c *config.ClientSpecConfig, conn *spec.Conn, req *spec.Request) error {
|
Run: func(c *config.Config, conn *spec.Conn, req *spec.Request) error {
|
||||||
setting := http2.Setting{
|
setting := http2.Setting{
|
||||||
ID: 0xFF,
|
ID: 0xFF,
|
||||||
Val: 1,
|
Val: 1,
|
||||||
|
|
|
@ -15,7 +15,7 @@ func SettingsSynchronization() *spec.ClientTestGroup {
|
||||||
tg.AddTestCase(&spec.ClientTestCase{
|
tg.AddTestCase(&spec.ClientTestCase{
|
||||||
Desc: "Sends a SETTINGS frame without ACK flag",
|
Desc: "Sends a SETTINGS frame without ACK flag",
|
||||||
Requirement: "The endpoint MUST immediately emit a SETTINGS frame with the ACK flag set.",
|
Requirement: "The endpoint MUST immediately emit a SETTINGS frame with the ACK flag set.",
|
||||||
Run: func(c *config.ClientSpecConfig, conn *spec.Conn, req *spec.Request) error {
|
Run: func(c *config.Config, conn *spec.Conn, req *spec.Request) error {
|
||||||
setting := http2.Setting{
|
setting := http2.Setting{
|
||||||
ID: http2.SettingEnablePush,
|
ID: http2.SettingEnablePush,
|
||||||
Val: 0,
|
Val: 0,
|
||||||
|
|
|
@ -20,7 +20,7 @@ func Settings() *spec.ClientTestGroup {
|
||||||
tg.AddTestCase(&spec.ClientTestCase{
|
tg.AddTestCase(&spec.ClientTestCase{
|
||||||
Desc: "Sends a SETTINGS frame with ACK flag and payload",
|
Desc: "Sends a SETTINGS frame with ACK flag and payload",
|
||||||
Requirement: "The endpoint MUST respond with a connection error of type FRAME_SIZE_ERROR.",
|
Requirement: "The endpoint MUST respond with a connection error of type FRAME_SIZE_ERROR.",
|
||||||
Run: func(c *config.ClientSpecConfig, conn *spec.Conn, req *spec.Request) error {
|
Run: func(c *config.Config, conn *spec.Conn, req *spec.Request) error {
|
||||||
// SETTINGS frame:
|
// SETTINGS frame:
|
||||||
// length: 0, flags: 0x1, stream_id: 0x0
|
// length: 0, flags: 0x1, stream_id: 0x0
|
||||||
conn.Send([]byte("\x00\x00\x01\x04\x01\x00\x00\x00\x00"))
|
conn.Send([]byte("\x00\x00\x01\x04\x01\x00\x00\x00\x00"))
|
||||||
|
@ -39,7 +39,7 @@ func Settings() *spec.ClientTestGroup {
|
||||||
tg.AddTestCase(&spec.ClientTestCase{
|
tg.AddTestCase(&spec.ClientTestCase{
|
||||||
Desc: "Sends a SETTINGS frame with a stream identifier other than 0x0",
|
Desc: "Sends a SETTINGS frame with a stream identifier other than 0x0",
|
||||||
Requirement: "The endpoint MUST respond with a connection error of type PROTOCOL_ERROR.",
|
Requirement: "The endpoint MUST respond with a connection error of type PROTOCOL_ERROR.",
|
||||||
Run: func(c *config.ClientSpecConfig, conn *spec.Conn, req *spec.Request) error {
|
Run: func(c *config.Config, conn *spec.Conn, req *spec.Request) error {
|
||||||
// SETTINGS frame:
|
// SETTINGS frame:
|
||||||
// length: 6, flags: 0x0, stream_id: 0x1
|
// length: 6, flags: 0x0, stream_id: 0x1
|
||||||
conn.Send([]byte("\x00\x00\x06\x04\x00\x00\x00\x00\x01"))
|
conn.Send([]byte("\x00\x00\x06\x04\x00\x00\x00\x00\x01"))
|
||||||
|
@ -59,7 +59,7 @@ func Settings() *spec.ClientTestGroup {
|
||||||
tg.AddTestCase(&spec.ClientTestCase{
|
tg.AddTestCase(&spec.ClientTestCase{
|
||||||
Desc: "Sends a SETTINGS frame with a length other than a multiple of 6 octets",
|
Desc: "Sends a SETTINGS frame with a length other than a multiple of 6 octets",
|
||||||
Requirement: "The endpoint MUST respond with a connection error of type FRAME_SIZE_ERROR.",
|
Requirement: "The endpoint MUST respond with a connection error of type FRAME_SIZE_ERROR.",
|
||||||
Run: func(c *config.ClientSpecConfig, conn *spec.Conn, req *spec.Request) error {
|
Run: func(c *config.Config, conn *spec.Conn, req *spec.Request) error {
|
||||||
// SETTINGS frame:
|
// SETTINGS frame:
|
||||||
// length: 3, flags: 0x0, stream_id: 0x0
|
// length: 3, flags: 0x0, stream_id: 0x0
|
||||||
conn.Send([]byte("\x00\x00\x03\x04\x00\x00\x00\x00\x00"))
|
conn.Send([]byte("\x00\x00\x03\x04\x00\x00\x00\x00\x00"))
|
||||||
|
|
|
@ -16,7 +16,7 @@ func Ping() *spec.ClientTestGroup {
|
||||||
tg.AddTestCase(&spec.ClientTestCase{
|
tg.AddTestCase(&spec.ClientTestCase{
|
||||||
Desc: "Sends a PING frame",
|
Desc: "Sends a PING frame",
|
||||||
Requirement: "The endpoint MUST sends a PING frame with ACK, with an identical payload.",
|
Requirement: "The endpoint MUST sends a PING frame with ACK, with an identical payload.",
|
||||||
Run: func(c *config.ClientSpecConfig, conn *spec.Conn, req *spec.Request) error {
|
Run: func(c *config.Config, conn *spec.Conn, req *spec.Request) error {
|
||||||
data := [8]byte{'h', '2', 's', 'p', 'e', 'c'}
|
data := [8]byte{'h', '2', 's', 'p', 'e', 'c'}
|
||||||
conn.WritePing(false, data)
|
conn.WritePing(false, data)
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ func Ping() *spec.ClientTestGroup {
|
||||||
tg.AddTestCase(&spec.ClientTestCase{
|
tg.AddTestCase(&spec.ClientTestCase{
|
||||||
Desc: "Sends a PING frame with ACK",
|
Desc: "Sends a PING frame with ACK",
|
||||||
Requirement: "The endpoint MUST NOT respond to PING frames with ACK.",
|
Requirement: "The endpoint MUST NOT respond to PING frames with ACK.",
|
||||||
Run: func(c *config.ClientSpecConfig, conn *spec.Conn, req *spec.Request) error {
|
Run: func(c *config.Config, conn *spec.Conn, req *spec.Request) error {
|
||||||
unexpectedData := [8]byte{'i', 'n', 'v', 'a', 'l', 'i', 'd'}
|
unexpectedData := [8]byte{'i', 'n', 'v', 'a', 'l', 'i', 'd'}
|
||||||
expectedData := [8]byte{'h', '2', 's', 'p', 'e', 'c'}
|
expectedData := [8]byte{'h', '2', 's', 'p', 'e', 'c'}
|
||||||
conn.WritePing(true, unexpectedData)
|
conn.WritePing(true, unexpectedData)
|
||||||
|
@ -48,7 +48,7 @@ func Ping() *spec.ClientTestGroup {
|
||||||
tg.AddTestCase(&spec.ClientTestCase{
|
tg.AddTestCase(&spec.ClientTestCase{
|
||||||
Desc: "Sends a PING frame with a stream identifier field value other than 0x0",
|
Desc: "Sends a PING frame with a stream identifier field value other than 0x0",
|
||||||
Requirement: "The endpoint MUST respond with a connection error of type PROTOCOL_ERROR.",
|
Requirement: "The endpoint MUST respond with a connection error of type PROTOCOL_ERROR.",
|
||||||
Run: func(c *config.ClientSpecConfig, conn *spec.Conn, req *spec.Request) error {
|
Run: func(c *config.Config, conn *spec.Conn, req *spec.Request) error {
|
||||||
// PING frame:
|
// PING frame:
|
||||||
// length: 8, flags: 0x0, stream_id: 1
|
// length: 8, flags: 0x0, stream_id: 1
|
||||||
conn.Send([]byte("\x00\x00\x08\x06\x00\x00\x00\x00\x01"))
|
conn.Send([]byte("\x00\x00\x08\x06\x00\x00\x00\x00\x01"))
|
||||||
|
@ -64,7 +64,7 @@ func Ping() *spec.ClientTestGroup {
|
||||||
tg.AddTestCase(&spec.ClientTestCase{
|
tg.AddTestCase(&spec.ClientTestCase{
|
||||||
Desc: "Sends a PING frame with a length field value other than 8",
|
Desc: "Sends a PING frame with a length field value other than 8",
|
||||||
Requirement: "The endpoint MUST treat this as a connection error of type FRAME_SIZE_ERROR.",
|
Requirement: "The endpoint MUST treat this as a connection error of type FRAME_SIZE_ERROR.",
|
||||||
Run: func(c *config.ClientSpecConfig, conn *spec.Conn, req *spec.Request) error {
|
Run: func(c *config.Config, conn *spec.Conn, req *spec.Request) error {
|
||||||
// PING frame:
|
// PING frame:
|
||||||
// length: 8, flags: 0x0, stream_id: 1
|
// length: 8, flags: 0x0, stream_id: 1
|
||||||
conn.Send([]byte("\x00\x00\x06\x06\x00\x00\x00\x00\x00"))
|
conn.Send([]byte("\x00\x00\x06\x06\x00\x00\x00\x00\x00"))
|
||||||
|
|
|
@ -16,7 +16,7 @@ func GoAway() *spec.ClientTestGroup {
|
||||||
tg.AddTestCase(&spec.ClientTestCase{
|
tg.AddTestCase(&spec.ClientTestCase{
|
||||||
Desc: "Sends a GOAWAY frame with a stream identifier other than 0x0",
|
Desc: "Sends a GOAWAY frame with a stream identifier other than 0x0",
|
||||||
Requirement: "The endpoint MUST treat this as a connection error of type PROTOCOL_ERROR.",
|
Requirement: "The endpoint MUST treat this as a connection error of type PROTOCOL_ERROR.",
|
||||||
Run: func(c *config.ClientSpecConfig, conn *spec.Conn, req *spec.Request) error {
|
Run: func(c *config.Config, conn *spec.Conn, req *spec.Request) error {
|
||||||
// GOAWAY frame:
|
// GOAWAY frame:
|
||||||
// length: 8, flags: 0x0, stream_id: 1
|
// length: 8, flags: 0x0, stream_id: 1
|
||||||
conn.Send([]byte("\x00\x00\x08\x07\x00\x00\x00\x00\x01"))
|
conn.Send([]byte("\x00\x00\x08\x07\x00\x00\x00\x00\x01"))
|
||||||
|
|
|
@ -22,7 +22,7 @@ func TheFlowControlWindow() *spec.ClientTestGroup {
|
||||||
tg.AddTestCase(&spec.ClientTestCase{
|
tg.AddTestCase(&spec.ClientTestCase{
|
||||||
Desc: "Sends multiple WINDOW_UPDATE frames increasing the flow control window to above 2^31-1",
|
Desc: "Sends multiple WINDOW_UPDATE frames increasing the flow control window to above 2^31-1",
|
||||||
Requirement: "The endpoint MUST sends a GOAWAY frame with a FLOW_CONTROL_ERROR code.",
|
Requirement: "The endpoint MUST sends a GOAWAY frame with a FLOW_CONTROL_ERROR code.",
|
||||||
Run: func(c *config.ClientSpecConfig, conn *spec.Conn, req *spec.Request) error {
|
Run: func(c *config.Config, conn *spec.Conn, req *spec.Request) error {
|
||||||
conn.WriteWindowUpdate(0, 2147483647)
|
conn.WriteWindowUpdate(0, 2147483647)
|
||||||
conn.WriteWindowUpdate(0, 2147483647)
|
conn.WriteWindowUpdate(0, 2147483647)
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ func TheFlowControlWindow() *spec.ClientTestGroup {
|
||||||
tg.AddTestCase(&spec.ClientTestCase{
|
tg.AddTestCase(&spec.ClientTestCase{
|
||||||
Desc: "Sends multiple WINDOW_UPDATE frames increasing the flow control window to above 2^31-1 on a stream",
|
Desc: "Sends multiple WINDOW_UPDATE frames increasing the flow control window to above 2^31-1 on a stream",
|
||||||
Requirement: "The endpoint MUST sends a RST_STREAM frame with a FLOW_CONTROL_ERROR code.",
|
Requirement: "The endpoint MUST sends a RST_STREAM frame with a FLOW_CONTROL_ERROR code.",
|
||||||
Run: func(c *config.ClientSpecConfig, conn *spec.Conn, req *spec.Request) error {
|
Run: func(c *config.Config, conn *spec.Conn, req *spec.Request) error {
|
||||||
headers := spec.CommonRespHeaders(c)
|
headers := spec.CommonRespHeaders(c)
|
||||||
hp := http2.HeadersFrameParam{
|
hp := http2.HeadersFrameParam{
|
||||||
StreamID: req.StreamID,
|
StreamID: req.StreamID,
|
||||||
|
|
|
@ -18,7 +18,7 @@ func WindowUpdate() *spec.ClientTestGroup {
|
||||||
tg.AddTestCase(&spec.ClientTestCase{
|
tg.AddTestCase(&spec.ClientTestCase{
|
||||||
Desc: "Sends a WINDOW_UPDATE frame with a flow control window increment of 0",
|
Desc: "Sends a WINDOW_UPDATE frame with a flow control window increment of 0",
|
||||||
Requirement: "The endpoint MUST treat this as a connection error of type PROTOCOL_ERROR.",
|
Requirement: "The endpoint MUST treat this as a connection error of type PROTOCOL_ERROR.",
|
||||||
Run: func(c *config.ClientSpecConfig, conn *spec.Conn, req *spec.Request) error {
|
Run: func(c *config.Config, conn *spec.Conn, req *spec.Request) error {
|
||||||
conn.WriteWindowUpdate(0, 0)
|
conn.WriteWindowUpdate(0, 0)
|
||||||
|
|
||||||
return spec.VerifyConnectionError(conn, http2.ErrCodeProtocol)
|
return spec.VerifyConnectionError(conn, http2.ErrCodeProtocol)
|
||||||
|
@ -33,7 +33,7 @@ func WindowUpdate() *spec.ClientTestGroup {
|
||||||
tg.AddTestCase(&spec.ClientTestCase{
|
tg.AddTestCase(&spec.ClientTestCase{
|
||||||
Desc: "Sends a WINDOW_UPDATE frame with a flow control window increment of 0 on a stream",
|
Desc: "Sends a WINDOW_UPDATE frame with a flow control window increment of 0 on a stream",
|
||||||
Requirement: "The endpoint MUST treat this as a connection error of type PROTOCOL_ERROR.",
|
Requirement: "The endpoint MUST treat this as a connection error of type PROTOCOL_ERROR.",
|
||||||
Run: func(c *config.ClientSpecConfig, conn *spec.Conn, req *spec.Request) error {
|
Run: func(c *config.Config, conn *spec.Conn, req *spec.Request) error {
|
||||||
headers := spec.CommonRespHeaders(c)
|
headers := spec.CommonRespHeaders(c)
|
||||||
hp := http2.HeadersFrameParam{
|
hp := http2.HeadersFrameParam{
|
||||||
StreamID: req.StreamID,
|
StreamID: req.StreamID,
|
||||||
|
@ -55,7 +55,7 @@ func WindowUpdate() *spec.ClientTestGroup {
|
||||||
tg.AddTestCase(&spec.ClientTestCase{
|
tg.AddTestCase(&spec.ClientTestCase{
|
||||||
Desc: "Sends a WINDOW_UPDATE frame with a length other than 4 octets",
|
Desc: "Sends a WINDOW_UPDATE frame with a length other than 4 octets",
|
||||||
Requirement: "The endpoint MUST treat this as a connection error of type FRAME_SIZE_ERROR.",
|
Requirement: "The endpoint MUST treat this as a connection error of type FRAME_SIZE_ERROR.",
|
||||||
Run: func(c *config.ClientSpecConfig, conn *spec.Conn, req *spec.Request) error {
|
Run: func(c *config.Config, conn *spec.Conn, req *spec.Request) error {
|
||||||
// WINDOW_UPDATE frame:
|
// WINDOW_UPDATE frame:
|
||||||
// length: 3, flags: 0x0, stream_id: 0
|
// length: 3, flags: 0x0, stream_id: 0
|
||||||
conn.Send([]byte("\x00\x00\x03\x08\x00\x00\x00\x00\x00"))
|
conn.Send([]byte("\x00\x00\x03\x08\x00\x00\x00\x00\x00"))
|
||||||
|
|
|
@ -132,7 +132,7 @@ func run(cmd *cobra.Command, args []string) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
c := &config.ClientSpecConfig{
|
c := &config.Config{
|
||||||
Host: host,
|
Host: host,
|
||||||
Port: port,
|
Port: port,
|
||||||
Timeout: time.Duration(timeout) * time.Second,
|
Timeout: time.Duration(timeout) * time.Second,
|
||||||
|
|
|
@ -1,56 +0,0 @@
|
||||||
package config
|
|
||||||
|
|
||||||
import (
|
|
||||||
"crypto/tls"
|
|
||||||
"fmt"
|
|
||||||
"time"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Config represents the configuration of h2spec.
|
|
||||||
type ClientSpecConfig struct {
|
|
||||||
Host string
|
|
||||||
Port int
|
|
||||||
Timeout time.Duration
|
|
||||||
MaxHeaderLen int
|
|
||||||
JUnitReport string
|
|
||||||
Strict bool
|
|
||||||
DryRun bool
|
|
||||||
TLS bool
|
|
||||||
Verbose bool
|
|
||||||
Sections []string
|
|
||||||
CertFile string
|
|
||||||
CertKeyFile string
|
|
||||||
Exec string
|
|
||||||
}
|
|
||||||
|
|
||||||
// Addr returns the string concatinated with hostname and port number.
|
|
||||||
func (c *ClientSpecConfig) Addr() string {
|
|
||||||
return fmt.Sprintf("%s:%d", c.Host, c.Port)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *ClientSpecConfig) Scheme() string {
|
|
||||||
if c.TLS {
|
|
||||||
return "https"
|
|
||||||
} else {
|
|
||||||
return "http"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// TLSConfig returns a tls.Config based on the configuration of h2spec.
|
|
||||||
func (c *ClientSpecConfig) TLSConfig() (*tls.Config, error) {
|
|
||||||
if !c.TLS {
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
cert, err := tls.LoadX509KeyPair(c.CertFile, c.CertKeyFile)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
config := tls.Config{
|
|
||||||
Certificates: []tls.Certificate{cert},
|
|
||||||
NextProtos: []string{"h2", "h2-16"},
|
|
||||||
}
|
|
||||||
|
|
||||||
return &config, nil
|
|
||||||
}
|
|
|
@ -27,6 +27,9 @@ type Config struct {
|
||||||
Verbose bool
|
Verbose bool
|
||||||
Sections []string
|
Sections []string
|
||||||
targetMap map[string]bool
|
targetMap map[string]bool
|
||||||
|
CertFile string
|
||||||
|
CertKeyFile string
|
||||||
|
Exec string
|
||||||
}
|
}
|
||||||
|
|
||||||
// Addr returns the string concatinated with hostname and port number.
|
// Addr returns the string concatinated with hostname and port number.
|
||||||
|
@ -34,10 +37,18 @@ func (c *Config) Addr() string {
|
||||||
return fmt.Sprintf("%s:%d", c.Host, c.Port)
|
return fmt.Sprintf("%s:%d", c.Host, c.Port)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *Config) Scheme() string {
|
||||||
|
if c.TLS {
|
||||||
|
return "https"
|
||||||
|
} else {
|
||||||
|
return "http"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// TLSConfig returns a tls.Config based on the configuration of h2spec.
|
// TLSConfig returns a tls.Config based on the configuration of h2spec.
|
||||||
func (c *Config) TLSConfig() *tls.Config {
|
func (c *Config) TLSConfig() (*tls.Config, error) {
|
||||||
if !c.TLS {
|
if !c.TLS {
|
||||||
return nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
config := tls.Config{
|
config := tls.Config{
|
||||||
|
@ -48,7 +59,15 @@ func (c *Config) TLSConfig() *tls.Config {
|
||||||
config.NextProtos = append(config.NextProtos, "h2", "h2-16")
|
config.NextProtos = append(config.NextProtos, "h2", "h2-16")
|
||||||
}
|
}
|
||||||
|
|
||||||
return &config
|
if c.CertFile != "" && c.CertKeyFile != "" {
|
||||||
|
cert, err := tls.LoadX509KeyPair(c.CertFile, c.CertKeyFile)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
config.Certificates = []tls.Certificate{cert}
|
||||||
|
}
|
||||||
|
|
||||||
|
return &config, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// RunMode returns a run mode of specified the section number.
|
// RunMode returns a run mode of specified the section number.
|
||||||
|
|
|
@ -68,7 +68,7 @@ func Run(c *config.Config) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func RunClientSpec(c *config.ClientSpecConfig) error {
|
func RunClientSpec(c *config.Config) error {
|
||||||
s := client.Spec()
|
s := client.Spec()
|
||||||
|
|
||||||
server, _ := spec.Listen(c, s)
|
server, _ := spec.Listen(c, s)
|
||||||
|
|
|
@ -58,7 +58,12 @@ func Dial(c *config.Config) (*Conn, error) {
|
||||||
dialer := &net.Dialer{}
|
dialer := &net.Dialer{}
|
||||||
dialer.Timeout = c.Timeout
|
dialer.Timeout = c.Timeout
|
||||||
|
|
||||||
tlsConn, err := tls.DialWithDialer(dialer, "tcp", c.Addr(), c.TLSConfig())
|
tlsConfig, err := c.TLSConfig()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
tlsConn, err := tls.DialWithDialer(dialer, "tcp", c.Addr(), tlsConfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -115,7 +120,7 @@ func Dial(c *config.Config) (*Conn, error) {
|
||||||
return &conn, nil
|
return &conn, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func Accept(c *config.ClientSpecConfig, baseConn net.Conn) (*Conn, error) {
|
func Accept(c *config.Config, baseConn net.Conn) (*Conn, error) {
|
||||||
settings := map[http2.SettingID]uint32{}
|
settings := map[http2.SettingID]uint32{}
|
||||||
|
|
||||||
framer := http2.NewFramer(baseConn, baseConn)
|
framer := http2.NewFramer(baseConn, baseConn)
|
||||||
|
@ -332,7 +337,7 @@ func (conn *Conn) WriteRawFrame(t http2.FrameType, flags http2.Flags, streamID u
|
||||||
return conn.framer.WriteRawFrame(t, flags, streamID, payload)
|
return conn.framer.WriteRawFrame(t, flags, streamID, payload)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (conn *Conn) WriteSuccessResponse(streamID uint32, c *config.ClientSpecConfig) {
|
func (conn *Conn) WriteSuccessResponse(streamID uint32, c *config.Config) {
|
||||||
hp := http2.HeadersFrameParam{
|
hp := http2.HeadersFrameParam{
|
||||||
StreamID: streamID,
|
StreamID: streamID,
|
||||||
EndStream: false,
|
EndStream: false,
|
||||||
|
|
|
@ -17,12 +17,12 @@ import (
|
||||||
type Server struct {
|
type Server struct {
|
||||||
net.Listener
|
net.Listener
|
||||||
|
|
||||||
config *config.ClientSpecConfig
|
config *config.Config
|
||||||
testCases map[string]*ClientTestCase
|
testCases map[string]*ClientTestCase
|
||||||
spec *ClientTestGroup
|
spec *ClientTestGroup
|
||||||
}
|
}
|
||||||
|
|
||||||
func Listen(c *config.ClientSpecConfig, tg *ClientTestGroup) (*Server, error) {
|
func Listen(c *config.Config, tg *ClientTestGroup) (*Server, error) {
|
||||||
var err error
|
var err error
|
||||||
var listener net.Listener
|
var listener net.Listener
|
||||||
if c.TLS {
|
if c.TLS {
|
||||||
|
|
|
@ -59,7 +59,7 @@ func (tg *ClientTestGroup) Level() int {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test runs all the tests included in this group.
|
// Test runs all the tests included in this group.
|
||||||
func (tg *ClientTestGroup) Test(c *config.ClientSpecConfig) {
|
func (tg *ClientTestGroup) Test(c *config.Config) {
|
||||||
level := tg.Level()
|
level := tg.Level()
|
||||||
|
|
||||||
log.SetIndentLevel(level)
|
log.SetIndentLevel(level)
|
||||||
|
@ -132,11 +132,11 @@ type ClientTestCase struct {
|
||||||
Requirement string
|
Requirement string
|
||||||
Parent *ClientTestGroup
|
Parent *ClientTestGroup
|
||||||
Result *ClientTestResult
|
Result *ClientTestResult
|
||||||
Run func(c *config.ClientSpecConfig, conn *Conn, req *Request) error
|
Run func(c *config.Config, conn *Conn, req *Request) error
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test runs itself as a test case.
|
// Test runs itself as a test case.
|
||||||
func (tc *ClientTestCase) Test(c *config.ClientSpecConfig) error {
|
func (tc *ClientTestCase) Test(c *config.Config) error {
|
||||||
done := make(chan error)
|
done := make(chan error)
|
||||||
go func() {
|
go func() {
|
||||||
split := strings.Split(c.Exec, " ")
|
split := strings.Split(c.Exec, " ")
|
||||||
|
@ -168,7 +168,7 @@ func (tc *ClientTestCase) Path() string {
|
||||||
return fmt.Sprintf("/%s/%d", tc.Parent.ID(), tc.Seq)
|
return fmt.Sprintf("/%s/%d", tc.Parent.ID(), tc.Seq)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (tc *ClientTestCase) FullPath(c *config.ClientSpecConfig) string {
|
func (tc *ClientTestCase) FullPath(c *config.Config) string {
|
||||||
return fmt.Sprintf("%s://%s:%d%s", c.Scheme(), c.Host, c.Port, tc.Path())
|
return fmt.Sprintf("%s://%s:%d%s", c.Scheme(), c.Host, c.Port, tc.Path())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -78,7 +78,7 @@ func CommonHeaders(c *config.Config) []hpack.HeaderField {
|
||||||
|
|
||||||
// CommonHeaders returns a array of header field of HPACK contained
|
// CommonHeaders returns a array of header field of HPACK contained
|
||||||
// common http headers used in various test case.
|
// common http headers used in various test case.
|
||||||
func CommonRespHeaders(c *config.ClientSpecConfig) []hpack.HeaderField {
|
func CommonRespHeaders(c *config.Config) []hpack.HeaderField {
|
||||||
return []hpack.HeaderField{
|
return []hpack.HeaderField{
|
||||||
HeaderField(":status", "200"),
|
HeaderField(":status", "200"),
|
||||||
}
|
}
|
||||||
|
@ -98,7 +98,7 @@ func DummyHeaders(c *config.Config, len int) []hpack.HeaderField {
|
||||||
return headers
|
return headers
|
||||||
}
|
}
|
||||||
|
|
||||||
func DummyRespHeaders(c *config.ClientSpecConfig, len int) []hpack.HeaderField {
|
func DummyRespHeaders(c *config.Config, len int) []hpack.HeaderField {
|
||||||
headers := make([]hpack.HeaderField, 0, len)
|
headers := make([]hpack.HeaderField, 0, len)
|
||||||
dummy := DummyString(c.MaxHeaderLen)
|
dummy := DummyString(c.MaxHeaderLen)
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче