fix(auth): redisLoader copy-paste bug, httpLoader.Close leak, reload data wipe, silent parse errors
- redisLoader branch used fileLoader instead of redisLoader (copy-paste bug) - Close() was missing httpLoader.Close() (resource leak vs admission pattern) - reload() now preserves kvs on load() error instead of wiping to static-only - load() propagates first loader error, reload() returns early on load failure - parseAuths scanner errors now logged instead of silently discarded - http plugin drains body on non-200 to allow keep-alive connection reuse - Replace manual map-copy loops with maps.Copy
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/go-gost/core/auth"
|
||||
@@ -91,6 +92,7 @@ func (p *httpPlugin) Authenticate(ctx context.Context, user, password string, op
|
||||
defer resp.Body.Close()
|
||||
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
io.Copy(io.Discard, resp.Body)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user