1
0
Fork 0

Implement HTTP2 HPACK table size options

This commit is contained in:
GCHQDeveloper548 2025-10-03 13:24:04 +01:00 committed by GitHub
parent 5d830477b7
commit 0b7f0b4042
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 115 additions and 8 deletions

View file

@ -648,3 +648,34 @@ func TestPathOperations(t *testing.T) {
})
}
}
func TestHTTP2Config(t *testing.T) {
expectedMaxConcurrentStreams := 42
expectedEncoderTableSize := 128
expectedDecoderTableSize := 256
// Create a listener for the server.
ln, err := net.Listen("tcp", "127.0.0.1:0")
require.NoError(t, err)
t.Cleanup(func() {
_ = ln.Close()
})
// Define the server configuration.
configuration := &static.EntryPoint{}
configuration.SetDefaults()
configuration.HTTP2.MaxConcurrentStreams = int32(expectedMaxConcurrentStreams)
configuration.HTTP2.MaxEncoderHeaderTableSize = int32(expectedEncoderTableSize)
configuration.HTTP2.MaxDecoderHeaderTableSize = int32(expectedDecoderTableSize)
// Create the HTTP server using newHTTPServer.
server, err := newHTTPServer(t.Context(), ln, configuration, false, requestdecorator.New(nil))
require.NoError(t, err)
// Get the underlying HTTP Server.
httpServer := server.Server.(*http.Server)
assert.Equal(t, expectedMaxConcurrentStreams, httpServer.HTTP2.MaxConcurrentStreams)
assert.Equal(t, expectedEncoderTableSize, httpServer.HTTP2.MaxEncoderHeaderTableSize)
assert.Equal(t, expectedDecoderTableSize, httpServer.HTTP2.MaxDecoderHeaderTableSize)
}