Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Literal Header Field representation with invalid index #113

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
34 changes: 33 additions & 1 deletion hpack/2_3_3_index_address_space.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ func IndexAddressSpace() *spec.TestGroup {
// Indices strictly greater than the sum of the lengths of both
// tables MUST be treated as a decoding error.
tg.AddTestCase(&spec.TestCase{
Desc: "Sends a header field representation with invalid index",
Desc: "Sends a indexed header field representation with invalid index",
Requirement: "The endpoint MUST treat this as a decoding error.",
Run: func(c *config.Config, conn *spec.Conn) error {
var streamID uint32 = 1
Expand Down Expand Up @@ -41,5 +41,37 @@ func IndexAddressSpace() *spec.TestGroup {
},
})

// Indices strictly greater than the sum of the lengths of both
// tables MUST be treated as a decoding error.
tg.AddTestCase(&spec.TestCase{
Desc: "Sends a literal header field representation with invalid index",
Requirement: "The endpoint MUST treat this as a decoding error.",
Run: func(c *config.Config, conn *spec.Conn) error {
var streamID uint32 = 1

err := conn.Handshake()
if err != nil {
return err
}

// Literal Header Field with Incremental Indexing (index=70 & value=empty)
indexedRep := []byte("\x7F\x07\x00")

headers := spec.CommonHeaders(c)
blockFragment := conn.EncodeHeaders(headers)
blockFragment = append(blockFragment, indexedRep...)

hp := http2.HeadersFrameParam{
StreamID: streamID,
EndStream: true,
EndHeaders: true,
BlockFragment: blockFragment,
}
conn.WriteHeaders(hp)

return spec.VerifyConnectionError(conn, http2.ErrCodeCompression)
},
})

return tg
}