[whatwg/url] Allow specifying additional "special" schemes. (Issue #749)

The parsing algorithm behaves differently for certain domains that are considered "special". In addition the scheme of a non-special URL cannot be changed to a special scheme. In some applications, especially non-web-browser applications, it is desirable for additional schemes to  be treated the same way as the listed special schemes, and be able  change the protocol/scheme to and from other special schemes. 

I think there are a few ways this could be addressed:

1. Change the API to allow passing a list of additional special schemes into the constructor for URL
2. Change the API to allow specifying that a URL should be treated as a special url during construction
3. Add a new URLFactory (or URLBuilder) class that allows configuring the set of special schemes for any URLs created with it.
4. Do not specify any additional required API, but say that an implementation is allowed to treat additional schemes as special, and potentially include an API for registering additional special schemes.

Some examples of schemes that applications may wish to treat as special:
- git
- sftp
- gopher
- http+unix and https+unix or similar (in fact, maybe it would be worth specifying that an existing special scheme followed by a "+" and a suffix is also a special scheme?)
- custom scheme intended for opening an http resource in a specific application


I follow the rust-url repository, which aims at implementing this specification, and issues related to this come up pretty frequently. For example: 
- https://github.com/servo/rust-url/issues/773
- https://github.com/servo/rust-url/issues/767
- https://github.com/servo/rust-url/issues/763
- https://github.com/servo/rust-url/issues/667
- https://github.com/servo/rust-url/issues/577
- https://github.com/servo/rust-url/issues/803
- https://github.com/servo/rust-url/issues/579

Related issues for this repository:

- https://github.com/whatwg/url/issues/674
- https://github.com/whatwg/url/issues/577
- https://github.com/whatwg/url/issues/623



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

Message ID: <whatwg/url/issues/749@github.com>

Received on Sunday, 5 February 2023 05:56:31 UTC