You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@excalibur.apache.org by "Shash Chatterjee (JIRA)" <de...@excalibur.apache.org> on 2005/04/16 17:39:05 UTC

[jira] Resolved: (EXLBR-15) In org.apache.excalibur.source.impl.FTPSource, URL.getXYZ() results must be URL-decoded

     [ http://issues.apache.org/jira/browse/EXLBR-15?page=history ]
     
Shash Chatterjee resolved EXLBR-15:
-----------------------------------

    Resolution: Fixed

Date: Sat Apr 16 08:18:28 2005
New Revision: 161578

URL: http://svn.apache.org/viewcvs?view=rev&rev=161578
Log:
Patch from: http://issues.apache.org/jira/browse/EXLBR-15
Fixes: The getXYZ() methods in java.net.URL give results which are URL-encoded, if the URL was constructed from a String (which must be URL-encoded). This may be considered a bug in java.net.URL, but it is the way it is.
In order to get the right URL-components (path, userinfo, etc.), the method java.net.URLDecoder.decode() must be applied to the result of java.net.URL.getXYZ(). The result of getUserInfo must first be split (on ':') before decoding is applied. 

Modified:
    excalibur/trunk/components/sourceresolve/src/java/org/apache/excalibur/source/impl/FTPSource.java



> In org.apache.excalibur.source.impl.FTPSource, URL.getXYZ() results must be URL-decoded
> ---------------------------------------------------------------------------------------
>
>          Key: EXLBR-15
>          URL: http://issues.apache.org/jira/browse/EXLBR-15
>      Project: Excalibur Components
>         Type: Bug
>   Components: SourceResolver
>     Versions: 1.1.1
>  Environment: Windows XP, Unix, J2SE 1.4.2
>     Reporter: Nico Verwer
>     Assignee: Shash Chatterjee
>  Attachments: FTPSource.java
>
> The getXYZ() methods in java.net.URL give results which are URL-encoded, if the URL was constructed from a String (which must be URL-encoded). This may be considered a bug in java.net.URL, but it is the way it is.
> In order to get the right URL-components (path, userinfo, etc.),  the method java.net.URLDecoder.decode() must be applied to the result of java.net.URL.getXYZ(). The result of getUserInfo must first be split (on ':') before decoding is applied.
> Example of how this affects functionality of FTPSource:
> URLs for FTP may contain a password:
>   ftp://user:password@host/path
> If the password contains the '@' character, like
>   ftp://user:p@ssw0rd@host/path
> this will be interpreted as user 'user' with password 'p' and host 'ssw0rd@host', which is wrong. In order to allow reserved characters in URL's, URL-encoding is used (see RFC 1738 for this particular case, and others). For instance, '@' would be encoded by '%40' in the string-representation of the URL.
> Because URL-components are not decoded in FTPSource, it is impossible to use a password containing '@', or other parts of the URL that contain reserved characters.
> This problem is easy to fix using URLDecoder.
> I'll see if I can attach the code for this fix.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@excalibur.apache.org
For additional commands, e-mail: dev-help@excalibur.apache.org