Re: [whatwg/url] Preserve "localhost" in file URLs? (#618)

Check out the recent https://crrev.com/c/3088038 in Chromium, in particular this part:

```
Second, it changes the conditions required for removing host from

      Windows-only,    any host,    path has drive letter
                              to
         any OS,    localhost-only, path has drive letter

This is a step towards compliance with the WHATWG URL Standard, and
partially fixes bug 688961. For reference, the spec and Safari do host
removal with:
         any OS,    localhost-only,       any path
while Firefox uses:
         any OS,       any host,          any path
```

While my intention was to eventually do a follow-up that aligns with the current Standard, in the context of this issue I think Chromium's behavior after the CL is reasonable too. (I.e., strip localhost only if the path has a drive letter.) Notice that this takes care of the OP, and can resolve all four URLs:

* `file:///C:/Windows`
* `file://localhost/C:/Windows` (`localhost` stripped during parsing)
* `file://localhost/SomeShare`
* `file:///SomeShare`

With regards to not stripping localhost _at all_, I think it's probably technically doable, but there isn't much to be gained over Chromium's solution at that point.

-- 
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/618#issuecomment-951165495

Received on Monday, 25 October 2021 17:56:50 UTC