diff options
| author | Damien Neil <dneil@google.com> | 2024-06-04 11:06:44 -0700 |
|---|---|---|
| committer | Damien Neil <dneil@google.com> | 2024-08-29 17:38:46 +0000 |
| commit | f84dea3a01ea86a8d51cd55318e9ec9b1724b24f (patch) | |
| tree | 3e207d9ee4c70eba94f7b8d4f05d7f2bfac02158 /src/net/http/http.go | |
| parent | 4f852b9734249c063928b34a02dd689e03a8ab2c (diff) | |
| download | go-f84dea3a01ea86a8d51cd55318e9ec9b1724b24f.tar.xz | |
net/http: add HTTP2Config
Add a field to Server and Transport containing HTTP/2 configuration
parameters.
This field will have no effect until golang.org/x/net/http2 is updated
to make use of it, and h2_bundle.go is updated with the new http2
package.
For #67813
Change-Id: I81d7f8e9ddea78f9666383983aec43e3884c13ed
Reviewed-on: https://go-review.googlesource.com/c/go/+/602175
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Diffstat (limited to 'src/net/http/http.go')
| -rw-r--r-- | src/net/http/http.go | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/src/net/http/http.go b/src/net/http/http.go index 6e2259adbf..9dfc36c791 100644 --- a/src/net/http/http.go +++ b/src/net/http/http.go @@ -163,3 +163,68 @@ type Pusher interface { // is not supported on the underlying connection. Push(target string, opts *PushOptions) error } + +// HTTP2Config defines HTTP/2 configuration parameters common to +// both [Transport] and [Server]. +type HTTP2Config struct { + // MaxConcurrentStreams optionally specifies the number of + // concurrent streams that a peer may have open at a time. + // If zero, MaxConcurrentStreams defaults to at least 100. + MaxConcurrentStreams int + + // MaxDecoderHeaderTableSize optionally specifies an upper limit for the + // size of the header compression table used for decoding headers sent + // by the peer. + // A valid value is less than 4MiB. + // If zero or invalid, a default value is used. + MaxDecoderHeaderTableSize int + + // MaxEncoderHeaderTableSize optionally specifies an upper limit for the + // header compression table used for sending headers to the peer. + // A valid value is less than 4MiB. + // If zero or invalid, a default value is used. + MaxEncoderHeaderTableSize int + + // MaxReadFrameSize optionally specifies the largest frame + // this endpoint is willing to read. + // A valid value is between 16KiB and 16MiB, inclusive. + // If zero or invalid, a default value is used. + MaxReadFrameSize int + + // MaxReceiveBufferPerConnection is the maximum size of the + // flow control window for data received on a connection. + // A valid value is at least 64KiB and less than 4MiB. + // If invalid, a default value is used. + MaxReceiveBufferPerConnection int + + // MaxReceiveBufferPerStream is the maximum size of + // the flow control window for data received on a stream (request). + // A valid value is less than 4MiB. + // If zero or invalid, a default value is used. + MaxReceiveBufferPerStream int + + // SendPingTimeout is the timeout after which a health check using a ping + // frame will be carried out if no frame is received on a connection. + // If zero, no health check is performed. + SendPingTimeout time.Duration + + // PingTimeout is the timeout after which a connection will be closed + // if a response to a ping is not received. + // If zero, a default of 15 seconds is used. + PingTimeout time.Duration + + // WriteByteTimeout is the timeout after which a connection will be + // closed if no data can be written to it. The timeout begins when data is + // available to write, and is extended whenever any bytes are written. + WriteByteTimeout time.Duration + + // PermitProhibitedCipherSuites, if true, permits the use of + // cipher suites prohibited by the HTTP/2 spec. + PermitProhibitedCipherSuites bool + + // CountError, if non-nil, is called on HTTP/2 errors. + // It is intended to increment a metric for monitoring. + // The errType contains only lowercase letters, digits, and underscores + // (a-z, 0-9, _). + CountError func(errType string) +} |
