From fa7f984903208d90cea6c04fed83c2a02f640a50 Mon Sep 17 00:00:00 2001 From: "joy.zhou" Date: Thu, 25 Jul 2019 13:47:27 +0800 Subject: [PATCH] update --- plugins/authhttp/authhttp.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/plugins/authhttp/authhttp.go b/plugins/authhttp/authhttp.go index 2344f8c..a125155 100644 --- a/plugins/authhttp/authhttp.go +++ b/plugins/authhttp/authhttp.go @@ -2,6 +2,7 @@ package authhttp import ( "encoding/json" + "io" "io/ioutil" "net/http" "net/url" @@ -88,10 +89,12 @@ func CheckAuth(clientID, username, password string) bool { } defer resp.Body.Close() + io.Copy(ioutil.Discard, resp.Body) if resp.StatusCode == http.StatusOK { addCache(action, clientID, username, password, "") return true } + return false } @@ -127,6 +130,8 @@ func CheckSuper(clientID, username, password string) bool { } defer resp.Body.Close() + io.Copy(ioutil.Discard, resp.Body) + if resp.StatusCode == http.StatusOK { return true } @@ -165,6 +170,8 @@ func CheckACL(username, access, topic string) bool { } defer resp.Body.Close() + io.Copy(ioutil.Discard, resp.Body) + if resp.StatusCode == http.StatusOK { addCache(action, "", username, "", topic) return true