[whatwg/url] Allow ports in file URLs (#548)

Currently, with the test URL file://example:1/ we have three different behaviors:
1. Firefox will remove the host and return file:///
2. Chrome does not allow the port and throws an exception.  This is currently the behavior described in the specification.
3. Safari allows the port.

While attempting to disallow ports from file URLs in https://bugs.webkit.org/show_bug.cgi?id=217252 I found a test written 13 years ago in https://trac.webkit.org/changeset/24484/webkit that indicates there is software that relies on the port not being forbidden in file URLs, and that there has been such software for a very long time.

I'm wondering if there is a good reason to not allow a port in file URLs?  It is true that most file URLs won't have it, and I'm not sure what anything would do with the port, but I don't see a good reason to forbid it and fail parsing.

Would we be willing to add a transition from file host state to port state if c is ':'?

-- 
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/548

Received on Saturday, 3 October 2020 05:30:55 UTC