You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ps...@apache.org on 2020/01/09 09:43:58 UTC

[hbase] branch branch-2.1 updated: HBASE-23663 Allow dot and hyphen in Profiler's URL (#1002)

This is an automated email from the ASF dual-hosted git repository.

psomogyi pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/branch-2.1 by this push:
     new 179b2f9  HBASE-23663 Allow dot and hyphen in Profiler's URL (#1002)
179b2f9 is described below

commit 179b2f93105efc1eeb5f856e7fa8aafc5311a757
Author: Peter Somogyi <ps...@apache.org>
AuthorDate: Thu Jan 9 10:31:32 2020 +0100

    HBASE-23663 Allow dot and hyphen in Profiler's URL (#1002)
    
    Signed-off-by: Sean Busbey <bu...@apache.org>
    Signed-off-by: Viraj Jasani <vj...@apache.org>
---
 .../main/java/org/apache/hadoop/hbase/http/ProfileOutputServlet.java  | 4 ++--
 .../java/org/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 2ebcfb9..aa3455e 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 77d6c45..7723e6e 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<String> good = Arrays.asList("abcd", "key=value", "key1=value&key2=value2", "");
+    List<String> good = Arrays.asList("abcd", "key=value", "key1=value&key2=value2", "",
+        "host=host-1.example.com");
     for (String input : good) {
       assertEquals(input, ProfileOutputServlet.sanitize(input));
     }