[whatwg/url] Should file URLs have opaque hostnames? (#599)

I've been trying to port Chromium's file path <-> file URL utilities to a project conforming to the latest standard.

As far as I have been able to tell (it's a large codebase and I'm not at all familiar with it), Chromium turns Windows UNC paths in to file URLs with hostnames, and those hostnames may include percent-encoding (e.g. `\\some computer\foo\bar.txt` [becomes](https://github.com/chromium/chromium/blob/1df1a4b91a4e8cf4e0ed15b0baca738520f137a5/net/base/filename_util_unittest.cc#L179) `file://some%20computer/foo/bar.txt`).

That is not allowed by this standard: the hostnames of file URLs are domains (they are even encoded with IDNA), and may not contain raw spaces or percent-encoding.

Is this really meaningful? I don't think anybody really expects a file URL's hostname to be an IDNA-encoded domain, or to ever resolve it using DNS in to an IP address; it might be better for them to have opaque hostnames, so they can contain percent-encoding.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/url/issues/599

Received on Saturday, 15 May 2021 15:46:39 UTC