ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mpapirkovs...@apache.org
Subject [1/2] ambari git commit: AMBARI-15371. Increase the default http header size of the Ambari server to 64k. (mpapirkovskyy)
Date Fri, 11 Mar 2016 15:18:55 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 977cb4bc9 -> 962a97304


AMBARI-15371. Increase the default http header size of the Ambari server to 64k. (mpapirkovskyy)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/39eded40
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/39eded40
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/39eded40

Branch: refs/heads/trunk
Commit: 39eded40b1dcf063c351f4bb6832117d14fd0583
Parents: 977cb4b
Author: Myroslav Papirkovskyi <mpapyrkovskyy@hortonworks.com>
Authored: Thu Mar 10 17:29:04 2016 +0200
Committer: Myroslav Papirkovskyi <mpapyrkovskyy@hortonworks.com>
Committed: Fri Mar 11 16:37:35 2016 +0200

----------------------------------------------------------------------
 .../server/configuration/Configuration.java     | 21 ++++++++++++++++++++
 .../ambari/server/controller/AmbariServer.java  | 12 +++++++++++
 2 files changed, 33 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/39eded40/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
b/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
index 92d4f47..23571c6 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
@@ -196,6 +196,11 @@ public class Configuration {
   public static final String SERVER_JDBC_URL_KEY = "server.jdbc.url";
   public static final String SERVER_JDBC_PROPERTIES_PREFIX = "server.jdbc.properties.";
 
+  public static final String SERVER_HTTP_REQUEST_HEADER_SIZE = "server.http.request.header.size";
+  public static final String SERVER_HTTP_RESPONSE_HEADER_SIZE = "server.http.response.header.size";
+  public static final int SERVER_HTTP_REQUEST_HEADER_SIZE_DEFAULT = 64*1024;
+  public static final int SERVER_HTTP_RESPONSE_HEADER_SIZE_DEFAULT = 64*1024;
+
   // Properties for stack upgrade (Rolling, Express)
   public static final String ROLLING_UPGRADE_SKIP_PACKAGES_PREFIXES_KEY = "rolling.upgrade.skip.packages.prefixes";
   public static final String ROLLING_UPGRADE_SKIP_PACKAGES_PREFIXES_DEFAULT = "";
@@ -1783,6 +1788,22 @@ public class Configuration {
     return customDbProperties;
   }
 
+  /**
+   * @return Custom property for request header size
+   */
+  public int getHttpRequestHeaderSize() {
+    return Integer.parseInt(properties.getProperty(
+        SERVER_HTTP_REQUEST_HEADER_SIZE, String.valueOf(SERVER_HTTP_REQUEST_HEADER_SIZE_DEFAULT)));
+  }
+
+  /**
+   * @return Custom property for response header size
+   */
+  public int getHttpResponseHeaderSize() {
+    return Integer.parseInt(properties.getProperty(
+        SERVER_HTTP_RESPONSE_HEADER_SIZE, String.valueOf(SERVER_HTTP_RESPONSE_HEADER_SIZE_DEFAULT)));
+  }
+
   public Map<String, String> getAmbariProperties() {
 
     Properties properties = readConfigFile();

http://git-wip-us.apache.org/repos/asf/ambari/blob/39eded40/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
index 4695990..076f850 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
@@ -377,6 +377,7 @@ public class AmbariServer {
         httpConfigurationTwoWay.setSecureScheme("https");
         httpConfigurationTwoWay.setSecurePort(configs.getTwoWayAuthPort());
         httpConfigurationTwoWay.addCustomizer(new SecureRequestCustomizer());
+        setHeaderSize(httpConfigurationTwoWay);
 
         String keystore = configsMap.get(Configuration.SRVR_KSTR_DIR_KEY) + File.separator
             + configsMap.get(Configuration.KSTR_NAME_KEY);
@@ -412,6 +413,7 @@ public class AmbariServer {
         httpConfigurationOneWay.setSecureScheme("https");
         httpConfigurationOneWay.setSecurePort(configs.getOneWayAuthPort());
         httpConfigurationOneWay.addCustomizer(new SecureRequestCustomizer());
+        setHeaderSize(httpConfigurationOneWay);
 
         Map <String, Integer> agentSelectorAcceptorMap = getDesiredAgentAcceptorSelector(serverForAgent);
         // SSL for 1-way auth
@@ -529,6 +531,7 @@ public class AmbariServer {
 
         HttpConfiguration httpConfigurationSSL = new HttpConfiguration();
         httpConfigurationSSL.setSecurePort(configs.getClientSSLApiPort());
+        setHeaderSize(httpConfigurationSSL);
 
         ServerConnector https = new ServerConnector(server, new SslConnectionFactory(contextFactoryApi,
"http/1.1"),
             new HttpConnectionFactory(httpConfigurationSSL));
@@ -538,6 +541,7 @@ public class AmbariServer {
       } else  {
         HttpConfiguration httpConfiguration = new HttpConfiguration();
         httpConfiguration.setSecurePort(configs.getClientApiPort());
+        setHeaderSize(httpConfiguration);
 
         apiConnector = new ServerConnector(server, new HttpConnectionFactory(httpConfiguration));
         apiConnector.setPort(configs.getClientApiPort());
@@ -717,6 +721,14 @@ public class AmbariServer {
   }
 
   /**
+   * Propagate header size to Jetty HTTP configuration
+   */
+  private void setHeaderSize(HttpConfiguration httpConfiguration) {
+    httpConfiguration.setResponseHeaderSize(configs.getHttpResponseHeaderSize());
+    httpConfiguration.setRequestHeaderSize(configs.getHttpRequestHeaderSize());
+  }
+
+  /**
    * Performs basic configuration of root handler with static values and values
    * from configuration file.
    *


Mime
View raw message