Skip to content

Commit

Permalink
Merge pull request hoisie#21 from kenshinx/patch-auth
Browse files Browse the repository at this point in the history
Finish redis auth
  • Loading branch information
hoisie committed Jun 26, 2013
2 parents 96b5da6 + 623ec5d commit b484146
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 @@ -170,6 +170,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 @@ -178,7 +187,6 @@ func (client *Client) openConnection() (c net.Conn, err error) {
return
}
}
//TODO: handle authentication here

return
}
Expand Down

0 comments on commit b484146

Please sign in to comment.