From 0fbd962f8ac90259bdee6d1e5769df3a45fea34c Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Fri, 17 Jan 2014 15:03:43 -0600 Subject: [PATCH] Use our own websocket.Server instance. The websocket.Server used the by websocket.Handler type automatically adds a handshake function which prevents connections when the Origin header is not set. Not all clients send this information and we already require authentication headers as the auth mechanism anyways. --- rpcserver.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rpcserver.go b/rpcserver.go index 07135ed8..1add3136 100644 --- a/rpcserver.go +++ b/rpcserver.go @@ -152,7 +152,10 @@ func (s *rpcServer) Start() { http.Error(w, "401 Unauthorized.", http.StatusUnauthorized) return } - websocket.Handler(s.walletReqsNotifications).ServeHTTP(w, r) + wsServer := websocket.Server{ + Handler: websocket.Handler(s.walletReqsNotifications), + } + wsServer.ServeHTTP(w, r) }) for _, listener := range s.listeners {