Browse Source

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

Haohui Mai 10 years ago
parent
commit
6a32f77de8

+ 3 - 0
hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt

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

+ 3 - 2
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/web/SimpleHttpProxyHandler.java

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