Browse documentation

fetch() and net scopes give a non-ASCII host its UTS #46 ToASCII form

Date: 2026-11-30 Area: runtime, url, permissions Supersedes: ADR 0216's "The HTTP client's own parse skips UTS #46", and ADR 0149's "What the client refuses today stays refused" for a non-ASCII host; their other decisions stand. Related: #2449, #2411, Permissions — net scopes, Fetch

Context

Since #2411 the URL parser gives a special-scheme domain with a non-ASCII code point its UTS #46 ToASCII form (WHATWG URL §3.3, domain to ASCII), so new URL("https://bücher.example/").host is xn--bcher-kva.example. ADR 0216 kept fetch() out of that: NormalizeHTTPRequestURL and ResolveHTTPRedirectURL parsed with AKeepNonASCIIDomain, so a non-ASCII host reached the net checks as written and the built-in client refused it (HTTP host contains a non-ASCII code unit), as ADR 0149 had it. A net scope had to be ASCII, so a permission list could not name such a host in the spelling a script writes. A script could not fetch an internationalized domain at all. Johannes chose on 2026-11-30 to convert the host in fetch() and in the scopes ("Agreed with a").

Decision

  • fetch() sends a non-ASCII host in its ToASCII form. NormalizeHTTPRequestURL and ResolveHTTPRedirectURL parse with the URL Standard's host parser and its ToASCII (Goccia.URL.IDNA), percent-encoded or not. fetchCheck judges the URL normalized as fetchStart sends it, so the first net check, every redirect hop's check, the built-in client and an embedder's transport all see the ASCII form, and PermissionDenied's scope and Response.url name it.
  • A net scope written in Unicode is read in its ToASCII form. TryParseNetScope reads the scope's syntax (private, a CIDR's /, a port and a wildcard's *.) on the text as written, then converts the host name with the URL parser's own domain step (TryURLDomainToASCII), and a scope is stored in that form. So bücher.example and xn--bcher-kva.example name the same host, in the list and, through fetch()'s conversion, in the request; matching a stored scope runs no UTS #46, whose loops poll the run's limits on the engine's thread. Syntax that only mapping makes, such as a full-width * or private in full-width letters, is not a scope.
  • A host ToASCII refuses stays refused. The parse falls back to keeping the domain's code points (AKeepNonASCIIDomain), so such a host reaches the net checks as the name the script wrote and the client refuses it before any lookup, as before. A scope ToASCII refuses is an invalid scope.

Consequences

  • A request's host, its denial and its Response.url use the form new URL() gives; a script that compared PermissionDenied.scope with a Unicode name sees the ASCII one.
  • AKeepNonASCIIDomain remains only for that fallback and for the check of a transport's final URL, which takes a domain as written and so runs no IDNA where the transport answers; a host only ToASCII makes valid there, such as an IPv4 address in full-width digits, is refused. The URL is given its ASCII form when the answer is settled.
  • A denial or an explanation names a scope in its ASCII form, and a request's host is matched as given: an embedder that asks AllowsNetHost itself converts a Unicode host first, as fetch() does.