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

@ -631,6 +631,12 @@ func newHTTPServer(ctx context.Context, ln net.Listener, configuration *static.E
if configuration.HTTP2.MaxConcurrentStreams < 0 {
return nil, errors.New("max concurrent streams value must be greater than or equal to zero")
}
if configuration.HTTP2.MaxDecoderHeaderTableSize < 0 {
return nil, errors.New("max decoder header table size value must be greater than or equal to zero")
}
if configuration.HTTP2.MaxEncoderHeaderTableSize < 0 {
return nil, errors.New("max encoder header table size value must be greater than or equal to zero")
}
httpSwitcher := middlewares.NewHandlerSwitcher(http.NotFoundHandler())
@ -688,7 +694,9 @@ func newHTTPServer(ctx context.Context, ln net.Listener, configuration *static.E
IdleTimeout: time.Duration(configuration.Transport.RespondingTimeouts.IdleTimeout),
MaxHeaderBytes: configuration.HTTP.MaxHeaderBytes,
HTTP2: &http.HTTP2Config{
MaxConcurrentStreams: int(configuration.HTTP2.MaxConcurrentStreams),
MaxConcurrentStreams: int(configuration.HTTP2.MaxConcurrentStreams),
MaxDecoderHeaderTableSize: int(configuration.HTTP2.MaxDecoderHeaderTableSize),
MaxEncoderHeaderTableSize: int(configuration.HTTP2.MaxEncoderHeaderTableSize),
},
}
if debugConnection || (configuration.Transport != nil && (configuration.Transport.KeepAliveMaxTime > 0 || configuration.Transport.KeepAliveMaxRequests > 0)) {