Re: [whatwg/url] Addressing HTTP servers over Unix domain sockets (#577)

The strongest argument I can think of for this is: http(s) URLs have special parsing quirks which don't apply if the scheme is http+unix. So for a perfect 1:1 behaviour match, UDSs would need to use an _actual_ http URL, not a custom scheme (similar to IP addresses).

That said, I'm also not a fan of adding _yet another_ kind of host (file paths). My preference would be to use a combination of:

- Fake hostname (`localhost`, `example`, `test` and `invalid` are all reserved and will never be allowed as a TLD, so something like `uds.localhost` should work), and
- Socket address in the fragment (HTTP clients should strip it before sending the request anyway)

```
http://uds.localhost/some/path?some=query#/path/to/socket.sock
```

This is a [perfectly valid](https://jsdom.github.io/whatwg-url/#url=aHR0cDovL3Vkcy5sb2NhbGhvc3Qvc29tZS9wYXRoP3NvbWU9cXVlcnkjL3BhdGgvdG8vc29ja2V0LnNvY2s=&base=YWJvdXQ6Ymxhbms=) HTTP URL, and should be capable of representing any HTTP request target.

Alternatively, you could try to get `uds` or `socket` as reserved TLDs, but I'm not sure how you'd go about doing that.

-- 
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/577#issuecomment-967178968

Received on Friday, 12 November 2021 14:56:47 UTC