]> Cypherpunks repositories - gostls13.git/commit
net/http: add ResponseController and per-handler timeouts
authorDamien Neil <dneil@google.com>
Fri, 29 Jul 2022 16:27:16 +0000 (09:27 -0700)
committerDamien Neil <dneil@google.com>
Thu, 10 Nov 2022 18:18:03 +0000 (18:18 +0000)
commitfd0c0db4a411eae0483d1cb141e801af401e43d3
tree6a6103a8bcf17cf13b7e583bcccb6d7056316c81
parent94b03081f43996aa778829596adb7f43d8644308
net/http: add ResponseController and per-handler timeouts

The ResponseController type provides a discoverable interface
to optional methods implemented by ResponseWriters.

c := http.NewResponseController(w)
c.Flush()

vs.

if f, ok := w.(http.Flusher); ok {
f.Flush()
}

Add the ability to control per-request read and write deadlines
via the ResponseController SetReadDeadline and SetWriteDeadline
methods.

For #54136

Change-Id: I3f97de60d4c9ff150cda559ef86c6620eee665d2
Reviewed-on: https://go-review.googlesource.com/c/go/+/436890
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Damien Neil <dneil@google.com>
api/next/54136.txt [new file with mode: 0644]
src/net/http/request.go
src/net/http/responsecontroller.go [new file with mode: 0644]
src/net/http/responsecontroller_test.go [new file with mode: 0644]
src/net/http/server.go