Skip to content

KcpTransport ServerUri returns empty host when machine name contains non-ASCII/invalid characters #4073

@sxg15

Description

@sxg15

Summary

KcpTransport.ServerUri() builds a UriBuilder host from Dns.GetHostName(). If the computer name contains non-ASCII/invalid URI characters (e.g., Chinese), UriBuilder.Host ends up empty and the method returns kcp://:7777 (or throws), so the transport cannot provide a usable server URI.

Steps to Reproduce

  1. Set the OS computer name to include a Chinese character (e.g., 测试PC).
  2. Start a project using Mirror KCP.
  3. Call Transport.activeTransport.ServerUri().

Expected

ServerUri() returns a valid URI with a usable host (e.g., punycode or a fallback like localhost).

Actual

Host is empty/invalid; URI becomes kcp://:port (or UriFormatException).

Notes

File: Mirror/Transports/KCP/KcpTransport.cs line ~191. Likely need to validate/IDN-encode the hostname and/or provide a fallback when invalid.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions