Redirects with underscore character in the location hostname cause IllegalArgumentException

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1467942 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Oleg Kalnichevski 2013-04-15 11:36:34 +00:00
parent 485f06bb27
commit 5769675b15
3 changed files with 6 additions and 3 deletions

View File

@ -1,6 +1,10 @@
Changes since release 4.3 BETA1
-------------------
* [HTTPCLIENT-1342] Redirects with underscore character in the location hostname cause
"java.lang.IllegalArgumentException: Host name may not be null".
Contributed by Oleg Kalnichevski <olegk at apache.org>
* [HTTPCLIENT-1338] (regression) Invalidated / stale DIGEST schemes do not get evicted from
the auth cache.
Contributed by Oleg Kalnichevski <olegk at apache.org>

View File

@ -462,8 +462,7 @@ public class DefaultRequestDirector implements RequestDirector {
} else {
final URI requestURI = wrapper.getURI();
if (requestURI.isAbsolute()) {
target = new HttpHost(
requestURI.getHost(), requestURI.getPort(), requestURI.getScheme());
target = URIUtils.extractHost(requestURI);
}
}
if (target == null) {

View File

@ -113,7 +113,7 @@ public class RedirectExec implements ClientExecChain {
final URI uri = currentRequest.getURI();
final HttpHost newTarget = URIUtils.extractHost(uri);
if (uri.getHost() == null) {
if (newTarget == null) {
throw new ProtocolException("Redirect URI does not specify a valid host name: " +
uri);
}