Re: [whatwg/url] Why is the host dropped if the path contains a Windows drive letter? (#302)

Shouldn't the spec decide what implementations support, not the support decide what is specced?
What do you mean with "if Windows doesn't support it"? Of course you cannot just type in a URL like `file://120.53.57.76/foo/bar.txt` into Edge, hit enter and get the file content of that file on that IP shown in the browser. But that doesn't mean that shouldn't be able to _create_ such a URL, for identification purposes, internal application logic etc. It's up to the application how to retrieve the content and whether the content ever needs to be retrieved.

The way I ran into it is actually the example I gave above. I was refactoring a language server to use the WHATWG `URL` API instead of Node's `url.parse()`/`url.format()`, and couldn't get some tests to pass because of this behaviour. The server is written in NodeJS and can run on any host and OS, but the text document URIs are picked by the client, which are typically `file:` URIs (and if the client runs Windows, they will have drive letters). If the host of the file URI is missing or `localhost`, the server should be able to assume that it can read the file from disk. Right now, it can't if the client is running Windows (but can if it is running Linux).

-- 
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/302#issuecomment-297975958

Received on Friday, 28 April 2017 11:36:52 UTC