News for hackers. Stuff that matters.
Re:When Will The Social Sharing Button Madness Stop by hippee-lee on Tuesday April 17, 2012 @07:37PM (#3855607)
So, if you just add the localhost address to etc hosts then nothing from the url will load in your browser?
Re:When Will The Social Sharing Button Madness Stop by Nick_C on Thursday April 19, 2012 @12:30AM (#3861399)
Assuming /etc/resolv.conf is set up with "search <localdomain>" before any nameserver entries (which it invariably is), then any DNS query will first try the localhost.

In the absence of a nameserver on the local host, then the DNS lookup will search /etc/hosts, where it will find an entry for facebook.com that resolves to 127.0.0.1 (localhost).

Now the browser knows where to find facebook.com. It requests the web server at localhost to serve the URL. If there is no webserver, the browser gets back a "connection refused". If there is a webserver, the browser gets back a 404 error.

In either case, the browser just moves on to the next request.

Since it all happens on localhost, it is blazingly fast compared to an internet lookup, and the user won't realise.

Re:When Will The Social Sharing Button Madness Stop by hippee-lee on Wednesday April 25, 2012 @05:37PM (#3891232)
Thanks for the clear explanation. Now I understand what I am doing when I modify my hosts file like this.