Skip to content

x/net/http2: configurable server pings #67812

Closed
@neild

Description

@neild

This issue is part of a project to move x/net/http2 into std: #67810

A HTTP/2 client or server may send PING frames to its peer. (RFC 9113 Section 6.7)

The http2.ReadIdleTimeout and http2.PingTimeout fields configure an HTTP/2 client to send a PING when a connection has been idle for some amount of time, and to close the connection if no response is received.

The http2.Server does not support sending PINGs on idle connections.

I propose adding the ability to configure servers to send pings as well. This setting will be off by default.

package http2

type Server struct { // contains unchanged fields
	// ReadIdleTimeout 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.
	ReadIdleTimeout 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
}

Adding this feature removes an inconsistency between HTTP/2 client and server configurations. Aligning the two will make it easier to add support for configuring HTTP/2 features to net/http, since we can define a single configuration struct rather than separate ones for clients and servers.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Accepted

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions