Skip to content

Commit 0db2bf2

Browse files
committed
net/http: document Hijacker and Flusher more
Fixes #15312 Change-Id: I4fabef3f21081bc4b020069851b5c2504bc6b4d8 Reviewed-on: https://go-review.googlesource.com/22122 Reviewed-by: Emmanuel Odeke <[email protected]> Reviewed-by: Andrew Gerrand <[email protected]>
1 parent f5423a6 commit 0db2bf2

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Diff for: src/net/http/server.go

+9
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@ type ResponseWriter interface {
9494
// The Flusher interface is implemented by ResponseWriters that allow
9595
// an HTTP handler to flush buffered data to the client.
9696
//
97+
// The default HTTP/1.x and HTTP/2 ResponseWriter implementations
98+
// support Flusher, but ResponseWriter wrappers may not. Handlers
99+
// should always test for this ability at runtime.
100+
//
97101
// Note that even for ResponseWriters that support Flush,
98102
// if the client is connected through an HTTP proxy,
99103
// the buffered data may not reach the client until the response
@@ -105,6 +109,11 @@ type Flusher interface {
105109

106110
// The Hijacker interface is implemented by ResponseWriters that allow
107111
// an HTTP handler to take over the connection.
112+
//
113+
// The default ResponseWriter for HTTP/1.x connections supports
114+
// Hijacker, but HTTP/2 connections intentionally do not.
115+
// ResponseWriter wrappers may also not support Hijacker. Handlers
116+
// should always test for this ability at runtime.
108117
type Hijacker interface {
109118
// Hijack lets the caller take over the connection.
110119
// After a call to Hijack(), the HTTP server library

0 commit comments

Comments
 (0)