notifiers: Stop using url.Parse in validating address format. (#4011)

url.Parse() wrongly parses an address of format "address:port"
which is fixed in go1.8.  This inculcates a breaking change
on our end. We should fix this wrong usage everywhere so that
migrating to go1.8 eventually becomes smoother.
This commit is contained in:
Harshavardhana
2017-03-31 04:47:40 -07:00
committed by GitHub
parent 096427f973
commit f1015a5096
7 changed files with 22 additions and 14 deletions
+3 -1
View File
@@ -20,6 +20,7 @@ import (
"encoding/json"
"fmt"
"io/ioutil"
"net"
"time"
"github.com/Sirupsen/logrus"
@@ -52,7 +53,7 @@ func (r *redisNotify) Validate() error {
if r.Format != formatNamespace && r.Format != formatAccess {
return rdNFormatError
}
if _, err := checkURL(r.Addr); err != nil {
if _, _, err := net.SplitHostPort(r.Addr); err != nil {
return err
}
if r.Key == "" {
@@ -73,6 +74,7 @@ func dialRedis(rNotify redisNotify) (*redis.Pool, error) {
if !rNotify.Enable {
return nil, errNotifyNotEnabled
}
addr := rNotify.Addr
password := rNotify.Password
rPool := &redis.Pool{