Skip to content

Commit

Permalink
fixed #2462 v9 continue support dragonfly, it's Hello command return …
Browse files Browse the repository at this point in the history
…"NOAUTH Authentication required" error (#2479)

* fixed #2462 error NOAUTH and support dragonfly

* check add comment

* alignment

---------

Co-authored-by: Monkey <golang@88.com>
  • Loading branch information
xinzhanguo and monkey92t authored Mar 10, 2023
1 parent 6501a8b commit 30a6f71
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,9 @@ func (c *baseClient) initConn(ctx context.Context, cn *pool.Conn) error {
// we continue to provide services with RESP2.
if err := conn.Hello(ctx, 3, username, password, "").Err(); err == nil {
auth = true
} else if !strings.HasPrefix(err.Error(), "ERR unknown command") {
} else if !strings.HasPrefix(err.Error(), "ERR unknown command") &&
// this check is for compatibility DragonflyDB.
!strings.HasPrefix(err.Error(), "NOAUTH Authentication") {
return err
}

Expand Down

0 comments on commit 30a6f71

Please sign in to comment.