+ step + " from RouteDirector.");
}
} while (step > HttpRouteDirector.COMPLETE);
}
HttpRequestWrapper currentRequest = state.getCurrentRequest();
if (currentRequest == null) {
currentRequest = state.getMainRequest();
state.setCurrentRequest(currentRequest);
}
if (state.isRouteEstablished()) {
state.incrementExecCount();
if (state.getExecCount() > 1) {
final HttpAsyncRequestProducer requestProducer = state.getRequestProducer();
if (!requestProducer.isRepeatable() && state.isRequestContentProduced()) {
throw new NonRepeatableRequestException("Cannot retry request " +
"with a non-repeatable request entity.");
}
requestProducer.resetRequest();
}
if (this.log.isDebugEnabled()) {
this.log.debug("[exchange: " + state.getId() + "] Attempt " + state.getExecCount() +
" to execute request");
}
if (!currentRequest.containsHeader(AUTH.WWW_AUTH_RESP)) {
final AuthState targetAuthState = localContext.getTargetAuthState();
if (this.log.isDebugEnabled()) {
this.log.debug("Target auth state: " + targetAuthState.getState());
}
this.authenticator.generateAuthResponse(currentRequest, targetAuthState, localContext);
}
if (!currentRequest.containsHeader(AUTH.PROXY_AUTH_RESP) && !route.isTunnelled()) {
final AuthState proxyAuthState = localContext.getProxyAuthState();
if (this.log.isDebugEnabled()) {
this.log.debug("Proxy auth state: " + proxyAuthState.getState());
}
this.authenticator.generateAuthResponse(currentRequest, proxyAuthState, localContext);
}
} else {
if (!currentRequest.containsHeader(AUTH.PROXY_AUTH_RESP)) {
final AuthState proxyAuthState = localContext.getProxyAuthState();
if (this.log.isDebugEnabled()) {
this.log.debug("Proxy auth state: " + proxyAuthState.getState());
}
this.authenticator.generateAuthResponse(currentRequest, proxyAuthState, localContext);