From 0d571bdcebb3ed0e6a3fa6195ef8de1a7c61930b Mon Sep 17 00:00:00 2001 From: Lorenzo Donini Date: Sun, 25 Jul 2021 11:31:27 +0200 Subject: [PATCH] Simplify basic auth server check Signed-off-by: Lorenzo Donini --- ws/websocket.go | 6 ------ 1 file changed, 6 deletions(-) diff --git a/ws/websocket.go b/ws/websocket.go index b536276b..fdd193a7 100644 --- a/ws/websocket.go +++ b/ws/websocket.go @@ -427,12 +427,6 @@ out: // Handle client authentication if server.basicAuthHandler != nil { username, password, ok := r.BasicAuth() - if !ok { - server.error(fmt.Errorf("basic auth failed: credentials not found")) - w.Header().Set("WWW-Authenticate", `Basic realm="Restricted"`) - http.Error(w, "Unauthorized", http.StatusUnauthorized) - return - } ok = server.basicAuthHandler(username, password) if !ok { server.error(fmt.Errorf("basic auth failed: credentials invalid"))