Skip to content

Commit a1464d6

Browse files
committed
core: clarify dns javadoc/test about trailing path segments
1 parent 65596ae commit a1464d6

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

core/src/main/java/io/grpc/internal/DnsNameResolverProvider.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,12 @@
3333
* A provider for {@link DnsNameResolver}.
3434
*
3535
* <p>It resolves a target URI whose scheme is {@code "dns"}. The (optional) authority of the target
36-
* URI is reserved for the address of alternative DNS server (not implemented yet). The first path
37-
* segment of the hierarchical target URI is interpreted as an RFC 2396 "server-based" authority and
38-
* used as the "service authority" of the resulting {@link NameResolver}. The "host" part of this
39-
* authority is the name to be resolved by DNS. The "port" part of this authority (if present) will
40-
* become the port number for all {@link InetSocketAddress} produced by this resolver. For example:
36+
* URI is reserved for the address of alternative DNS server (not implemented yet). The target URI
37+
* must be hierarchical and have exactly one path segment which will be interpreted as an RFC 2396
38+
* "server-based" authority and used as the "service authority" of the resulting {@link
39+
* NameResolver}. The "host" part of this authority is the name to be resolved by DNS. The "port"
40+
* part of this authority (if present) will become the port number for all {@link InetSocketAddress}
41+
* produced by this resolver. For example:
4142
*
4243
* <ul>
4344
* <li>{@code "dns:///foo.googleapis.com:8080"} (using default DNS)</li>

core/src/test/java/io/grpc/internal/DnsNameResolverProviderTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ public void newNameResolver_validDnsNameWithoutPort_usesDefaultPort() {
103103
assertThat(nameResolver.getPort()).isEqualTo(args.getDefaultPort());
104104
}
105105

106+
// TODO(jdcormie): Trailing path segments *should* be forbidden. This test just demonstrates that
107+
// both newNameResolver() overloads behave the same with respect to this bug.
106108
@Test
107109
public void newNameResolver_toleratesTrailingPathSegments() {
108110
NameResolver nameResolver = newNameResolver("dns:///foo.googleapis.com/ig/nor/ed", args);

0 commit comments

Comments
 (0)