|
@@ -218,6 +218,14 @@ func (s *Server) wslisten(addr string) {
|
218
|
218
|
Log.error.Printf("%s method not allowed", s)
|
219
|
219
|
return
|
220
|
220
|
}
|
|
221
|
+
|
|
222
|
+ // We don't have any subprotocols, so if someone attempts to `new
|
|
223
|
+ // WebSocket(server, "subprotocol")` they'll break here, instead of
|
|
224
|
+ // getting the default, ambiguous, response from gorilla.
|
|
225
|
+ if v, ok := r.Header["Sec-Websocket-Protocol"]; ok {
|
|
226
|
+ http.Error(w, fmt.Sprintf("WebSocket subprocotols (e.g. %s) not supported", v), 400)
|
|
227
|
+ }
|
|
228
|
+
|
221
|
229
|
ws, err := upgrader.Upgrade(w, r, nil)
|
222
|
230
|
if err != nil {
|
223
|
231
|
Log.error.Printf("%s websocket upgrade error: %s", s, err)
|