HTTPCLIENT-1479: fixed NPE in RequestAuthCache caused by incorrect context initialization
git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1575902 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
57c6856702
commit
3220bbf633
|
@ -867,6 +867,7 @@ public class DefaultRequestDirector implements RequestDirector {
|
||||||
|
|
||||||
// Populate the execution context
|
// Populate the execution context
|
||||||
context.setAttribute(ExecutionContext.HTTP_TARGET_HOST, target);
|
context.setAttribute(ExecutionContext.HTTP_TARGET_HOST, target);
|
||||||
|
context.setAttribute(ClientContext.ROUTE, route);
|
||||||
context.setAttribute(ExecutionContext.HTTP_PROXY_HOST, proxy);
|
context.setAttribute(ExecutionContext.HTTP_PROXY_HOST, proxy);
|
||||||
context.setAttribute(ExecutionContext.HTTP_CONNECTION, managedConn);
|
context.setAttribute(ExecutionContext.HTTP_CONNECTION, managedConn);
|
||||||
context.setAttribute(ExecutionContext.HTTP_REQUEST, connect);
|
context.setAttribute(ExecutionContext.HTTP_REQUEST, connect);
|
||||||
|
|
|
@ -84,7 +84,17 @@ public class RequestAuthCache implements HttpRequestInterceptor {
|
||||||
}
|
}
|
||||||
|
|
||||||
final RouteInfo route = clientContext.getHttpRoute();
|
final RouteInfo route = clientContext.getHttpRoute();
|
||||||
|
if (route == null) {
|
||||||
|
this.log.debug("Route info not set in the context");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
HttpHost target = clientContext.getTargetHost();
|
HttpHost target = clientContext.getTargetHost();
|
||||||
|
if (target == null) {
|
||||||
|
this.log.debug("Target host not set in the context");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (target.getPort() < 0) {
|
if (target.getPort() < 0) {
|
||||||
target = new HttpHost(
|
target = new HttpHost(
|
||||||
target.getHostName(),
|
target.getHostName(),
|
||||||
|
|
Loading…
Reference in New Issue