fix: use hostname instead of host in gemini network connection

This commit is contained in:
2024-10-23 12:46:48 +03:00
parent f9b5fd5e7f
commit 8d9ea6cdec

View File

@@ -45,12 +45,12 @@ func ConnectAndGetData(url string) ([]byte, error) {
if err != nil {
return nil, fmt.Errorf("Could not parse URL, error %w", err)
}
host := parsedUrl.Host
hostname := parsedUrl.Hostname()
port := parsedUrl.Port()
if port == "" {
port = "1965"
host = fmt.Sprintf("%s:%s", host, port)
}
host := fmt.Sprintf("%s:%s", hostname, port)
// Establish the underlying TCP connection.
dialer := &net.Dialer{
Timeout: time.Duration(config.CONFIG.ResponseTimeout) * time.Second,