hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1351478 - in /httpcomponents/httpclient/trunk/httpclient/src: main/java/org/apache/http/client/utils/URIUtils.java test/java/org/apache/http/client/utils/TestURIUtils.java
Date Mon, 18 Jun 2012 20:28:00 GMT
Author: olegk
Date: Mon Jun 18 20:27:59 2012
New Revision: 1351478

URL: http://svn.apache.org/viewvc?rev=1351478&view=rev
Log:
Remove user info from request URI when rewriting

Modified:
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/utils/URIUtils.java
    httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/client/utils/TestURIUtils.java

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/utils/URIUtils.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/utils/URIUtils.java?rev=1351478&r1=1351477&r2=1351478&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/utils/URIUtils.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/utils/URIUtils.java
Mon Jun 18 20:27:59 2012
@@ -189,8 +189,8 @@ public class URIUtils {
         if (uri == null) {
             throw new IllegalArgumentException("URI may not be null");
         }
-        if (uri.getFragment() != null) {
-            return new URIBuilder(uri).setFragment(null).build();
+        if (uri.getFragment() != null || uri.getUserInfo() != null) {
+            return new URIBuilder(uri).setFragment(null).setUserInfo(null).build();
         } else {
             return uri;
         }

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/client/utils/TestURIUtils.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/client/utils/TestURIUtils.java?rev=1351478&r1=1351477&r2=1351478&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/client/utils/TestURIUtils.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/client/utils/TestURIUtils.java
Mon Jun 18 20:27:59 2012
@@ -60,6 +60,8 @@ public class TestURIUtils {
                 URI.create("http://thathost/stuff")).toString());
         Assert.assertEquals("http://thathost/stuff", URIUtils.rewriteURI(
                 URI.create("http://thathost/stuff#fragment")).toString());
+        Assert.assertEquals("http://thathost/stuff", URIUtils.rewriteURI(
+                URI.create("http://userinfo@thathost/stuff#fragment")).toString());
     }
 
     @Test



Mime
View raw message