Should I set up a Dummy HTTP, etc, at 127.0.0.1? "There's no place like home"

(target answers: long time software engineer…Some UDP/TCP, but only browser related When Things Were Rotten back in the CGI days.)

I’m one of those people who likes to have a hosts file populated with 127.0.0.1 to squash attempts to access various ad sites, etc.

Seems intrinsically safer, at least psychosomatically :slight_smile: , but I noticed that while once when it made web pages fill quicker in Firefox (blanked out ads or “complaints” that they could not be connected) I now question whether or not the web pages are waiting for response.

I can write a dummy http server (at 8080/80) to respond immediately with a blank return. Would this be faster than a time-out? Further, in flash or other cases where UDP is attempted, the initial contact would be met quickly with useless info instead of having it wait for a return.

Tell me if I’m on the wrong track. My better intuition tells me that I am. LOL.

Ideas?

If you’re ad/malware/spyware domains to 127.0.0.1, then no, you don’t need a dummy http server.

Since a domain is set to resolve to your localhost IP, there is no timeout since it does actually resolves to a valid IP in under a millisecond.

Now, there are some cases where something in the javascript code is waiting on a response from a particular domain, but there’s not much you can do in that case. Those situations will just lead to a timeout in either case. However, the adblocker or adblocker plus browser extension will usually take care of that issue.

Hmmmm…Ok. But I guess I’m wondering past the resolving to a valid IP.

Help me dust this part of my brain off.

Even in the TCP case (http connections, etc.), having the ip resolve doesn’t mean that a connection was established. I understand how TCP is a guaranteed delivery mechanism for the data, but does that the initial connection error returns immediately? I forget.

And I guess I’m also thinking back: all UDP programming (I’m assuming flash?—but for any rouge application outside the browser) I’ve ever seen wait for a return of some kind to know that at the very least the initial contact has arrived properly. If a dummy return shows up, (say blank) it would give that mechanism a chance to error out rather than sit waiting. No?

Or does it make it worse for the majority of UDP implementations that would look at that as an endless invitation for retries?

Of course in the UDP case I’d have to hang on basically /all/ the ports unless I wrote something at the raw IP level, which I haven’t done is so long I’d dare not try it. I think I’m answering all my own questions here.

You can check the state of the TCP/UDP connections with TCPview and/or Wireshark.

After the domain lookup, the browser would send an HTTP request, which starts off with a TCP SYN request, but localhost never responds to with a SYN-ACK to establish the connection (since there wouldn’t be anything listening for a TCP request for port 80). Since the TCP connection is never established, the connection attempt just times out within 3 seconds.

Meanwhile, in the browser, since nothing is displayed until there is a response from the HTTP request (the HTTP request could be for an image file, css file, javascript file, etc), nothing continues to be displayed during and after a failed HTTP connection.

Are the TCP requests within a page issued concurrently? Or is one waiting for the 3 second timeout of the previous one, etc.

For the most part, requests to files in the <head> to the same domain are sequential. Requests in the <head> to different domains are concurrent.

Everything linked in the body is loaded concurrently (images, iframes, etc).

Check out the firebug extension for firefox, and use the net panel. That will show you what a page is loading for each HTTP request. You’ll also see what happens to request to domains when those domains are blocked in the hosts file.

Well, here are the results of the firefox control panel (if that’s good enough). I ran this on the last “stuttering” website.:
[URL=" http://www.howtogeek.com/forum/topic/longest-effective-usb-cable"]
http://www.howtogeek.com/forum/topic/longest-effective-usb-cable

Look at the ad.doubleclick.net for example----it’s set to 127.0.0.1 and requires nearly a second to time out. B[/B]

[15:51:08.723] GET http://ad.doubleclick.net/adj/tmn.howtogeek/;dcopt=ist;pos=atf;tile=1;sz=728x90;ord=5586386764682946? [undefined 953ms]
[15:51:09.684] GET http://pagead2.googlesyndication.com/pagead/show_ads.js?1324241469678 [HTTP/1.1 200 OK 110ms]
[15:51:09.837] GET http://googleads.g.doubleclick.net/pagead/ads?client=ca-pub-1894578950532504&output=js&lmt=1324241465&num_ads=4&skip=0&channel=1000000341&ad_type=text_html&ea=0&feedback_link=on&flash=11.0.1&url=http%3A%2F%2Fwww.howtogeek.com%2Fforum%2Ftopic%2Flongest-effective-usb-cable&dt=1324241469825&shv=r20111207&jsv=r20110914&saldr=1&correlator=1324241469826&frm=20&adk=2656061260&ga_vid=1760478252.1324241470&ga_sid=1324241470&ga_hid=1252318956&ga_fc=0&u_tz=-300&u_his=2&u_java=1&u_h=800&u_w=1280&u_ah=800&u_aw=1280&u_cd=24&u_nplug=27&u_nmime=122&dff=trebuchet%20ms&dfs=13&biw=1280&bih=442&fu=0&ifi=1&dtd=5 [HTTP/1.1 200 OK 140ms]
[15:51:10.042] GET http://pagead2.googlesyndication.com/pagead/show_ads.js?1324241470008 [HTTP/1.1 200 OK 94ms]
[15:51:10.178] GET http://googleads.g.doubleclick.net/pagead/ads?client=ca-pub-1894578950532504&output=js&lmt=1324241465&num_ads=4&skip=3&channel=1000000342&ad_type=text_html&ea=0&feedback_link=on&flash=11.0.1&url=http%3A%2F%2Fwww.howtogeek.com%2Fforum%2Ftopic%2Flongest-effective-usb-cable&dt=1324241470170&shv=r20111207&jsv=r20110914&saldr=1&correlator=1324241469826&frm=20&adk=2451614586&ga_vid=1760478252.1324241470&ga_sid=1324241470&ga_hid=1252318956&ga_fc=0&u_tz=-300&u_his=2&u_java=1&u_h=800&u_w=1280&u_ah=800&u_aw=1280&u_cd=24&u_nplug=27&u_nmime=122&dff=trebuchet%20ms&dfs=13&biw=1259&bih=442&fu=0&ifi=2&dtd=3 [HTTP/1.1 200 OK 141ms]
[15:51:10.391] GET http://ad.doubleclick.net/adj/tmn.howtogeekbtf/;sz=728x90;ord=5586386764682946? [undefined 1000ms]
[15:51:11.433] GET http://b.scorecardresearch.com/b?c1=2&c2=6035753&c3=6035753&c4=http%3A%2F%2Fwww.howtogeek.com%2Fforum%2Ftopic%2Flongest-effective-usb-cable&c5=Technology%20-%20News&c6=&c15=&ns__t=1324241471416&ns_c=UTF-8&c8=Longest%20effective%20USB%20cable%3F%20«%20How-To%20Geek%20Forums&c7=http%3A%2F%2Fwww.howtogeek.com%2Fforum%2Ftopic%2Flongest-effective-usb-cable&c9= [HTTP/1.1 302 Moved Temporarily 156ms]
[15:51:11.438] GET http://www.google-analytics.com/ga.js [undefined 1063ms]
[15:51:11.577] GET http://b.scorecardresearch.com/b2?c1=2&c2=6035753&c3=6035753&c4=http%3A%2F%2Fwww.howtogeek.com%2Fforum%2Ftopic%2Flongest-effective-usb-cable&c5=Technology%20-%20News&c6=&c15=&ns__t=1324241471416&ns_c=UTF-8&c8=Longest%20effective%20USB%20cable%3F%20«%20How-To%20Geek%20Forums&c7=http%3A%2F%2Fwww.howtogeek.com%2Fforum%2Ftopic%2Flongest-effective-usb-cable&c9= [HTTP/1.1 204 No Content 63ms]
[15:51:12.527] GET http://bcp.crwdcntrl.net/4/c=505 [HTTP/1.1 200 OK 3156ms]
[15:51:12.531] GET http://www.google.com/coop/cse/brand?form=searchbox_009481737823548119489%3Aw5lekpyovpo&lang=en&_=1324241472507 [HTTP/1.1 200 OK 125ms]
[15:51:12.535] GET http://www.howtogeek.com/commonphp/ajaxcache/userlinks.php?action=htgAjax&type=userLinks [HTTP/1.1 200 OK 3188ms]