diff --git a/Duplicati/Library/Backend/WEBDAV/WEBDAV.cs b/Duplicati/Library/Backend/WEBDAV/WEBDAV.cs index 0a1efd061..2e5c480ad 100644 --- a/Duplicati/Library/Backend/WEBDAV/WEBDAV.cs +++ b/Duplicati/Library/Backend/WEBDAV/WEBDAV.cs @@ -33,6 +33,7 @@ namespace Duplicati.Library.Backend private string m_reverseProtocolUrl; private string m_rawurl; private string m_rawurlPort; + private string m_dnsName; private bool m_useIntegratedAuthentication = false; private bool m_forceDigestAuthentication = false; private bool m_useSSL = false; @@ -61,6 +62,7 @@ namespace Duplicati.Library.Backend { var u = new Utility.Uri(url); u.RequireHost(); + m_dnsName = u.Host; if (!string.IsNullOrEmpty(u.Username)) { @@ -311,7 +313,12 @@ namespace Duplicati.Library.Backend get { return Strings.WEBDAV.Description; } } - public string DNSName => throw new NotImplementedException(); + public string DNSName + { + get { return m_dnsName; } + } + + //=> throw new NotImplementedException(); public void Test() { diff --git a/Duplicati/Library/Main/BackendManager.cs b/Duplicati/Library/Main/BackendManager.cs index 15969fbcd..159318dc7 100644 --- a/Duplicati/Library/Main/BackendManager.cs +++ b/Duplicati/Library/Main/BackendManager.cs @@ -519,6 +519,19 @@ namespace Duplicati.Library.Main throw; } + // Refresh DNS name if we fail to connect in order to prevent issues with incorrect DNS entries + if (ex is System.Net.WebException) + { + try + { + System.Net.Dns.GetHostEntry(m_backend.DNSName); + } + catch + { + Logging.Log.WriteMessage("Failed to resolve IP for " + m_backend.DNSName, Logging.LogMessageType.Warning); + } + } + m_statwriter.SendEvent(item.BackendActionType, retries < m_numberofretries ? BackendEventType.Retrying : BackendEventType.Failed, item.RemoteFilename, item.Size); bool recovered = false;