mbecke 2004/05/02 08:19:15 Modified: httpclient/src/test/org/apache/commons/httpclient TestURI.java httpclient/src/java/org/apache/commons/httpclient HttpURL.java httpclient release_notes.txt Log: HttpUrl now accepts unescaped passwords. PR: 28728 Submitted by: Michael Becke Reviewed by: Oleg Kalnichevski Revision Changes Path 1.10 +9 -5 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.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- TestURI.java 22 Feb 2004 18:08:50 -0000 1.9 +++ TestURI.java 2 May 2004 15:19:15 -0000 1.10 @@ -181,14 +181,18 @@ } - public void testTestHttpUrlAuthorityString() throws Exception { HttpURL url = new HttpURL("localhost", -1, "/"); assertEquals("http://localhost/", url.toString()); url.setRawUserinfo("user".toCharArray(), "password".toCharArray()); assertEquals("http://localhost/", url.toString()); assertEquals("user:[EMAIL PROTECTED]", url.getAuthority()); - + + url = new HttpURL("user", "pass#", "localhost", 8080, "/"); + assertEquals("http://localhost:8080/", url.toString()); + assertEquals("user:pass#", url.getUserinfo()); + assertEquals("user:pass%23", url.getEscapedUserinfo()); + url = new HttpURL("localhost", 8080, "/"); assertEquals("http://localhost:8080/", url.toString()); url.setRawUserinfo("user".toCharArray(), "password".toCharArray()); 1.17 +11 -9 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpURL.java Index: HttpURL.java =================================================================== RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpURL.java,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- HttpURL.java 18 Apr 2004 23:51:35 -0000 1.16 +++ HttpURL.java 2 May 2004 15:19:15 -0000 1.17 @@ -29,6 +29,8 @@ package org.apache.commons.httpclient; +import org.apache.commons.httpclient.util.URIUtil; + /** * The HTTP URL. * @@ -316,11 +318,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); @@ -332,17 +334,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(); } 1.18 +4 -0 jakarta-commons/httpclient/release_notes.txt Index: release_notes.txt =================================================================== RCS file: /home/cvs/jakarta-commons/httpclient/release_notes.txt,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- release_notes.txt 15 Feb 2004 13:12:38 -0000 1.17 +++ release_notes.txt 2 May 2004 15:19:15 -0000 1.18 @@ -1,5 +1,9 @@ Changes on the CVS trunk: + * 28728 - HttpUrl now accepts unescaped passwords + + * 28626 - Fixed ArrayIndexOutOfBoundsException in HttpStatus.getStatusText() + * 24012 - Added IgnoreCookiesSpec. * 24018 - Cookie and Authorization headers can now be set manually.
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]