diff --git a/guard.go b/guard.go index db6fb4a..cfab627 100644 --- a/guard.go +++ b/guard.go @@ -1,7 +1,9 @@ package guard import ( + "bufio" "encoding/base64" + "errors" "fmt" "net" "net/http" @@ -33,6 +35,14 @@ type responseWriter struct { err string } +func (w *responseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error) { + h, ok := w.ResponseWriter.(http.Hijacker) + if !ok { + return nil, nil, errors.New("hijack not supported") + } + return h.Hijack() +} + func (w *responseWriter) WriteHeader(statusCode int) { if w.StatueCode != 0 { return