Increase consistency of path escaping and support IPv6 addresses instead of hostnames

This commit is contained in:
Henri
2021-04-06 21:43:58 +02:00
parent f77a8a28fe
commit 874089117b
5 changed files with 21 additions and 20 deletions

View File

@@ -5,6 +5,7 @@ import (
"net/http"
"net/url"
"strconv"
"strings"
)
type channelData struct {
@@ -36,6 +37,10 @@ func batchRequest(servers []string, endpoint string, command string) []string {
} else {
// Compose URL and send the request
hostname := server
hostname = url.PathEscape(hostname)
if strings.Contains(hostname, ":") {
hostname = "[" + hostname + "]"
}
if setting.domain != "" {
hostname += "." + setting.domain
}