HTTPCLIENT-1498: empty host in redirect location causes NPE
git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1591221 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
92b5d6d09d
commit
b40661e45e
|
@ -366,7 +366,7 @@ public class URIUtils {
|
|||
}
|
||||
}
|
||||
final String scheme = uri.getScheme();
|
||||
if (host != null) {
|
||||
if (!TextUtils.isBlank(host)) {
|
||||
target = new HttpHost(host, port, scheme);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -229,6 +229,8 @@ public class TestURIUtils {
|
|||
URIUtils.extractHost(new URI("http://localhost:8080;sessionid=stuff/abcd")));
|
||||
Assert.assertEquals(new HttpHost("localhost",-1),
|
||||
URIUtils.extractHost(new URI("http://localhost:;sessionid=stuff/abcd")));
|
||||
Assert.assertEquals(null,
|
||||
URIUtils.extractHost(new URI("http://:80/robots.txt")));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Reference in New Issue