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

So I finally had time to set up a Windows VM, and I've found that `URLCreateFromPathA` does indeed produce URLs with percent-encoding in the hostname:

`\\some computer\vol\file` -> `file://some%20computer/vol/file`
`\\?\vol\file` -> `file://%3F/vol/file`

Unfortunately, any browser or other application which conforms to this standard would fail to parse these URLs.

It appears that Windows used to prefer WINS/NetBIOS resolution over DNS, but switched to prefer DNS somewhere around Windows 2000 (it's hard to find specific documentation about this, though, since most of the MSDN links I've been able to find are dead). So I would suggest that a workaround might be to treat file URLs whose hosts are not valid domains as opaque hostnames. File URLs would basically allow all kinds of hostnames (domains, IP addresses, opaque hosts, and empty hosts).

This would mean changing step 7 of the [host parser](https://url.spec.whatwg.org/#host-parsing) to delegate to the opaque host parser if the URL has a file scheme, and possibly some other changes to ensure that setters work correctly. If this is okay in principle, I'll start investigating the changes that need to be made to the standard.


-- 
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#issuecomment-851678058

Received on Monday, 31 May 2021 20:52:44 UTC