Skip to content

Commit 7a0aa0f

Browse files
committed
net/http: fix zombie connection leaked
When `Server.IdleTimeout` is not zero and after the first request, the client sends part of the data of a full request, and the data is no less than 4 bytes, the idle timeout which has been set will be reset to zero here and would never close the conn: https://github.com/golang/go/blob/master/src/net/http/server.go#L1996
1 parent c1f2213 commit 7a0aa0f

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/net/http/server.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1989,9 +1989,7 @@ func (c *conn) serve(ctx context.Context) {
19891989

19901990
if d := c.server.idleTimeout(); d != 0 {
19911991
c.rwc.SetReadDeadline(time.Now().Add(d))
1992-
if _, err := c.bufr.Peek(4); err != nil {
1993-
return
1994-
}
1992+
return
19951993
}
19961994
c.rwc.SetReadDeadline(time.Time{})
19971995
}

0 commit comments

Comments
 (0)