From 54af279ce09eced9d23c3103463dcf44213f0513 Mon Sep 17 00:00:00 2001 From: Peter Somogyi Date: Thu, 9 Jan 2020 10:31:32 +0100 Subject: [PATCH] HBASE-23663 Allow dot and hyphen in Profiler's URL (#1002) Signed-off-by: Sean Busbey Signed-off-by: Viraj Jasani --- .../org/apache/hadoop/hbase/http/ProfileOutputServlet.java | 4 ++-- .../apache/hadoop/hbase/http/TestProfileOutputServlet.java | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/hbase-http/src/main/java/org/apache/hadoop/hbase/http/ProfileOutputServlet.java b/hbase-http/src/main/java/org/apache/hadoop/hbase/http/ProfileOutputServlet.java index 2ebcfb910aa..aa3455e684f 100644 --- a/hbase-http/src/main/java/org/apache/hadoop/hbase/http/ProfileOutputServlet.java +++ b/hbase-http/src/main/java/org/apache/hadoop/hbase/http/ProfileOutputServlet.java @@ -38,8 +38,8 @@ public class ProfileOutputServlet extends DefaultServlet { private static final long serialVersionUID = 1L; private static final Logger LOG = LoggerFactory.getLogger(ProfileOutputServlet.class); private static final int REFRESH_PERIOD = 2; - // Alphanumeric characters, plus percent (url-encoding), equals, and ampersand - private static final Pattern ALPHA_NUMERIC = Pattern.compile("[a-zA-Z0-9\\%\\=\\&]*"); + // Alphanumeric characters, plus percent (url-encoding), equals, ampersand, dot and hyphen + private static final Pattern ALPHA_NUMERIC = Pattern.compile("[a-zA-Z0-9%=&.\\-]*"); @Override protected void doGet(final HttpServletRequest req, final HttpServletResponse resp) diff --git a/hbase-http/src/test/java/org/apache/hadoop/hbase/http/TestProfileOutputServlet.java b/hbase-http/src/test/java/org/apache/hadoop/hbase/http/TestProfileOutputServlet.java index 77d6c456b50..7723e6e7887 100644 --- a/hbase-http/src/test/java/org/apache/hadoop/hbase/http/TestProfileOutputServlet.java +++ b/hbase-http/src/test/java/org/apache/hadoop/hbase/http/TestProfileOutputServlet.java @@ -37,7 +37,8 @@ public class TestProfileOutputServlet { @Test public void testSanitization() { - List good = Arrays.asList("abcd", "key=value", "key1=value&key2=value2", ""); + List good = Arrays.asList("abcd", "key=value", "key1=value&key2=value2", "", + "host=host-1.example.com"); for (String input : good) { assertEquals(input, ProfileOutputServlet.sanitize(input)); }