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

@ -81,12 +81,16 @@ func (c *HTTPConfig) SetDefaults() {
// HTTP2Config is the HTTP2 configuration of an entry point.
type HTTP2Config struct {
MaxConcurrentStreams int32 `description:"Specifies the number of concurrent streams per connection that each client is allowed to initiate." json:"maxConcurrentStreams,omitempty" toml:"maxConcurrentStreams,omitempty" yaml:"maxConcurrentStreams,omitempty" export:"true"`
MaxConcurrentStreams int32 `description:"Specifies the number of concurrent streams per connection that each client is allowed to initiate." json:"maxConcurrentStreams,omitempty" toml:"maxConcurrentStreams,omitempty" yaml:"maxConcurrentStreams,omitempty" export:"true"`
MaxDecoderHeaderTableSize int32 `description:"Specifies the maximum size of the HTTP2 HPACK header table on the decoding (receiving from client) side." json:"maxDecoderHeaderTableSize,omitempty" toml:"maxDecoderHeaderTableSize,omitempty" yaml:"maxDecoderHeaderTableSize,omitempty" export:"true"`
MaxEncoderHeaderTableSize int32 `description:"Specifies the maximum size of the HTTP2 HPACK header table on the encoding (sending to client) side." json:"maxEncoderHeaderTableSize,omitempty" toml:"maxEncoderHeaderTableSize,omitempty" yaml:"maxEncoderHeaderTableSize,omitempty" export:"true"`
}
// SetDefaults sets the default values.
func (c *HTTP2Config) SetDefaults() {
c.MaxConcurrentStreams = 250 // https://cs.opensource.google/go/x/net/+/cd36cc07:http2/server.go;l=58
c.MaxConcurrentStreams = 250 // https://cs.opensource.google/go/x/net/+/cd36cc07:http2/server.go;l=58
c.MaxDecoderHeaderTableSize = 4096 // https://cs.opensource.google/go/x/net/+/0e478a2a:http2/server.go;l=105
c.MaxEncoderHeaderTableSize = 4096 // https://cs.opensource.google/go/x/net/+/0e478a2a:http2/server.go;l=111
}
// HTTP3Config is the HTTP3 configuration of an entry point.

View file

@ -74,7 +74,9 @@ func TestConfiguration_SetEffectiveConfiguration(t *testing.T) {
MaxHeaderBytes: 1048576,
},
HTTP2: &HTTP2Config{
MaxConcurrentStreams: 250,
MaxConcurrentStreams: 250,
MaxDecoderHeaderTableSize: 4096,
MaxEncoderHeaderTableSize: 4096,
},
HTTP3: nil,
UDP: &UDPConfig{
@ -120,7 +122,9 @@ func TestConfiguration_SetEffectiveConfiguration(t *testing.T) {
MaxHeaderBytes: 1048576,
},
HTTP2: &HTTP2Config{
MaxConcurrentStreams: 250,
MaxConcurrentStreams: 250,
MaxDecoderHeaderTableSize: 4096,
MaxEncoderHeaderTableSize: 4096,
},
HTTP3: nil,
UDP: &UDPConfig{
@ -177,7 +181,9 @@ func TestConfiguration_SetEffectiveConfiguration(t *testing.T) {
MaxHeaderBytes: 1048576,
},
HTTP2: &HTTP2Config{
MaxConcurrentStreams: 250,
MaxConcurrentStreams: 250,
MaxDecoderHeaderTableSize: 4096,
MaxEncoderHeaderTableSize: 4096,
},
HTTP3: nil,
UDP: &UDPConfig{
@ -238,7 +244,9 @@ func TestConfiguration_SetEffectiveConfiguration(t *testing.T) {
MaxHeaderBytes: 1048576,
},
HTTP2: &HTTP2Config{
MaxConcurrentStreams: 250,
MaxConcurrentStreams: 250,
MaxDecoderHeaderTableSize: 4096,
MaxEncoderHeaderTableSize: 4096,
},
HTTP3: nil,
UDP: &UDPConfig{