Skip to content

Commit 1e302ca

Browse files
committed
Merge pull request #22 from tatsuhiro-t/test-dup-pseudo-header
Add test "Send HEADERS frame containing more than one pseudo-header fiel...
2 parents 18e4607 + cd2ff50 commit 1e302ca

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

8_1.go

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,36 @@ func RequestPseudoHeaderFieldsTestGroup() *TestGroup {
227227
},
228228
))
229229

230+
tg.AddTestCase(NewTestCase(
231+
"Sends a HEADERS frame containing more than one pseudo-header fields with the same name",
232+
"the endpoint MUST respond with a stream error of type PROTOCOL_ERROR.",
233+
func(ctx *Context) (expected []Result, actual Result) {
234+
http2Conn := CreateHttp2Conn(ctx, true)
235+
defer http2Conn.conn.Close()
236+
237+
hdrs := []hpack.HeaderField{
238+
pair(":method", "GET"),
239+
pair(":scheme", "http"),
240+
pair(":path", "http"),
241+
pair(":authority", ctx.Authority()),
242+
pair(":method", "GET"),
243+
pair(":scheme", "http"),
244+
pair(":path", "http"),
245+
pair(":authority", ctx.Authority()),
246+
}
247+
248+
var hp http2.HeadersFrameParam
249+
hp.StreamID = 1
250+
hp.EndStream = true
251+
hp.EndHeaders = true
252+
hp.BlockFragment = http2Conn.EncodeHeader(hdrs)
253+
http2Conn.fr.WriteHeaders(hp)
254+
255+
actualCodes := []http2.ErrCode{http2.ErrCodeProtocol}
256+
return TestStreamError(ctx, http2Conn, actualCodes)
257+
},
258+
))
259+
230260
return tg
231261
}
232262

0 commit comments

Comments
 (0)