HBASE-23663 Allow dot and hyphen in Profiler's URL (#1002)
Signed-off-by: Sean Busbey <busbey@apache.org> Signed-off-by: Viraj Jasani <vjasani@apache.org>
This commit is contained in:
parent
fbf660c96b
commit
54af279ce0
|
@ -38,8 +38,8 @@ public class ProfileOutputServlet extends DefaultServlet {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(ProfileOutputServlet.class);
|
private static final Logger LOG = LoggerFactory.getLogger(ProfileOutputServlet.class);
|
||||||
private static final int REFRESH_PERIOD = 2;
|
private static final int REFRESH_PERIOD = 2;
|
||||||
// Alphanumeric characters, plus percent (url-encoding), equals, and ampersand
|
// Alphanumeric characters, plus percent (url-encoding), equals, ampersand, dot and hyphen
|
||||||
private static final Pattern ALPHA_NUMERIC = Pattern.compile("[a-zA-Z0-9\\%\\=\\&]*");
|
private static final Pattern ALPHA_NUMERIC = Pattern.compile("[a-zA-Z0-9%=&.\\-]*");
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void doGet(final HttpServletRequest req, final HttpServletResponse resp)
|
protected void doGet(final HttpServletRequest req, final HttpServletResponse resp)
|
||||||
|
|
|
@ -37,7 +37,8 @@ public class TestProfileOutputServlet {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSanitization() {
|
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) {
|
for (String input : good) {
|
||||||
assertEquals(input, ProfileOutputServlet.sanitize(input));
|
assertEquals(input, ProfileOutputServlet.sanitize(input));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue