nytimes / gziphandler

Go middleware to gzip HTTP responses
https://godoc.org/github.com/NYTimes/gziphandler
Apache License 2.0
868 stars 129 forks source link

Implement http.Hijacker to support interaction with Websockets #26

Closed durdn closed 7 years ago

durdn commented 7 years ago

Hey there,

You wrote a fantastic library and I've been using it with pleasure so far.

I have run into an issue when using the GzipHandler and gorilla/websocket (and I saw reports of similar failures for code.google.com/p/go.net/websocket):

I run into this:

websocket: response does not implement http.Hijacker

It seems the response interface of your library does not implement http.Hijacker which is needed to use websockets.

The fix appears relatively easy and several other libraries have implemented a fix. For example:

https://github.com/mholt/caddy/commit/05957b4965413bccac8a7e24dc8f5314f15a278b

https://github.com/gin-gonic/gin/pull/105/files

Other useful thread: https://github.com/gin-gonic/gin/issues/51

I probably can work around my problem by not using the GzipHandler in bulk for all my routes but I thought you'd be interested in the problem and possibly copy the fixes above.

durdn commented 7 years ago

@jprobinson Let me just say this response speed is incredible. Thanks a lot!

jprobinson commented 7 years ago

This one was all @brianfoshee. Thanks for using the lib!!

durdn commented 7 years ago

Oh right Thanks a lot to @brianfoshee !!