future.setPendingResponse(response);
} else if (e instanceof LastHttpContent) {
HttpResponse response = future.getPendingResponse();
future.setPendingResponse(null);
HttpResponseStatus status = new NettyResponseStatus(future.getUri(), config, response);
HttpResponseHeaders responseHeaders = new NettyResponseHeaders(response.headers());
if (exitAfterProcessingFilters(channel, future, handler, status, responseHeaders)) {
return;
}
future.setHttpHeaders(response.headers());
if (exitAfterHandlingRedirect(channel, future, response, request, response.getStatus().code()))
return;
boolean validStatus = response.getStatus().equals(SWITCHING_PROTOCOLS);
boolean validUpgrade = response.headers().get(HttpHeaders.Names.UPGRADE) != null;
String connection = response.headers().get(HttpHeaders.Names.CONNECTION);
if (connection == null)
connection = response.headers().get(HttpHeaders.Names.CONNECTION.toLowerCase(Locale.ENGLISH));
boolean validConnection = HttpHeaders.Values.UPGRADE.equalsIgnoreCase(connection);
status = new NettyResponseStatus(future.getUri(), config, response);
final boolean statusReceived = handler.onStatusReceived(status) == STATE.UPGRADE;
if (!statusReceived) {
try {
handler.onCompleted();