googollee / go-socket.io

socket.io library for golang, a realtime application framework.
Other
5.73k stars 836 forks source link

Implementation gotcha: http: multiple response.WriteHeader calls #378

Open bbars opened 4 years ago

bbars commented 4 years ago

https://github.com/googollee/go-engine.io/blob/d38973698d3378fd1cf8c996a69dcdbccff54955/server.go#L146

Because of this line I am getting a warning in stderr (from the standard http package): http: multiple response.WriteHeader calls

Underlying Gorilla's websocket writes an error to the responseWriter and returns that error.

bbars commented 4 years ago

Also, it seems that this is the reason of the googollee/go-engine.io#90 issue (with another version of std http package).

As I can see, we can't determine in a proper way if header has already been written or not. So, my purpose is to avoid writing this Bad Gateway error, or at least declare a known issue.