HDFS-7406. SimpleHttpProxyHandler puts incorrect "Connection: Close" header. Contributed by Haohui Mai.

This commit is contained in:
Haohui Mai 2014-11-18 14:52:59 -08:00
parent bcd402ae38
commit fbf81fbd1c
2 changed files with 6 additions and 2 deletions

View File

@ -447,6 +447,9 @@ Release 2.7.0 - UNRELEASED
HDFS-7146. NFS ID/Group lookup requires SSSD enumeration on the server HDFS-7146. NFS ID/Group lookup requires SSSD enumeration on the server
(Yongjun Zhang via brandonli) (Yongjun Zhang via brandonli)
HDFS-7406. SimpleHttpProxyHandler puts incorrect "Connection: Close"
header. (wheat9)
Release 2.6.0 - 2014-11-18 Release 2.6.0 - 2014-11-18
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -39,6 +39,7 @@ import org.apache.commons.logging.Log;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import static io.netty.handler.codec.http.HttpHeaders.Names.CONNECTION; import static io.netty.handler.codec.http.HttpHeaders.Names.CONNECTION;
import static io.netty.handler.codec.http.HttpHeaders.Values;
import static io.netty.handler.codec.http.HttpResponseStatus.INTERNAL_SERVER_ERROR; import static io.netty.handler.codec.http.HttpResponseStatus.INTERNAL_SERVER_ERROR;
import static io.netty.handler.codec.http.HttpVersion.HTTP_1_1; import static io.netty.handler.codec.http.HttpVersion.HTTP_1_1;
@ -119,12 +120,12 @@ class SimpleHttpProxyHandler extends SimpleChannelInboundHandler<HttpRequest> {
HttpRequest newReq = new DefaultFullHttpRequest(HTTP_1_1, HttpRequest newReq = new DefaultFullHttpRequest(HTTP_1_1,
req.getMethod(), req.getUri()); req.getMethod(), req.getUri());
newReq.headers().add(req.headers()); newReq.headers().add(req.headers());
newReq.headers().set(CONNECTION, CLOSE); newReq.headers().set(CONNECTION, Values.CLOSE);
future.channel().writeAndFlush(newReq); future.channel().writeAndFlush(newReq);
} else { } else {
DefaultHttpResponse resp = new DefaultHttpResponse(HTTP_1_1, DefaultHttpResponse resp = new DefaultHttpResponse(HTTP_1_1,
INTERNAL_SERVER_ERROR); INTERNAL_SERVER_ERROR);
resp.headers().set(CONNECTION, CLOSE); resp.headers().set(CONNECTION, Values.CLOSE);
LOG.info("Proxy " + uri + " failed. Cause: ", future.cause()); LOG.info("Proxy " + uri + " failed. Cause: ", future.cause());
ctx.writeAndFlush(resp).addListener(ChannelFutureListener.CLOSE); ctx.writeAndFlush(resp).addListener(ChannelFutureListener.CLOSE);
client.close(); client.close();