xml-rpc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Rall <...@finemaltcoding.com>
Subject Re: [PATCH] setBasicAuthentication from the user and password information in a URL
Date Wed, 27 Nov 2002 21:50:33 GMT
Andrew, Ryan, is this patch going to conflict w/ your changes?  I'm +1
on adding it, and will eventually do so unless you guys speak up.  :)

- Dan


"Danny Angus" <danny@apache.org> writes:

> 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:password@sub.domain.tld: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);
> 

Mime
View raw message