Skip to content

Commit

Permalink
fix incorrect servername parsing (fix issue #125)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicolas Chatelain committed Jan 1, 2025
1 parent c1cead0 commit ad07712
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions cmd/agent/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,8 @@ func main() {
}

serverUrl, err := url.Parse(*serverAddr)
if err == nil && serverUrl != nil {
if serverUrl.Scheme == "https" {
//websocket https connection
tlsConfig.ServerName = serverUrl.Hostname()
}
if err == nil && serverUrl != nil && serverUrl.Scheme == "https" {
tlsConfig.ServerName = serverUrl.Hostname()
} else {
//direct connection. try to parse as host:port
host, _, err := net.SplitHostPort(*serverAddr)
Expand Down

0 comments on commit ad07712

Please sign in to comment.