Skip to content
Snippets Groups Projects
Commit c466d052 authored by Ri Xu's avatar Ri Xu
Browse files

Server address validate update.

parent 53c7af64
No related branches found
Tags 1.3
No related merge requests found
package main
import (
"net"
"net/http"
"net/url"
"strconv"
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment