Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ private Utils() {}
// IPv6 is supported with [ip] pattern
// Note the protocol (aka schema) part allows unicode letters where
// RFC 2396 does not because Kafka was historically lax about the protocol.
private static final Pattern HOST_PORT_PATTERN = Pattern.compile("(?:\\p{L}[\\p{L}\\p{Digit}+.-]*://)?\\[?([0-9a-zA-Z\\-%._:]*)\\]?:([0-9]+)");
private static final Pattern HOST_PORT_PATTERN = Pattern.compile("(?:\\p{L}[\\p{L}\\p{Digit}+._-]*://)?\\[?([0-9a-zA-Z\\-%._:]*)\\]?:([0-9]+)");

private static final Pattern VALID_HOST_CHARACTERS = Pattern.compile("([0-9a-zA-Z\\-%._:]*)");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ public void testGetHost() {
assertEquals("mydomain.com", getHost("PLAINTEXT://mydomain.com:8080"));
assertEquals("MyDomain.com", getHost("PLAINTEXT://MyDomain.com:8080"));
assertEquals("My_Domain.com", getHost("PLAINTEXT://My_Domain.com:8080"));
assertEquals("My_Domain.com", getHost("SSL_PLAINTEXT://My_Domain.com:8080"));
assertEquals("My_Domain.com", getHost("\u021Dfoo\u021D+baz://My_Domain.com:8080"));
assertEquals("::1", getHost("[::1]:1234"));
assertEquals("2001:db8:85a3:8d3:1319:8a2e:370:7348", getHost("PLAINTEXT://[2001:db8:85a3:8d3:1319:8a2e:370:7348]:5678"));
Expand Down