Remove user info from request URI when rewriting
git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1351478 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
2e3efc7d27
commit
ddde53711c
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue