3 ms·
None of the standard calls use colons for separating ports - I can’t recall exactly whether it’s even a standard URI thing or just something web browsers did.
by stephen_g 8y ago
None of the standard calls use colons for separating ports - I can’t recall exactly whether it’s even a standard URI thing or just something web browsers did.
Further, even UNIX paths containing ‘..’ and other things need normalisation, and with symlinks you can’t necessarily just compare two paths to determine whether they point to the same file.
The problem, as plenty of other people have said in these comments, is that you just need to parse the address and compare the structure. There are standard library calls for this, and most databases have types that can do this.
- im3w1l 8y agoThere are many programs beyond browsers that use colon for ports.
- isbjorn16 8y ago> None of the standard calls use colons for separating ports - I can’t recall exactly whether it’s even a standard URI thing or just something web browsers did. https://tools.ietf.org/html/rfc3986#section-3.2.3 https://tools.ietf.org/html/rfc3986#section-3.2.3 Specifically part of the URI RFC. Probably should have picked something wildly unrelated as a separator instead of colons - but the horse has already left the barn, so now we just get to play cleanup. You're right that there's already a decent amount of support for this in various languages and persistence mechanisms, but I've spent enough time in my career playing with truly bleeding edge barely-an-alpha platforms to know that sometimes you do just get stuck writing your own parser and comparators. It's good to know in advance what sort of potholes you will be trying to navigate :) Edit: I just discovered the URI RFC is dated 2005, with IPV6 being dated 1998. ( https://www.ietf.org/rfc/rfc2460.txt https://www.ietf.org/rfc/rfc2460.txt ) Still, it struck me as odd that we had been using host:port for so long. The URL conceptual predecessor to URI RFC also mentions using host:port in section 3.1.1 - which came out in 1994. Regardless of which RFC made a hash of things though, all 3 are widely used specifications, so we're stuck in this boat now!
- toyg 8y agoWhen ipv6 was devised, : was already widely used to define ports by all sorts of applications. Let’s be honest, the creation of ipv6 was badly handled.