Skip to content

The host check of the socket transport accepts 999.1.1.1 #1948

Closed

Description

@muescha

A follow-up of #1870, collected in #1943.

isHost takes an IP address or anything the HOST_NAME regex matches, and the regex matches 999.1.1.1, 256.0.0.1 and 1.2.3 as host names.

Guava's InternetDomainName.isValid, next to the InetAddresses already used, would replace the regex: it refuses a name whose last label starts with a digit, and accepts localhost, my_host.local and a trailing dot. java.net.URI would refuse 999.1.1.1 too, but also host names with an underscore, such as Docker container names, so I wouldn't use it here.

Host regex InetAddresses InternetDomainName URI
999.1.1.1 ✅ ❌ ❌ ❌
256.0.0.1 ✅ ❌ ❌ ❌
1.2.3 ✅ ❌ ❌ ❌
127.0.0.1 ✅ ✅ ❌ ✅
::1 ❌ ✅ ❌ ✅
localhost ✅ ❌ ✅ ✅
my_host.local ✅ ❌ ✅ ❌
example.com. ✅ ❌ ✅ ✅
http://x ❌ ❌ ❌ ❌

How this was checked

The table was tried with Guava 33.2.1.

Activity

  1. added this to the 0.30.0 milestone on Nov 11, 2026
  2. added a commit that references this issue on Nov 11, 2026
    3ef8c7d
  3. added a commit that references this issue on Nov 11, 2026
    7e638a3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions