31

http://.................1168951531

Which, when put into chrome, previews to the URL http://69.172.200.235/, which redirects (by external server response code 3XX) to www.test.com, but that is outside the scope of what I'm trying to figure out.

How does such a weird URL like above resolve to an IP address? Is this a formatting rule?

Shadowjonathan
  • 453
  • 4
  • 7
  • 2
    Note that the same URL without the dots also works in Chrome: `http://1168951531`. But that begs the question, why does Chrome ignore the dots? – wjandrea Mar 02 '18 at 00:33
  • 6
    @wjandrea I'd guess Chrome interprets them as subdomains and doesn't actually ignore them. You can check that by viewing the Host-header of the request chrome sends. – Christoph Mar 02 '18 at 07:16
  • 1
    Bit of a tangent, but **Gmail** addresses allow you to add as many dots as you want, without causing problems, and also a + with whatever text after it you want. So `abcd@gmail.com` will also receive mail sent to `a.b.c.d@gmail.com` or `abcd+junkmail@gmail.com` - and a benefit is giving different emails to different sites to see who's putting you on the spam lists, or setting up rules to handle incoming mail different ways depending on the "To" address. ([More](https://gmail.googleblog.com/2008/03/2-hidden-ways-to-get-more-from-your.html)) Or, kylesmom@gmail.com is now kylesmom+is.a.big.fa... – ashleedawg Mar 03 '18 at 07:24
  • For what it's worth, the combination of Firefox and squid does not allow this; Firefox passes the dots through verbatim, and squid errors because it's an invalid URL format. So this seems like a Chrome bug, or possibly the spec regarding empty domains is ambiguous? – Paul Gear Mar 27 '18 at 22:54

2 Answers2

44

Chrome is interpreting the number 1168951531 as a decimal number, which when represented in hexadecimal is 45ACC8EB. 45ACC8EB in hex is the same as the dotted decimal 69.172.200.235, when you take each pair of hex digits as one decimal number.

45 -> 69
AC -> 172
C8 -> 200
EB -> 235

Short answer: It's the pure decimal representation of the same IP address.

Steve
  • 570
  • 4
  • 8
  • 4
    Firefox does the interpretation too (without the dots), but not Edge. – JAB Mar 01 '18 at 22:56
  • 11
    The typical source code to resolve a hostname is to first check if it is an IP address (e.g. with `inet_addr()`) and if not, pass it to a function like `gethostname()` that interrogates the DNS servers (and reads the `hosts` file). Passing a decimal representation of the IP address, as explained in the answer above, is perfectly legal in most implementations. I can type `ping 1168951531` in a terminal, and it actually pings the intended address. It becomes more weird with all the dots in front, but possibly Chrome is removing them before attempting the resolution. – Ale Mar 02 '18 at 00:01
  • 1
    It's worth noting that both Chrome and Firefox accept the URL without dots. (`http://1168951531`) – Stevoisiak Mar 02 '18 at 22:04
3

This is a long representation of an ipv4 address of the ip 69.172.200.235. Which maps to www.test.com domain.

Gothrek
  • 512
  • 2
  • 7