Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@www.apache.org Received: (qmail 93876 invoked from network); 11 Feb 2004 23:21:04 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 11 Feb 2004 23:21:04 -0000 Received: (qmail 23156 invoked by uid 500); 11 Feb 2004 23:20:44 -0000 Delivered-To: apmail-jakarta-commons-dev-archive@jakarta.apache.org Received: (qmail 23085 invoked by uid 500); 11 Feb 2004 23:20:44 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 23057 invoked by uid 500); 11 Feb 2004 23:20:44 -0000 Received: (qmail 23051 invoked from network); 11 Feb 2004 23:20:44 -0000 Received: from unknown (HELO minotaur.apache.org) (209.237.227.194) by daedalus.apache.org with SMTP; 11 Feb 2004 23:20:44 -0000 Received: (qmail 93784 invoked by uid 1624); 11 Feb 2004 23:20:57 -0000 Date: 11 Feb 2004 23:20:57 -0000 Message-ID: <20040211232057.93783.qmail@minotaur.apache.org> From: olegk@apache.org To: jakarta-commons-cvs@apache.org Subject: cvs commit: jakarta-commons/httpclient/src/test/org/apache/commons/httpclient TestURI.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N olegk 2004/02/11 15:20:57 Modified: httpclient/src/java/org/apache/commons/httpclient HttpURL.java httpclient/src/test/org/apache/commons/httpclient TestURI.java Log: PR #26688 (HttpURL creates wrong authority String when user info is changed) Contributed by Oleg Kalnichevski Reviewed by Ortwin Glueck Revision Changes Path 1.14 +6 -6 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.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- HttpURL.java 29 Jan 2004 18:39:34 -0000 1.13 +++ HttpURL.java 11 Feb 2004 23:20:56 -0000 1.14 @@ -494,7 +494,7 @@ ? null : new String(escapedPassword); String userinfo = username + ((password == null) ? "" : ":" + password); String hostname = new String(getRawHost()); - String hostport = (_port == -1) ? hostname : hostname + _port; + String hostport = (_port == -1) ? hostname : hostname + ":" + _port; String authority = userinfo + "@" + hostport; _userinfo = userinfo.toCharArray(); _authority = authority.toCharArray(); @@ -556,7 +556,7 @@ String password = new String(getRawPassword()); String userinfo = username + ((password == null) ? "" : ":" + password); String hostname = new String(getRawHost()); - String hostport = (_port == -1) ? hostname : hostname + _port; + String hostport = (_port == -1) ? hostname : hostname + ":" + _port; String authority = userinfo + "@" + hostport; _userinfo = userinfo.toCharArray(); _authority = authority.toCharArray(); @@ -652,7 +652,7 @@ // an emtpy string is allowed as a password String userinfo = username + ((password == null) ? "" : ":" + password); String hostname = new String(getRawHost()); - String hostport = (_port == -1) ? hostname : hostname + _port; + String hostport = (_port == -1) ? hostname : hostname + ":" + _port; String authority = userinfo + "@" + hostport; _userinfo = userinfo.toCharArray(); _authority = authority.toCharArray(); 1.8 +18 -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.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- TestURI.java 29 Jan 2004 18:39:34 -0000 1.7 +++ TestURI.java 11 Feb 2004 23:20:57 -0000 1.8 @@ -213,4 +213,19 @@ } + + 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:password@localhost", url.getAuthority()); + + url = new HttpURL("localhost", 8080, "/"); + assertEquals("http://localhost:8080/", url.toString()); + url.setRawUserinfo("user".toCharArray(), "password".toCharArray()); + assertEquals("http://localhost:8080/", url.toString()); + assertEquals("user:password@localhost:8080", url.getAuthority()); + } + } --------------------------------------------------------------------- To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-dev-help@jakarta.apache.org