You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by pv...@apache.org on 2017/11/15 09:15:06 UTC
nifi git commit: NIFI-4603 - Externalize Max HTTP Header Size to
nifi.properties
Repository: nifi
Updated Branches:
refs/heads/master 7f8007f22 -> 53de8c93b
NIFI-4603 - Externalize Max HTTP Header Size to nifi.properties
Signed-off-by: Pierre Villard <pi...@gmail.com>
This closes #2271.
Project: http://git-wip-us.apache.org/repos/asf/nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/53de8c93
Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/53de8c93
Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/53de8c93
Branch: refs/heads/master
Commit: 53de8c93baba53e2929bde7d48fc0294dd3002a9
Parents: 7f8007f
Author: Matthew Burgess <ma...@apache.org>
Authored: Mon Nov 13 21:12:11 2017 -0500
Committer: Pierre Villard <pi...@gmail.com>
Committed: Wed Nov 15 10:12:39 2017 +0100
----------------------------------------------------------------------
.../src/main/java/org/apache/nifi/util/NiFiProperties.java | 6 ++++++
nifi-docs/src/main/asciidoc/administration-guide.adoc | 1 +
.../nifi-framework/nifi-resources/pom.xml | 1 +
.../nifi-resources/src/main/resources/conf/nifi.properties | 1 +
.../src/main/java/org/apache/nifi/web/server/JettyServer.java | 7 ++++---
5 files changed, 13 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/nifi/blob/53de8c93/nifi-commons/nifi-properties/src/main/java/org/apache/nifi/util/NiFiProperties.java
----------------------------------------------------------------------
diff --git a/nifi-commons/nifi-properties/src/main/java/org/apache/nifi/util/NiFiProperties.java b/nifi-commons/nifi-properties/src/main/java/org/apache/nifi/util/NiFiProperties.java
index beb222a..b211b71 100644
--- a/nifi-commons/nifi-properties/src/main/java/org/apache/nifi/util/NiFiProperties.java
+++ b/nifi-commons/nifi-properties/src/main/java/org/apache/nifi/util/NiFiProperties.java
@@ -176,6 +176,7 @@ public abstract class NiFiProperties {
public static final String WEB_HTTPS_NETWORK_INTERFACE_PREFIX = "nifi.web.https.network.interface.";
public static final String WEB_WORKING_DIR = "nifi.web.jetty.working.directory";
public static final String WEB_THREADS = "nifi.web.jetty.threads";
+ public static final String WEB_MAX_HEADER_SIZE = "nifi.web.max.header.size";
// ui properties
public static final String UI_BANNER_TEXT = "nifi.ui.banner.text";
@@ -232,6 +233,7 @@ public abstract class NiFiProperties {
public static final Integer DEFAULT_REMOTE_INPUT_PORT = null;
public static final Path DEFAULT_TEMPLATE_DIRECTORY = Paths.get("conf", "templates");
public static final int DEFAULT_WEB_THREADS = 200;
+ public static final String DEFAULT_WEB_MAX_HEADER_SIZE = "16 KB";
public static final String DEFAULT_WEB_WORKING_DIR = "./work/jetty";
public static final String DEFAULT_NAR_WORKING_DIR = "./work/nar";
public static final String DEFAULT_COMPONENT_DOCS_DIRECTORY = "./work/docs/components";
@@ -584,6 +586,10 @@ public abstract class NiFiProperties {
return sslPort;
}
+ public String getWebMaxHeaderSize() {
+ return getProperty(WEB_MAX_HEADER_SIZE, DEFAULT_WEB_MAX_HEADER_SIZE);
+ }
+
public int getWebThreads() {
return getIntegerProperty(WEB_THREADS, DEFAULT_WEB_THREADS);
}
http://git-wip-us.apache.org/repos/asf/nifi/blob/53de8c93/nifi-docs/src/main/asciidoc/administration-guide.adoc
----------------------------------------------------------------------
diff --git a/nifi-docs/src/main/asciidoc/administration-guide.adoc b/nifi-docs/src/main/asciidoc/administration-guide.adoc
index 12a50a9..4328128 100644
--- a/nifi-docs/src/main/asciidoc/administration-guide.adoc
+++ b/nifi-docs/src/main/asciidoc/administration-guide.adoc
@@ -3004,6 +3004,7 @@ nifi.web.https.network.interface.eth1=eth1 +
Providing three total network interfaces, including `nifi.web.https.network.interface.default`.
|nifi.web.jetty.working.directory|The location of the Jetty working directory. The default value is `./work/jetty`.
|nifi.web.jetty.threads|The number of Jetty threads. The default value is `200`.
+|nifi.web.max.header.size|The maximum size allowed for request and response headers. The default value is 16 KB.
|====
=== Security Properties
http://git-wip-us.apache.org/repos/asf/nifi/blob/53de8c93/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-resources/pom.xml
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-resources/pom.xml b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-resources/pom.xml
index 1333a9c..3e6a65d 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-resources/pom.xml
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-resources/pom.xml
@@ -131,6 +131,7 @@
<nifi.web.https.network.interface.default />
<nifi.jetty.work.dir>./work/jetty</nifi.jetty.work.dir>
<nifi.web.jetty.threads>200</nifi.web.jetty.threads>
+ <nifi.web.max.header.size>16 KB</nifi.web.max.header.size>
<!-- nifi.properties: security properties -->
<nifi.security.keystore />
http://git-wip-us.apache.org/repos/asf/nifi/blob/53de8c93/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-resources/src/main/resources/conf/nifi.properties
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-resources/src/main/resources/conf/nifi.properties b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-resources/src/main/resources/conf/nifi.properties
index 624f2f1..49f08ad 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-resources/src/main/resources/conf/nifi.properties
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-resources/src/main/resources/conf/nifi.properties
@@ -136,6 +136,7 @@ nifi.web.https.port=${nifi.web.https.port}
nifi.web.https.network.interface.default=${nifi.web.https.network.interface.default}
nifi.web.jetty.working.directory=${nifi.jetty.work.dir}
nifi.web.jetty.threads=${nifi.web.jetty.threads}
+nifi.web.max.header.size=${nifi.web.max.header.size}
# security properties #
nifi.sensitive.props.key=
http://git-wip-us.apache.org/repos/asf/nifi/blob/53de8c93/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-jetty/src/main/java/org/apache/nifi/web/server/JettyServer.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-jetty/src/main/java/org/apache/nifi/web/server/JettyServer.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-jetty/src/main/java/org/apache/nifi/web/server/JettyServer.java
index be737c5..bd72c81 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-jetty/src/main/java/org/apache/nifi/web/server/JettyServer.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-jetty/src/main/java/org/apache/nifi/web/server/JettyServer.java
@@ -30,6 +30,7 @@ import org.apache.nifi.documentation.DocGenerator;
import org.apache.nifi.lifecycle.LifeCycleStartException;
import org.apache.nifi.nar.ExtensionManager;
import org.apache.nifi.nar.ExtensionMapping;
+import org.apache.nifi.processor.DataUnit;
import org.apache.nifi.security.util.KeyStoreUtils;
import org.apache.nifi.services.FlowService;
import org.apache.nifi.ui.extension.UiExtension;
@@ -109,7 +110,6 @@ public class JettyServer implements NiFiServer {
private static final Logger logger = LoggerFactory.getLogger(JettyServer.class);
private static final String WEB_DEFAULTS_XML = "org/apache/nifi/web/webdefault.xml";
- private static final int HEADER_BUFFER_SIZE = 16 * 1024; // 16kb
private static final FileFilter WAR_FILTER = new FileFilter() {
@Override
@@ -578,8 +578,9 @@ public class JettyServer implements NiFiServer {
private void configureConnectors(final Server server) throws ServerConfigurationException {
// create the http configuration
final HttpConfiguration httpConfiguration = new HttpConfiguration();
- httpConfiguration.setRequestHeaderSize(HEADER_BUFFER_SIZE);
- httpConfiguration.setResponseHeaderSize(HEADER_BUFFER_SIZE);
+ final int headerSize = DataUnit.parseDataSize(props.getWebMaxHeaderSize(), DataUnit.B).intValue();
+ httpConfiguration.setRequestHeaderSize(headerSize);
+ httpConfiguration.setResponseHeaderSize(headerSize);
if (props.getPort() != null) {
final Integer port = props.getPort();