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://18.104.22.168. 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