net/http: check server shutting down before processing the request

This commit is contained in:
wineandchord 2024-02-20 14:51:05 +08:00
parent 5c92f43c51
commit 426099a3e7

View file

@ -1966,6 +1966,9 @@ func (c *conn) serve(ctx context.Context) {
// If we read any bytes off the wire, we're active.
c.setState(c.rwc, StateActive, runHooks)
}
if c.server.shuttingDown() {
return
}
if err != nil {
const errorHeaders = "\r\nContent-Type: text/plain; charset=utf-8\r\nConnection: close\r\n\r\n"