You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bi...@apache.org on 2002/06/16 04:52:03 UTC
cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/util URL.java
billbarker 2002/06/15 19:52:02
Modified: catalina/src/share/org/apache/catalina/util URL.java
Log:
Teach URL how to parse userInfo.
This allows URL to parse a string of the form:
ftp://user:pass@ftp.mycompany.com/
This actually doesn't fix any Tomcat problems (assuming that the string
is correct to start with).
Revision Changes Path
1.3 +11 -7 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/util/URL.java
Index: URL.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/util/URL.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- URL.java 5 Sep 2001 17:31:11 -0000 1.2
+++ URL.java 16 Jun 2002 02:52:02 -0000 1.3
@@ -698,7 +698,11 @@
start = limit;
}
if (authority.length() > 0) {
- int colon = authority.indexOf(':');
+ int at = authority.indexOf('@');
+ if( at >= 0 ) {
+ userInfo = authority.substring(0,at);
+ }
+ int colon = authority.indexOf(':',at+1);
if (colon >= 0) {
try {
port =
@@ -706,9 +710,9 @@
} catch (NumberFormatException e) {
throw new MalformedURLException(e.toString());
}
- host = authority.substring(0, colon);
+ host = authority.substring(at+1, colon);
} else {
- host = authority;
+ host = authority.substring(at+1);
port = -1;
}
}
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>