This is an automated email from the ASF dual-hosted git repository. alopresto pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nifi-registry.git
The following commit(s) were added to refs/heads/master by this push: new 56a44c8 NIFIREG-380 - Allow NiFi Registry admins to configure whether Jetty will send the Jetty server version in responses. NIFIREG-380 Added new property to default nifi-registry.properties. 56a44c8 is described below commit 56a44c8528ec6f420b4b9d1c7b402da8417f518d Author: Nathan Gough <thena...@gmail.com> AuthorDate: Mon Apr 6 21:10:25 2020 -0400 NIFIREG-380 - Allow NiFi Registry admins to configure whether Jetty will send the Jetty server version in responses. NIFIREG-380 Added new property to default nifi-registry.properties. This closes #273. Signed-off-by: Andy LoPresto <alopre...@apache.org> --- nifi-registry-assembly/pom.xml | 1 + .../src/main/java/org/apache/nifi/registry/jetty/JettyServer.java | 1 + .../org/apache/nifi/registry/properties/NiFiRegistryProperties.java | 6 ++++++ .../src/main/resources/conf/nifi-registry.properties | 1 + 4 files changed, 9 insertions(+) diff --git a/nifi-registry-assembly/pom.xml b/nifi-registry-assembly/pom.xml index 655964c..b4c7acd 100644 --- a/nifi-registry-assembly/pom.xml +++ b/nifi-registry-assembly/pom.xml @@ -152,6 +152,7 @@ <nifi.registry.web.https.port /> <nifi.registry.jetty.work.dir>./work/jetty</nifi.registry.jetty.work.dir> <nifi.registry.web.jetty.threads>200</nifi.registry.web.jetty.threads> + <nifi.registry.web.should.send.server.version>true</nifi.registry.web.should.send.server.version> <!-- nifi-registry.properties: security properties --> <nifi.registry.security.keystore /> diff --git a/nifi-registry-core/nifi-registry-jetty/src/main/java/org/apache/nifi/registry/jetty/JettyServer.java b/nifi-registry-core/nifi-registry-jetty/src/main/java/org/apache/nifi/registry/jetty/JettyServer.java index 387857f..d20fce4 100644 --- a/nifi-registry-core/nifi-registry-jetty/src/main/java/org/apache/nifi/registry/jetty/JettyServer.java +++ b/nifi-registry-core/nifi-registry-jetty/src/main/java/org/apache/nifi/registry/jetty/JettyServer.java @@ -148,6 +148,7 @@ public class JettyServer { final HttpConfiguration httpConfiguration = new HttpConfiguration(); httpConfiguration.setRequestHeaderSize(HEADER_BUFFER_SIZE); httpConfiguration.setResponseHeaderSize(HEADER_BUFFER_SIZE); + httpConfiguration.setSendServerVersion(properties.shouldSendServerVersion()); if (properties.getPort() != null) { final Integer port = properties.getPort(); diff --git a/nifi-registry-core/nifi-registry-properties/src/main/java/org/apache/nifi/registry/properties/NiFiRegistryProperties.java b/nifi-registry-core/nifi-registry-properties/src/main/java/org/apache/nifi/registry/properties/NiFiRegistryProperties.java index e1e9a39..d3b4a25 100644 --- a/nifi-registry-core/nifi-registry-properties/src/main/java/org/apache/nifi/registry/properties/NiFiRegistryProperties.java +++ b/nifi-registry-core/nifi-registry-properties/src/main/java/org/apache/nifi/registry/properties/NiFiRegistryProperties.java @@ -38,6 +38,7 @@ public class NiFiRegistryProperties extends Properties { public static final String WEB_HTTPS_HOST = "nifi.registry.web.https.host"; public static final String WEB_WORKING_DIR = "nifi.registry.web.jetty.working.directory"; public static final String WEB_THREADS = "nifi.registry.web.jetty.threads"; + public static final String WEB_SHOULD_SEND_SERVER_VERSION = "nifi.registry.web.should.send.server.version"; public static final String SECURITY_KEYSTORE = "nifi.registry.security.keystore"; public static final String SECURITY_KEYSTORE_TYPE = "nifi.registry.security.keystoreType"; @@ -95,6 +96,7 @@ public class NiFiRegistryProperties extends Properties { public static final String DEFAULT_SECURITY_IDENTITY_PROVIDER_CONFIGURATION_FILE = "./conf/identity-providers.xml"; public static final String DEFAULT_AUTHENTICATION_EXPIRATION = "12 hours"; public static final String DEFAULT_EXTENSIONS_WORKING_DIR = "./work/extensions"; + public static final String DEFAULT_WEB_SHOULD_SEND_SERVER_VERSION = "true"; public int getWebThreads() { int webThreads = 200; @@ -122,6 +124,10 @@ public class NiFiRegistryProperties extends Properties { return getSslPort() != null; } + public boolean shouldSendServerVersion() { + return Boolean.parseBoolean(getProperty(WEB_SHOULD_SEND_SERVER_VERSION, DEFAULT_WEB_SHOULD_SEND_SERVER_VERSION)); + } + public String getHttpsHost() { return getProperty(WEB_HTTPS_HOST); } diff --git a/nifi-registry-core/nifi-registry-resources/src/main/resources/conf/nifi-registry.properties b/nifi-registry-core/nifi-registry-resources/src/main/resources/conf/nifi-registry.properties index 2341f38..1b62023 100644 --- a/nifi-registry-core/nifi-registry-resources/src/main/resources/conf/nifi-registry.properties +++ b/nifi-registry-core/nifi-registry-resources/src/main/resources/conf/nifi-registry.properties @@ -21,6 +21,7 @@ nifi.registry.web.https.host=${nifi.registry.web.https.host} nifi.registry.web.https.port=${nifi.registry.web.https.port} nifi.registry.web.jetty.working.directory=${nifi.registry.jetty.work.dir} nifi.registry.web.jetty.threads=${nifi.registry.web.jetty.threads} +nifi.registry.web.should.send.server.version=${nifi.registry.web.should.send.server.version} # security properties # nifi.registry.security.keystore=${nifi.registry.security.keystore}