You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by di...@apache.org on 2004/12/02 14:28:40 UTC
cvs commit: ws-axis/java/src/org/apache/axis/transport/http CommonsHTTPSender.java
dims 2004/12/02 05:28:39
Modified: java/src/org/apache/axis/transport/http
CommonsHTTPSender.java
Log:
Fix for AXIS-1689 - Broken NTLM support in CommonsHTTPSender
from Per Thomas Jahr (perja@nr.no)
Revision Changes Path
1.27 +15 -3 ws-axis/java/src/org/apache/axis/transport/http/CommonsHTTPSender.java
Index: CommonsHTTPSender.java
===================================================================
RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/transport/http/CommonsHTTPSender.java,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- CommonsHTTPSender.java 15 Oct 2004 16:01:05 -0000 1.26
+++ CommonsHTTPSender.java 2 Dec 2004 13:28:39 -0000 1.27
@@ -39,6 +39,7 @@
import org.apache.commons.httpclient.HttpState;
import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
import org.apache.commons.httpclient.UsernamePasswordCredentials;
+import org.apache.commons.httpclient.NTCredentials;
import org.apache.commons.httpclient.cookie.CookiePolicy;
import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.commons.httpclient.methods.PostMethod;
@@ -297,9 +298,20 @@
config.setHost(targetURL.getHost(), port, targetURL.getProtocol());
} else {
if (tcp.getProxyUser().length() != 0) {
- Credentials proxyCred =
- new UsernamePasswordCredentials(tcp.getProxyUser(),
- tcp.getProxyPassword());
+ Credentials proxyCred = new UsernamePasswordCredentials(tcp.getProxyUser(),
+ tcp.getProxyPassword());
+ // if the username is in the form "user\domain"
+ // then use NTCredentials instead.
+ int domainIndex = tcp.getProxyUser().indexOf("\\");
+ if (domainIndex > 0) {
+ String domain = tcp.getProxyUser().substring(0, domainIndex);
+ if (tcp.getProxyUser().length() > domainIndex + 1) {
+ String user = tcp.getProxyUser().substring(domainIndex + 1);
+ proxyCred = new NTCredentials(user,
+ tcp.getProxyPassword(),
+ tcp.getProxyHost(), domain);
+ }
+ }
client.getState().setProxyCredentials(null, null, proxyCred);
}
int proxyPort = new Integer(tcp.getProxyPort()).intValue();