diff --git a/src/net/http/server.go b/src/net/http/server.go index 4e73508973a..01e7e10011e 100644 --- a/src/net/http/server.go +++ b/src/net/http/server.go @@ -736,9 +736,25 @@ func (cr *connReader) abortPendingRead() { } cr.aborted = true cr.conn.rwc.SetReadDeadline(aLongTimeAgo) - for cr.inRead { - cr.cond.Wait() - } + done := make(chan struct{}) + go func() { + for cr.inRead { + cr.cond.Wait() + } + close(done) + }() + + func() { + for { + select { + case <-done: + return + case <-time.After(100*time.Millisecond): + cr.conn.rwc.SetReadDeadline(aLongTimeAgo) + } + } + }() + cr.conn.rwc.SetReadDeadline(time.Time{}) }