Skip to content

Commit

Permalink
Finish redis auth
Browse files Browse the repository at this point in the history
re-commit @shxsun's code.  recover previous formation convinient for merge.
  • Loading branch information
kenshinx committed Jun 26, 2013
1 parent f1b3e0c commit 623ec5d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,15 @@ func (client *Client) openConnection() (c net.Conn, err error) {
if err != nil {
return
}

//handle authentication here authored by @shxsun
if client.Password != "" {
cmd := fmt.Sprintf("AUTH %s\r\n", client.Password)
_, err = client.rawSend(c, []byte(cmd))
if err != nil {
return
}
}

if client.Db != 0 {
cmd := fmt.Sprintf("SELECT %d\r\n", client.Db)
Expand All @@ -176,7 +185,6 @@ func (client *Client) openConnection() (c net.Conn, err error) {
return
}
}
//TODO: handle authentication here

return
}
Expand Down

0 comments on commit 623ec5d

Please sign in to comment.