Skip to content

Encode non-ASCII host names with IDNA before resolving - #2105

Merged
slozier merged 1 commit into
IronLanguages:mainfrom
BCSharp:socket-idna
Oct 21, 2026
Merged

slozier merged 1 commit into
IronLanguages:mainfrom
BCSharp:socket-idna

Conversation

@BCSharp

@BCSharp BCSharp commented Oct 20, 2026

Copy link
Copy Markdown
Member

This PR fixes test_idna. The IronPython test wrapper expected it to fail on Linux and fail on macOS. But the success/failure depends on the DNS resolver used and its capability, not the OS per se.

CPython encodes host names with the "idna" codec before passing them to the resolver. IronPython passed them to Dns as-is, which works on Windows but on POSIX sends raw UTF-8 to getaddrinfo, so the lookup usually (but not always) fails.
test_idna only passed on macOS CI because the runner's resolver happens to accept such names. This change adapts CPython's behaviour.

@slozier slozier left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Looks good to me!

@slozier
slozier merged commit 6f86627 into IronLanguages:main Oct 21, 2026
53 of 56 checks passed
@BCSharp
BCSharp deleted the socket-idna branch October 21, 2026 02:29
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.

2 participants