You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by og...@apache.org on 2004/05/14 11:47:36 UTC
cvs commit: jakarta-commons/httpclient/src/java/org/apache/commons/httpclient HttpsURL.java
oglueck 2004/05/14 02:47:36
Modified: httpclient/src/test/org/apache/commons/httpclient Tag:
HTTPCLIENT_2_0_BRANCH TestURI.java
httpclient/src/java/org/apache/commons/httpclient Tag:
HTTPCLIENT_2_0_BRANCH HttpsURL.java
Log:
fixed unescaped metacharacters in constructor
PR: 28728
Revision Changes Path
No revision
No revision
1.4.2.6 +23 -3 jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestURI.java
Index: TestURI.java
===================================================================
RCS file: /home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestURI.java,v
retrieving revision 1.4.2.5
retrieving revision 1.4.2.6
diff -u -r1.4.2.5 -r1.4.2.6
--- TestURI.java 2 May 2004 15:15:34 -0000 1.4.2.5
+++ TestURI.java 14 May 2004 09:47:36 -0000 1.4.2.6
@@ -199,5 +199,25 @@
assertEquals("http://localhost:8080/", url.toString());
assertEquals("user:password@localhost:8080", url.getAuthority());
}
+
+ public void testTestHttpsUrlAuthorityString() throws Exception {
+ HttpsURL url = new HttpsURL("localhost", -1, "/");
+ assertEquals("https://localhost/", url.toString());
+ url.setRawUserinfo("user".toCharArray(), "password".toCharArray());
+ assertEquals("https://localhost/", url.toString());
+ assertEquals("user:password@localhost", url.getAuthority());
+
+ url = new HttpsURL("user", "pass#", "localhost", 8080, "/");
+ assertEquals("https://localhost:8080/", url.toString());
+ assertEquals("user:pass#", url.getUserinfo());
+ assertEquals("user:pass%23", url.getEscapedUserinfo());
+
+ url = new HttpsURL("localhost", 8080, "/");
+ assertEquals("https://localhost:8080/", url.toString());
+ url.setRawUserinfo("user".toCharArray(), "password".toCharArray());
+ assertEquals("https://localhost:8080/", url.toString());
+ assertEquals("user:password@localhost:8080", url.getAuthority());
+
+ }
}
No revision
No revision
1.6.2.3 +11 -9 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpsURL.java
Index: HttpsURL.java
===================================================================
RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpsURL.java,v
retrieving revision 1.6.2.2
retrieving revision 1.6.2.3
diff -u -r1.6.2.2 -r1.6.2.3
--- HttpsURL.java 22 Feb 2004 18:21:13 -0000 1.6.2.2
+++ HttpsURL.java 14 May 2004 09:47:36 -0000 1.6.2.3
@@ -31,6 +31,8 @@
package org.apache.commons.httpclient;
+import org.apache.commons.httpclient.util.URIUtil;
+
/**
* The HTTPS URL.
*
@@ -320,11 +322,11 @@
buff.append(_default_scheme);
buff.append("://");
if (userinfo != null) {
- buff.append(userinfo);
+ buff.append(URIUtil.encode(userinfo, URI.allowed_userinfo));
buff.append('@');
}
if (host != null) {
- buff.append(host);
+ buff.append(URIUtil.encode(host, URI.allowed_host));
if (port != -1 || port != DEFAULT_PORT) {
buff.append(':');
buff.append(port);
@@ -336,17 +338,17 @@
throw new URIException(URIException.PARSING,
"abs_path requested");
}
- buff.append(path);
+ buff.append(URIUtil.encode(path, URI.allowed_abs_path));
}
if (query != null) {
buff.append('?');
- buff.append(query);
+ buff.append(URIUtil.encode(query, URI.allowed_query));
}
if (fragment != null) {
buff.append('#');
- buff.append(fragment);
+ buff.append(URIUtil.encode(fragment, URI.allowed_fragment));
}
- parseUriReference(buff.toString(), false);
+ parseUriReference(buff.toString(), true);
checkValid();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org