mirror of https://github.com/go-redis/redis.git
feat: disables sending HELLO if protocol is -1
This commit is contained in:
parent
f994ff1cd9
commit
646d99e12a
|
@ -46,7 +46,8 @@ type Options struct {
|
|||
OnConnect func(ctx context.Context, cn *Conn) error
|
||||
|
||||
// Protocol 2 or 3. Use the version to negotiate RESP version with redis-server.
|
||||
// Default is 3.
|
||||
// Default is 3; -1 disables sending HELLO means that the version depends on the default
|
||||
// settings of redis-server.
|
||||
Protocol int
|
||||
// Use the specified Username to authenticate the current connection
|
||||
// with one of the connections defined in the ACL list when connecting
|
||||
|
|
3
redis.go
3
redis.go
|
@ -280,6 +280,8 @@ func (c *baseClient) initConn(ctx context.Context, cn *pool.Conn) error {
|
|||
|
||||
var auth bool
|
||||
protocol := c.opt.Protocol
|
||||
// disables sending HELLO if protocol is lower than 0.
|
||||
if protocol >= 0 {
|
||||
// By default, use RESP3 in current version.
|
||||
if protocol < 2 {
|
||||
protocol = 3
|
||||
|
@ -299,6 +301,7 @@ func (c *baseClient) initConn(ctx context.Context, cn *pool.Conn) error {
|
|||
// difficult to rely on error strings to determine all results.
|
||||
return err
|
||||
}
|
||||
}
|
||||
if !c.opt.DisableIndentity {
|
||||
libName := ""
|
||||
libVer := Version()
|
||||
|
|
Loading…
Reference in New Issue