diff --git a/hadoop-hdfs-project/hadoop-hdfs/pom.xml b/hadoop-hdfs-project/hadoop-hdfs/pom.xml
index e39bf71f79..9e59a31861 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/pom.xml
+++ b/hadoop-hdfs-project/hadoop-hdfs/pom.xml
@@ -178,11 +178,6 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd">
netty-all
compile
-
- com.twitter
- hpack
- compile
-
xerces
xercesImpl
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/web/DatanodeHttpServer.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/web/DatanodeHttpServer.java
index 74e0916b27..b51b1fc60e 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/web/DatanodeHttpServer.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/web/DatanodeHttpServer.java
@@ -26,8 +26,8 @@
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
+import io.netty.bootstrap.ChannelFactory;
import io.netty.bootstrap.ServerBootstrap;
-import io.netty.channel.ChannelFactory;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelOption;
@@ -138,8 +138,16 @@ public DatanodeHttpServer(final Configuration conf,
.childHandler(new ChannelInitializer() {
@Override
protected void initChannel(SocketChannel ch) throws Exception {
- ch.pipeline().addLast(new PortUnificationServerHandler(jettyAddr,
- conf, confForCreate, restCsrfPreventionFilter));
+ ChannelPipeline p = ch.pipeline();
+ p.addLast(new HttpRequestDecoder(),
+ new HttpResponseEncoder());
+ if (restCsrfPreventionFilter != null) {
+ p.addLast(new RestCsrfPreventionFilterHandler(
+ restCsrfPreventionFilter));
+ }
+ p.addLast(
+ new ChunkedWriteHandler(),
+ new URLDispatcher(jettyAddr, conf, confForCreate));
}
});
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/web/PortUnificationServerHandler.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/web/PortUnificationServerHandler.java
deleted file mode 100644
index ff10c6da28..0000000000
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/web/PortUnificationServerHandler.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.hadoop.hdfs.server.datanode.web;
-
-import java.net.InetSocketAddress;
-import java.util.List;
-
-import org.apache.hadoop.classification.InterfaceAudience;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hdfs.server.datanode.web.dtp.DtpHttp2Handler;
-import org.apache.hadoop.security.http.RestCsrfPreventionFilter;
-
-import io.netty.buffer.ByteBuf;
-import io.netty.buffer.ByteBufUtil;
-import io.netty.channel.ChannelHandlerContext;
-import io.netty.handler.codec.ByteToMessageDecoder;
-import io.netty.handler.codec.http.HttpServerCodec;
-import io.netty.handler.codec.http2.Http2CodecUtil;
-import io.netty.handler.stream.ChunkedWriteHandler;
-
-/**
- * A port unification handler to support HTTP/1.1 and HTTP/2 on the same port.
- */
-@InterfaceAudience.Private
-public class PortUnificationServerHandler extends ByteToMessageDecoder {
-
- private static final ByteBuf HTTP2_CLIENT_CONNECTION_PREFACE = Http2CodecUtil
- .connectionPrefaceBuf();
-
- // we only want to support HTTP/1.1 and HTTP/2, so the first 3 bytes is
- // enough. No HTTP/1.1 request could start with "PRI"
- private static final int MAGIC_HEADER_LENGTH = 3;
-
- private final InetSocketAddress proxyHost;
-
- private final Configuration conf;
-
- private final Configuration confForCreate;
-
- private final RestCsrfPreventionFilter restCsrfPreventionFilter;
-
- public PortUnificationServerHandler(InetSocketAddress proxyHost,
- Configuration conf, Configuration confForCreate,
- RestCsrfPreventionFilter restCsrfPreventionFilter) {
- this.proxyHost = proxyHost;
- this.conf = conf;
- this.confForCreate = confForCreate;
- this.restCsrfPreventionFilter = restCsrfPreventionFilter;
- }
-
- private void configureHttp1(ChannelHandlerContext ctx) {
- ctx.pipeline().addLast(new HttpServerCodec());
- if (this.restCsrfPreventionFilter != null) {
- ctx.pipeline().addLast(new RestCsrfPreventionFilterHandler(
- this.restCsrfPreventionFilter));
- }
- ctx.pipeline().addLast(new ChunkedWriteHandler(),
- new URLDispatcher(proxyHost, conf, confForCreate));
- }
-
- private void configureHttp2(ChannelHandlerContext ctx) {
- if (this.restCsrfPreventionFilter != null) {
- ctx.pipeline().addLast(new RestCsrfPreventionFilterHandler(
- this.restCsrfPreventionFilter));
- }
- ctx.pipeline().addLast(new DtpHttp2Handler());
- }
-
- @Override
- protected void decode(ChannelHandlerContext ctx, ByteBuf in,
- List
-
- com.twitter
- hpack
- 0.11.0
-
-
commons-io
commons-io