Skip to content

Commit 9153d97

Browse files
authored
Merge pull request #4 from SchmitzDan/3-httphijacker-missing-method-hijack
fix: add Hijacker and Flush methods
2 parents 4febbbd + 769f541 commit 9153d97

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

proxy_cookie.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22
package traefik_plugin_proxy_cookie //nolint
33

44
import (
5+
"bufio"
56
"context"
67
"fmt"
8+
"net"
79
"net/http"
810
"regexp"
911
)
@@ -157,3 +159,18 @@ func handleRewrites(value string, rewrites []rewrite) string {
157159
}
158160
return value
159161
}
162+
163+
func (r *responseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error) {
164+
hijacker, ok := r.writer.(http.Hijacker)
165+
if !ok {
166+
return nil, nil, fmt.Errorf("%T is not a http.Hijacker", r.writer)
167+
}
168+
169+
return hijacker.Hijack()
170+
}
171+
172+
func (r *responseWriter) Flush() {
173+
if flusher, ok := r.writer.(http.Flusher); ok {
174+
flusher.Flush()
175+
}
176+
}

0 commit comments

Comments
 (0)