Skip to content

net/http: Server doesn't use ReadHeaderTimeout for TLS handshake deadline #48120

Closed
@bradfitz

Description

@bradfitz

The net/http.Server does:

// Serve a new connection.
func (c *conn) serve(ctx context.Context) {
...
        if tlsConn, ok := c.rwc.(*tls.Conn); ok {
                if d := c.server.ReadTimeout; d > 0 {
                        c.rwc.SetReadDeadline(time.Now().Add(d))
                }
                if d := c.server.WriteTimeout; d > 0 {
                        c.rwc.SetWriteDeadline(time.Now().Add(d))
                }
                if err := tlsConn.HandshakeContext(ctx); err != nil {

But if only Server.ReadHeaderTimeout is set (and not ReadTimeout), it seems like ReadHeaderTimeout should be used for the TLS handshake deadline instead of infinite.

/cc @neild

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions