Skip to content

core,api,netty,okhttp: allow hostnames whose last label starts with a digit - #13080

Draft
AgraVator wants to merge 1 commit into
grpc:masterfrom
AgraVator:fix-13075-digit-toplabel
Draft

AgraVator wants to merge 1 commit into
grpc:masterfrom
AgraVator:fix-13075-digit-toplabel

Conversation

@AgraVator

Copy link
Copy Markdown
Contributor

java.net.URI enforces RFC 2396's toplabel rule requiring the final label of a multi-label hostname to start with an ASCII letter (JDK-8188305), whereas RFC 1123 Section 2.1 and RFC 3986 allow it to start with an ASCII digit (e.g., Kubernetes namespaces like 'otlp.1234-k8s-namespace').

When java.net.URI rejects a multi-label hostname whose final label starts with an ASCII digit (or falls back to a registry-based authority with getHost() == null and getPort() == -1), validate the authority/hostname by appending a placeholder '.a' top-level label so java.net.URI still validates every label and port according to RFC 1123 domainlabel rules, then strip the placeholder.

Fixes #13075

… digit

java.net.URI enforces RFC 2396's toplabel rule requiring the final label of a multi-label hostname to start with an ASCII letter (JDK-8188305), whereas RFC 1123 Section 2.1 and RFC 3986 allow it to start with an ASCII digit (e.g., Kubernetes namespaces like 'otlp.1234-k8s-namespace').

When java.net.URI rejects a multi-label hostname whose final label starts with an ASCII digit (or falls back to a registry-based authority with getHost() == null and getPort() == -1), validate the authority/hostname by appending a placeholder '.a' top-level label so java.net.URI still validates every label and port according to RFC 1123 domainlabel rules, then strip the placeholder.

Fixes grpc#13075

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hostnames whose last label starts with a digit are rejected (java.net.URI, JDK-8188305)

1 participant