go: x/net/http2: add IdleConnTimeout to http2.Transport
While it is possible to configure the IdleConnTimeout using the ConfigureTransports function, doing so is comparatively clunky to configuring it directly on the http2.Transport.
- It requires you to setup an http1 Transport which you may not otherwise need. you also need to guard against behavior differences elsewhere if the underlying transport is non-nil
- It requires you to reset the connPool as
ConfigureTransportssets up a different connPool implementation than if it were left nil before the first usage
The proposal then is to add the following API
// IdleConnTimeout is the maximum amount of time an idle
// (keep-alive) connection will remain idle before closing
// itself.
// Zero means no limit.
IdleConnTimeout time.Duration
which follows the existing http.Transport API. To preserve backwards compatibility, idleConnTimeout in http2.Transport will use the following rules
- if the transport IdleConnTimeout is non-zero, return that
- if the underlying transport is non-nil, return the underly transport’s IdleConnTimeout
- otherwise, return 0 (no timeout)
About this issue
- Original URL
- State: open
- Created a year ago
- Comments: 15 (9 by maintainers)
Commits related to this issue
- http2: add IdleConnTimeout to http2.Transport Exposes an IdleConnTimeout on http2.Transport directly, rather than rely on configuring it through the underlying http1 transport. Fixes golang/go#57893 — committed to dastbe/net by dastbe a year ago
- http2: add IdleConnTimeout to http2.Transport Exposes an IdleConnTimeout on http2.Transport directly, rather than rely on configuring it through the underlying http1 transport. Fixes golang/go#57893 — committed to dastbe/net by dastbe a year ago
- http2: add IdleConnTimeout to http2.Transport Exposes an IdleConnTimeout on http2.Transport directly, rather than rely on configuring it through the underlying http1 transport. For golang/go#57893 — committed to dastbe/net by dastbe a year ago
No change in consensus, so accepted. 🎉 This issue now tracks the work of implementing the proposal. — rsc for the proposal review group