} else if (response.status().equals(HttpResponseStatus.MOVED_PERMANENTLY)
|| response.status().equals(HttpResponseStatus.TEMPORARY_REDIRECT)) {
if (response.headers().contains("Location")) {
this.request.setUrl(response.headers().get("Location"));
this.client.connect(this.request);
<BUG>ctx.close();
logger.warn("redirect for " + this.request.getHttpRequest().uri() + " to " + response.headers().get("Location"));
} else {</BUG>
this.promise.setFailure(new Exception("Missing Location header on redirect"));
}

} else if (response.status().equals(HttpResponseStatus.MOVED_PERMANENTLY)
|| response.status().equals(HttpResponseStatus.TEMPORARY_REDIRECT)) {
if (response.headers().contains("Location")) {
this.request.setUrl(response.headers().get("Location"));
this.client.connect(this.request);
ctx.close();
if (logger.isDebugEnabled()) {
logger.debug(
"redirect for " + this.request.getHttpRequest().uri() + " to " + response.headers()
.get("Location"));
}
