1
0
Fork 0

Merge branch v2.2 into v2.3

This commit is contained in:
Fernandez Ludovic 2020-09-07 16:30:17 +02:00
commit 8474a61f21
3 changed files with 30 additions and 2 deletions

View file

@ -1,6 +1,9 @@
package headers
import (
"bufio"
"fmt"
"net"
"net/http"
"github.com/containous/traefik/v2/pkg/log"
@ -73,3 +76,19 @@ func (w *responseModifier) Write(b []byte) (int, error) {
return w.w.Write(b)
}
// Hijack hijacks the connection.
func (w *responseModifier) Hijack() (net.Conn, *bufio.ReadWriter, error) {
if h, ok := w.w.(http.Hijacker); ok {
return h.Hijack()
}
return nil, nil, fmt.Errorf("not a hijacker: %T", w.w)
}
// Flush sends any buffered data to the client.
func (w *responseModifier) Flush() {
if flusher, ok := w.w.(http.Flusher); ok {
flusher.Flush()
}
}