I'm trying to fetch a nonexistent (unresolvable hostname) page using wget. I expect it to fail, but it does not.
Here is a transcript
[mark@cn ~]$ cat /etc/resolv.conf ; google public nameserver 8.8.8.8 nameserver 8.8.4.4 [mark@cn ~]$ host nonexistent.example.com Host nonexistent.example.com not found: 3(NXDOMAIN) [mark@cn ~]$ wget -O - http://nonexistent.example.com/ --2010-09-05 22:12:09-- http://nonexistent.example.com/ Resolving nonexistent.example.com... 205.178.189.131 Connecting to nonexistent.example.com|205.178.189.131|:80... connected. HTTP request sent, awaiting response... 301 Moved Permanently Location: http://127.0.0.1 [following] --2010-09-05 22:12:09-- http://127.0.0.1/ Connecting to 127.0.0.1:80... connected. HTTP request sent, awaiting response... 200 OK Length: 524 [text/html] Saving to: `STDOUT' 0% [ ] 0 --.-K/s (some HTML that my local Apache serves) 100%[======================================>] 524 --.-K/s in 0s 2010-09-05 22:12:09 (62.5 MB/s) - `-' saved [524/524]
Why is this happening? Any ideas?
OS: Centos 5.5 x86_64 Network: cloudnext dedicated virtual servers
I'm asking because I've tried the same in Python code and something similar is happening. Something fishy is going on and I can't quite figure out what.