line / armeria

Your go-to microservice framework for any situation, from the creator of Netty et al. You can build any type of microservice leveraging your favorite technologies, including gRPC, Thrift, Kotlin, Retrofit, Reactive Streams, Spring Boot and Dropwizard.
https://armeria.dev
Apache License 2.0
4.83k stars 922 forks source link

Loosen the validation rule for `Endpoint.host()` #5814

Closed ikhoon closed 3 months ago

ikhoon commented 4 months ago

The underscore (_) character is not permitted in hostnames but is allowed in other contexts, such as DNS SRV records.

Currently, URI.parseServerAuthority() is used to validate a hostname of an Endpoint which disallows _. https://github.com/line/armeria/blob/c208353b2edd94df20a1523d7b34bb349c781292/core/src/main/java/com/linecorp/armeria/internal/common/SchemeAndAuthority.java#L53

Armeria internally, Endpoint.host() is used for both DNS and a hostname of a URI. So I think we may loosen the validation rule to allow _ and use it for DNS queries and results.

Discord thread: https://discord.com/channels/1087271586832318494/1087272728177942629/1262912254333030451