Hi,
Heres a small patch to allow the constructor to setBasicAuthentication from the user 
and password information in a URL of this style:

protocol://user:[EMAIL PROTECTED]:port/path

Patch assumes that if only one parameter is present that it is the username, and uses 
the empty string for the password, this may not be correct.

(patch shouldn't wrap, but if it does I'll send an attachment)
d.

Index: XmlRpcClient.java
===================================================================
RCS file: /home/cvspublic/xml-rpc/src/java/org/apache/xmlrpc/XmlRpcClient.java,v
retrieving revision 1.14
diff -u -r1.14 XmlRpcClient.java
--- XmlRpcClient.java   21 Nov 2002 01:28:16 -0000      1.14
+++ XmlRpcClient.java   26 Nov 2002 12:18:20 -0000
@@ -97,6 +97,15 @@
     public XmlRpcClient(URL url)
     {
         this.url = url;
+        if(url.getUserInfo()!=null){
+            String user = url.getUserInfo();
+            int split = user.indexOf(':');
+            if (split > -1){
+                this.setBasicAuthentication(user.substring(0,split), 
+user.substring(split+1));
+            }else{
+                this.setBasicAuthentication(user,"");
+            }
+        }        
         if (XmlRpc.debug)
         {
             System.out.println("Created client to url space " + url);

Reply via email to