diff --git a/src/java/davmail/http/DavGatewayHttpClientFacade.java b/src/java/davmail/http/DavGatewayHttpClientFacade.java index 4e083fa8..5e6e2418 100644 --- a/src/java/davmail/http/DavGatewayHttpClientFacade.java +++ b/src/java/davmail/http/DavGatewayHttpClientFacade.java @@ -41,6 +41,8 @@ import org.apache.log4j.Logger; import java.io.IOException; import java.util.ArrayList; +import java.net.InetAddress; +import java.net.UnknownHostException; /** * Create HttpClient instance according to DavGateway Settings @@ -146,9 +148,16 @@ public final class DavGatewayHttpClientFacade { // detect ntlm authentication (windows domain name in user name) int backslashindex = proxyUser.indexOf('\\'); if (backslashindex > 0) { + // get local host name for NTLM authentication + String host; + try { + host = InetAddress.getLocalHost().getHostName(); + } catch (UnknownHostException e) { + host = "localhost"; + } httpClient.getState().setProxyCredentials(authScope, new NTCredentials(proxyUser.substring(backslashindex + 1), - proxyPassword, null, + proxyPassword, host, proxyUser.substring(0, backslashindex))); } else { httpClient.getState().setProxyCredentials(authScope,