diff options
Diffstat (limited to 'vendor/github.com/NYTimes')
-rw-r--r-- | vendor/github.com/NYTimes/gziphandler/gzip.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/vendor/github.com/NYTimes/gziphandler/gzip.go b/vendor/github.com/NYTimes/gziphandler/gzip.go index dad0eb747..fbc99396d 100644 --- a/vendor/github.com/NYTimes/gziphandler/gzip.go +++ b/vendor/github.com/NYTimes/gziphandler/gzip.go @@ -1,8 +1,10 @@ package gziphandler import ( + "bufio" "compress/gzip" "fmt" + "net" "net/http" "strconv" "strings" @@ -131,6 +133,18 @@ func (w *GzipResponseWriter) Flush() { } } +// Hijack implements http.Hijacker. If the underlying ResponseWriter is a +// Hijacker, its Hijack method is returned. Otherwise an error is returned. +func (w *GzipResponseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error) { + if hj, ok := w.ResponseWriter.(http.Hijacker); ok { + return hj.Hijack() + } + return nil, nil, fmt.Errorf("http.Hijacker interface is not supported") +} + +// verify Hijacker interface implementation +var _ http.Hijacker = &GzipResponseWriter{} + // MustNewGzipLevelHandler behaves just like NewGzipLevelHandler except that in // an error case it panics rather than returning an error. func MustNewGzipLevelHandler(level int) func(http.Handler) http.Handler { |