Old Tom article
Continued from Page 4
Here's how your browser says "give me the web page /product/index.html?oldtom". Remember we're already talking to the otscripts.com server, so we know what domain we're dealing with:
GET /product/index.html?oldtom HTTP/1.0
The "web guy" who was listening on port 80, knows exactly how to interpret the above line of text, and feeds /product/index.html to your browser. We're done.
We're done. Except, that is, for one little detail.
Remember that socket connection? That's how the entire web works - socket connections. Your browser connects to the server's port 80, tells the server what it wants, and the server responds with the desired web page. So, what's the problem?
The problem is that socket connections *only* happen with IP addresses. Sockets don't know a thing about domains or domain names - they *only* know about IP numbers and ports. If you're connecting to otscripts.com, that means you open a socket connection to 209.215.97.148 port 80. However, if you're connecting to old-tom.com, you *also* connect to 209.215.97.148 port 80. For jojasa.com, connect to 209.215.97.148 port 80. Likewise for hotterpics.com or hotslutlinks.com.
Can you see the problem? Our browser makes the socket connection all right, but the server has absolutely no clue as to whether we're expecting to find jojasa.com, old-tom.com, or some other domain. Meanwhile, our browser has no way of knowing there's a problem... back in the "good old days," every domain had a different IP address. You get the right IP number and port 80, and you've got the right domain. With name-based server configurations, that's no longer true.
Here's how we solve the problem. The browser must supply *two* lines of information instead of just one line:
GET /product/index.html?oldtom HTTP/1.0
Host: www.otscripts.com
Now the "web guy" listening on port 80, knows which page of which domain, and feeds it back to you straightaway.
By the by, for hotlinking protection, your browser is expected to supply a *third* line of information, like this:
GET /product/index.html?oldtom HTTP/1.0
Host: www.otscripts.com
Referer: http://www.vnwr.com/main/index.html
The server uses your "referer" information, in processing your .htaccess file. If I wanted to redirect any visitor coming from vnwr.com, I could put the appropriate RewriteRule in my .htaccess. If I want to redirect anyone coming from a certain search engine, I just drop the line into my .htaccess, and let the server take it from there.
This of course, is how hotlinking protection works, and also shows how the site suckers get around your protection.
Suppose vnwr.com is trying to hotlink one of my pictures. What that means is that your browser will attempt to display the picture - but your browser will also report the fact that the link came from vnwr.com:
GET /images/logo.jpg HTTP/1.0
Host: otscripts.com
Referer: http://www.vnwr.com/main/index.html
Since the referer is *not* otscripts.com, my .htaccess file will tell the server to *not* hand out the image. You see a broken image icon, and my bandwidth is protected.
But... what if your browser chose to lie about the situation? The following three lines ask for the same image, but notice the difference:
GET /images/logo.jpg HTTP/1.0
Host: otscripts.com
Referer: http://www.otscripts.com/index.html
Now we're asking for the image, and the referer is otscripts.com. This is *precisely* what the socket connection looks like, when the browser is loading the logo on my otscripts.com splash page.
Browsers, of course, never lie. They can be trusted. Netscape, I believe, is owned by AOL. Internet Explorer, I believe, is owned by Microsoft. If you can't trust AOL software and Microsoft software, what can you trust? The whole basis of hotlink protection, is the presumption that AOL software and Microsoft software would *never* lie to you, for any reason, ever.
Unfortunately, however, there are people out there capable of writing a script which can do a socket connection on port 80, and send out those three lines of text. They are unscrupulous to the point that they *make things up* when filling in that Referer line. Yes, they lie to your server!
Steven Wright




