Skip to content

Commit

Permalink
Server address validate update.
Browse files Browse the repository at this point in the history
  • Loading branch information
xuri committed Oct 26, 2016
1 parent 53c7af6 commit c466d05
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cookies.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main

import (
"net"
"net/http"
"net/url"
"strconv"
Expand Down Expand Up @@ -28,7 +29,8 @@ func readCookies(r *http.Request) {
}
for _, v := range servers {
_, err := url.ParseRequestURI(v)
if err != nil {
// Server address should be a valid URL or dotted decimal IPv4 or IPv6 form.
if err != nil && net.ParseIP(strings.Split(v, `:`)[0]) == nil {
continue
}
selfConf.Servers = append(selfConf.Servers, v)
Expand Down

0 comments on commit c466d05

Please sign in to comment.