NIFI-4714 - Use lowercase hostname for validation.

Signed-off-by: Pierre Villard <pierre.villard.fr@gmail.com>

This closes #2355.
This commit is contained in:
Koji Kawamura 2017-12-21 14:11:14 +09:00 committed by Pierre Villard
parent febb119fac
commit e8f6ff440a
2 changed files with 4 additions and 4 deletions

View File

@ -62,8 +62,8 @@ public class HostHeaderHandler extends ScopedHandler {
// Different from customizer -- empty is ok here // Different from customizer -- empty is ok here
validHosts.add(""); validHosts.add("");
try { try {
validHosts.add(InetAddress.getLocalHost().getHostName()); validHosts.add(InetAddress.getLocalHost().getHostName().toLowerCase());
validHosts.add(InetAddress.getLocalHost().getHostName() + ":" + serverPort); validHosts.add(InetAddress.getLocalHost().getHostName().toLowerCase() + ":" + serverPort);
} catch (final Exception e) { } catch (final Exception e) {
logger.warn("Failed to determine local hostname.", e); logger.warn("Failed to determine local hostname.", e);
} }

View File

@ -55,8 +55,8 @@ public class HostHeaderSanitizationCustomizer implements HttpConfiguration.Custo
validHosts.add("localhost"); validHosts.add("localhost");
validHosts.add("localhost:" + serverPort); validHosts.add("localhost:" + serverPort);
try { try {
validHosts.add(InetAddress.getLocalHost().getHostName()); validHosts.add(InetAddress.getLocalHost().getHostName().toLowerCase());
validHosts.add(InetAddress.getLocalHost().getHostName() + ":" + serverPort); validHosts.add(InetAddress.getLocalHost().getHostName().toLowerCase() + ":" + serverPort);
} catch (final Exception e) { } catch (final Exception e) {
logger.warn("Failed to determine local hostname.", e); logger.warn("Failed to determine local hostname.", e);
} }