WTFriday: http://2915189091

February 10, 2012 by . 7 comments

Have you ever heard of a link like http://2915189091? Don’t worry, not a shock site…

While this does not always work in every browser (eg. some versions of Firefox), it does work in most browsers like MSIE and Google Chrome. It really depends on the implementation of how the URL is parsed, Firefox seems to not go beyond our usual ways to type a URL.

This is all about how the URL is stored. Many of you know that you can also access Google through their IP, eg. http://173.194.65.99. Now let’s see how much data storage that IP requires. As one character is 1 byte for ASCII, it takes 13 bytes to store the IP address. Or with Unicode (UTF-16) you will need the double, 26 bytes. Another way to store the IP is by taking each number and storing that apart, resulting in unsigned octets from 0 to 255 which each take a single byte, so that totals out at 4 bytes.

Now, another thing one can do to the storage of an IP address is not having our program read these four apart and use a function to convert them to and from the different data types. This is why sometimes programmers use the long integer format (which is also 4 bytes) such that they can access the IP by accessing a single variable. This ranges from 0 to 4,294,967,295; which actually means that there are only 4,294,967,296 IPs available in IPv4. Internally, the bits of the four integers are shifted so that they don’t overlap and fit in a long integer.

unsigned long ipAddr = ( a << 24 ) | ( b << 16 ) | ( c << 8 ) | d;

So, those programmers that don’t waste lots of space by storing the IPs by strings have two alternative ways to store them in integer formats. And that’s why some browsers are also capable of interpreting the combined long integer format. So now you know what’s really happening under the hood if you ever come across such a weird link again…

But, how does one make such a link?

Easy, you can find Long IP converters online like Elf Qrin’s Long IP Converter which basically call one of these conversion functions for you. As I mentioned before this only does apply to the IP address, so if a hosting hosts multiple sites on an IP address (or doesn’t configure the IP address to respond) then it might not work fine. This is also why for example the IP of YouTube will respond with the website of Google…

We want you for WTFriday!

If you are interested in writing a blog post like this one for your community to read, then check this out. It doesn’t have to be as informative as this one, just about that strange WTF that has been buggering you lately; why it occured and how you resolved it, if possible.

Filed under Uncategorized

7 Comments

Subscribe to comments with RSS.

  • Nate Koppenhaver says:

    The http://2915189091/ link works in Firefox 10 (on WinXP) – it goes to Google

    • Could depend on version or proxy settings, I haven’t researched how the different browsers resolve this. One could deep-dive into the Firefox to figure this out but it’s kind of out of the scope of Super User, thanks for mentioning that it does seem to work in some versions. I’ve slightly changed the sentence in the blog post…

  • grawity says:

    As far as I know, these kinds of addresses are supported internally by the system – the program never needs to convert them to binary manually; it simply gives the “host” part to getaddrinfo() and the system translates it. Both winsock on Windows and glibc on Linux support addresses of less than four components.

    Ah, I almost forgot. They also support two or three components, as well as hex and octal. Try http://0321.0×55.58711/ for Google. Have fun.

    Addition: In particular, to shorten an address you can use “d” (as in the original post), “a.d” and “a.b.d” in addition to the typical “a.b.c.d”.

    There are cases where it’s handy to omit a few components. For example, when dealing with addresses in 10/8, you can just say “10.42” to mean “10.0.0.42”… or you can say “10.259” to mean “10.0.1.3”; here components larger than 255 are valid, they simply overflow to the adjacent component.

  • Josh says:

    ” to type an URL.” The use of ‘an’ would indicate that you pronounce ‘URL’ like ‘earl’. This is not common, and I have heard it mocked in the same vein as “CSI: Miami”‘s pronunciation of ‘GUI’ as ‘gooey’. Indeed, it seems to me as strange as pronouncing ‘CSI’ as ‘see’.

    Actually when I first read it, I thought you had simply used ‘an’ by accident and meant to say “a URL” (as in “a you-are-el”)

  • naught101 says:

    @Tamara: Now your first sentence doesn’t make any sense, grammatically 😛 I would suggest “While this does not always work in every browser (eg. some versions of Firefox), it does work in most browsers …”

  • Lars says:

    Interesting stuff!

    It is really a matter of how the IP address is parsed, rather than how it is stored, as the two are in independent.

    This answer gives documentation on how such IP addresses are parsed in iputils such as (certain versions of) ping:

    http://superuser.com/a/486904/75777

  • Comments have been closed for this post