hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From whe...@apache.org
Subject hadoop git commit: HADOOP-11677. Add cookie flags for logs and static contexts. Contributed by nijel.
Date Mon, 23 Nov 2015 03:53:30 GMT
Repository: hadoop
Updated Branches:
  refs/heads/branch-2 579f9030d -> 16bcf66c1


HADOOP-11677. Add cookie flags for logs and static contexts. Contributed by nijel.


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/16bcf66c
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/16bcf66c
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/16bcf66c

Branch: refs/heads/branch-2
Commit: 16bcf66c1bb90f3acc9ae6d25f847685a5077ed8
Parents: 579f903
Author: Haohui Mai <wheat9@apache.org>
Authored: Sun Nov 22 19:52:13 2015 -0800
Committer: Haohui Mai <wheat9@apache.org>
Committed: Sun Nov 22 19:53:19 2015 -0800

----------------------------------------------------------------------
 hadoop-common-project/hadoop-common/CHANGES.txt    |  3 +++
 .../java/org/apache/hadoop/http/HttpServer2.java   | 17 +++++++++++++++++
 2 files changed, 20 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/16bcf66c/hadoop-common-project/hadoop-common/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt
index ed3b9f5..3b54c23 100644
--- a/hadoop-common-project/hadoop-common/CHANGES.txt
+++ b/hadoop-common-project/hadoop-common/CHANGES.txt
@@ -836,6 +836,9 @@ Release 2.8.0 - UNRELEASED
     HADOOP-11149. Increase the timeout of TestZKFailoverController.
     (Steve Loughran via wheat9)
 
+    HADOOP-11677. Add cookie flags for logs and static contexts.
+    (nijel via wheat9)
+
 Release 2.7.3 - UNRELEASED
 
   INCOMPATIBLE CHANGES

http://git-wip-us.apache.org/repos/asf/hadoop/blob/16bcf66c/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/http/HttpServer2.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/http/HttpServer2.java
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/http/HttpServer2.java
index c6e7925..717c9e3 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/http/HttpServer2.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/http/HttpServer2.java
@@ -86,6 +86,7 @@ import org.mortbay.jetty.servlet.AbstractSessionManager;
 import org.mortbay.jetty.servlet.Context;
 import org.mortbay.jetty.servlet.DefaultServlet;
 import org.mortbay.jetty.servlet.FilterHolder;
+import org.mortbay.jetty.servlet.SessionHandler;
 import org.mortbay.jetty.servlet.FilterMapping;
 import org.mortbay.jetty.servlet.ServletHandler;
 import org.mortbay.jetty.servlet.ServletHolder;
@@ -553,6 +554,14 @@ public final class HttpServer2 implements FilterContainer {
             "org.mortbay.jetty.servlet.Default.aliases", "true");
       }
       logContext.setDisplayName("logs");
+      SessionHandler handler = new SessionHandler();
+      SessionManager sm = handler.getSessionManager();
+      if (sm instanceof AbstractSessionManager) {
+        AbstractSessionManager asm = (AbstractSessionManager) sm;
+        asm.setHttpOnly(true);
+        asm.setSecureCookies(true);
+      }
+      logContext.setSessionHandler(handler);
       setContextAttributes(logContext, conf);
       addNoCacheFilter(webAppContext);
       defaultContexts.put(logContext, true);
@@ -562,6 +571,14 @@ public final class HttpServer2 implements FilterContainer {
     staticContext.setResourceBase(appDir + "/static");
     staticContext.addServlet(DefaultServlet.class, "/*");
     staticContext.setDisplayName("static");
+    SessionHandler handler = new SessionHandler();
+    SessionManager sm = handler.getSessionManager();
+    if (sm instanceof AbstractSessionManager) {
+      AbstractSessionManager asm = (AbstractSessionManager) sm;
+      asm.setHttpOnly(true);
+      asm.setSecureCookies(true);
+    }
+    staticContext.setSessionHandler(handler);
     setContextAttributes(staticContext, conf);
     defaultContexts.put(staticContext, true);
   }


Mime
View raw message