Jim Peterson <[EMAIL PROTECTED]> writes: > Using Fedora Core 3, when I "wget http://www.studylight.org/", it prints > out: > > --02:52:30-- http://www.studylight.org/ > => `index.html' > Resolving www.studylight.org... 63.164.18.58 > Connecting to www.studylight.org[63.164.18.58]:80... connected. > HTTP request sent, awaiting response... 302 Found > Location: http://localhost/ [following] > --02:52:30-- http://localhost/ > => `index.html' > Resolving localhost... 127.0.0.1 > Connecting to localhost[127.0.0.1]:80... failed: Connection refused. > > Why is it trying to connect to localhost?
Because it redirects you to localhost, possibly as a (feeble) attempt to prevent the site from being leeched with Wget. Use `wget -U Mozilla' and the problem goes away. > My browser can load the page, but if I manually "telnet > www.studylight.org 80" and type "GET /", I get a page that tends to > indicate a peculiar web server setting that returns the Apache test > page. That is a symptom of the site using name-based virtual hosting. You must remember to also specify the Host header. $ telnet www.studylight.org 80 Trying 63.164.18.58... Connected to newadmin.studylight.org. Escape character is '^]'. GET / HTTP/1.0 Host: www.studylight.org HTTP/1.1 200 OK Date: Wed, 18 May 2005 08:23:12 GMT Server: Apache/1.3.33 (Unix) (Gentoo/Linux) mod_perl/1.27 Connection: close Content-Type: text/html <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> ... > Is this simply an indication of a poorly administered server, or is > it a bug in wget? It's overprotectiveness of the server administrator. If you do the same telnet thing, but introduce yourself as Wget, you get the bogus redirection to "localhost": $ telnet www.studylight.org 80 Trying 63.164.18.58... Connected to newadmin.studylight.org. Escape character is '^]'. GET / HTTP/1.0 Host: www.studylight.org User-Agent: Wget/1.9.1 HTTP/1.1 302 Found Date: Wed, 18 May 2005 08:24:10 GMT Server: Apache/1.3.33 (Unix) (Gentoo/Linux) mod_perl/1.27 Location: http://localhost/ Connection: close Content-Type: text/html; charset=iso-8859-1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <HTML><HEAD> <TITLE>302 Found</TITLE> </HEAD><BODY> <H1>Found</H1> The document has moved <A HREF="http://localhost/">here</A>.<P> <HR> <ADDRESS>Apache/1.3.33 Server at studylight.org Port 80</ADDRESS> </BODY></HTML>
