3 ms·
I’ve always found it annoying that we have these multiple types of socket addressing, which were all invented before there was any concept of a URL, and yet the
by derefr 7y ago
I’ve always found it annoying that we have these multiple types of socket addressing, which were all invented before there was any concept of a URL, and yet there’s no clear bijective mapping between arbitrary socket address formats, and URL origins. I.e., you can’t just create a URL where the origin part is specified as a Unix domain socket path. (Or any other kind of format besides AF_INET and AF_INET6, despite there having been many other weird historical ones.)
Which means everyone who needs their client to support connecting to an RPC server over both AF_INET/6 sockets and AF_UN sockets, needs to invent some custom metaformat above URLs for specifying that they want a connection through a Unix socket path. Kind of ridiculous, really.
- takeda 7y agoI'm not sure I understand what you mean. The AF_INET and AF_INET6 don't represent URLs because they are on completing different layer (layer 4) where the URLs operate on layer 7. On top of that there's an add-on protocol to translate name to IP - DNS. To do what you wanted it would require to redesign the whole networking. Named Data Networking[1] (NDN) which unlike TCP/IP addresses data would be able to support URLs like that natively. [1] https://named-data.net/project/ https://named-data.net/project/
- fulafel 7y agoI'm not sure there would be any difficulty supporting Unix socket paths in your URI scheme? I guess you can just steal the semantics from the file:// scheme. Or do you want the same URI scheme to support all your different transport protocols? It kind of feels like missing the point of URIs, after all the whole idea is that your application can interchangeably handle different kinds of URIs for different use cases.
- derefr 7y agoYes, in my ideal world, URIs would be a sequence of "steps" to resolving a resource, where each step starts off with a nominal "resolver object" it's working against, and then names a scheme (method) available upon that resolver object, where the rest of that step of the URL are then method parameters to that abstract call, resulting in either another "resolver object", or a fully-resolved resource. The scheme of the final step then determines the protocol for the interaction with the resource. This is somewhat, but not perfectly, analogous to how 9P mounts work in Plan9. In both models, you start off with your local namespace, which has servers mounted on it like /mnt/web or /mnt/ftp. These are the "schemes" available on the initial resolver object. You then build a path to a virtual file within one of these mountpoints (/net/tcp, say), where that path turns out to point to a resource that describes (in a format another 9P server understands) how to create another mount representing that connection. The difference between the two models is that, with 9P, you'd have to take this descriptor file and mount it yourself; whereas in my model, you wouldn't see a descriptor file, but rather another already-mounted server, with its own schemes as its root-level exposed virtual directories. Pretending 9P worked this way, you'd be able to have a namespace path that looks like, e.g.: /net/tcp/foo.com/80/http/patha/pathb/a=b/c=d Back in URL land, this kind of path would correspond to a "meta-URL" that looks like e.g.: tcp:foo.com:80#http:/patha/pathb?a=b&c=d where the "#" symbol now takes on new significance as a command for the URL resolver, to address the next part of the path to the resolver-object discovered by resolving everything on the meta-URL so far. (Which perfectly subsumes #'s current use, since browsers interpret a # as identifying a particular DOM-tree node within a document—i.e. as using the resource acquired from the previous URL-step as a resolver to find the next object.) You could do all sorts of crazy things with this, too, like creating URLs that represent files available within archives that exist as HTTP streams, e.g.: tcp:/foo.com/80#http:/foo/bar.tar#file:/index.html Or adding DNS or TLS arbitrarily into protocol stacks that weren't designed for them: ip:/dns/foo.com#tcp#tls#irc:%23room