4 ms·
I discovered the hard way that a library I was using would parse an IP address in a URL like 192.168.000.077 as 192.168.0.63. Yeah... it treated leading zeros
by jweather 7y ago
I discovered the hard way that a library I was using would parse an IP address in a URL like 192.168.000.077 as 192.168.0.63. Yeah... it treated leading zeros as octal in individual components of the IP. Lots of fun to track down.
- bluejekyll 7y agoIt’s always annoyed me that IPv4 addresses are valid DNS names. Unnecessary confusion and software workarounds to deal with it.
- brighter2morrow 7y agoThey're not valid DNS names, they're IP addresses. When you subscribe to an Internet Service Provider you are actually subscribing to the network using the IP address space. DNS is an add-on that is overlayed on top of the IP addressed network. If anything, allowing host resolvers besides DNS should be a more transparent process, like switching out your default search engine.
- barrkel 7y agoIPv4 addresses can be parsed as host names per RFC 1123 section 2.1; it is merely convention ("SHOULD") that dotted numbers are checked as IP addresses before being passed through DNS. This is what the parent meant. IPv4 addresses are also syntactically valid host names.
- metaphor 7y ago> IPv4 addresses are also syntactically valid host names. Curious...from the philosophical intent supporting the normative language[1] (my emphasis added): However, a valid host name can never have the dotted-decimal form #.#.#.#, since at least the highest-level component label will be alphabetic. [1] https://tools.ietf.org/html/rfc1123#page-13 https://tools.ietf.org/html/rfc1123#page-13
- bluejekyll 7y agoSee also: https://tools.ietf.org/html/rfc2181#section-11 https://tools.ietf.org/html/rfc2181#section-11
- ses1984 7y agoI'm not sure how you would go about fixing that...?
- bluejekyll 7y agoAt this point? It’s not feasible.
- dilyevsky 7y agoNot according to rfc1035 they’re not
- bluejekyll 7y agoYes, I misread that when implementing restrictions on DNS labels as well (answering with a different RFC from a sibling): "The DNS itself places only one restriction on the particular labels that can be used to identify resource records. That one restriction relates to the length of the label and the full name." -- https://tools.ietf.org/html/rfc2181#section-11 https://tools.ietf.org/html/rfc2181#section-11 Also, to get a full view of DNS, the HTML view of the RFC links to all the updates to DNS over the years: https://tools.ietf.org/html/rfc1035 https://tools.ietf.org/html/rfc1035 Which is pretty handy.
- NikkiA 7y agoBack in the dark past of the late 1980s/early 1990s, "[x.x.x.x]" used to be a convention to force parsing as an IP address rather than a DNS name. I have no idea where this convention came from, or where it went to, but it seems to have completely vanished since. It's possible that it was a UK-specific convention that was borne from JANET but I don't know; I do know that PAD and CPAD addresses (from X.25) were more common on JANET than IP addresses, so that seems unlikely.
- bluejekyll 7y agoThis is a great point. Square brackets are still used in ipv6 to more easily distinguish between the ip the port: e.g. [::1]:52