I am new to python and network programming and am having problems with a simple program. I basically open a connection to a non-existent website, and for some reason it seems that the connection is succeeding. Moreover, I get a return code of 200, which means that the HTTP server replied that it exists, and the connection is OK. Here is the relevant part of my code:
import httplib conn = httplib.HTTPConnection("Nonexistentsite.com", 80) conn.request("GET","/") r = conn.getresponse() print r.status, r.reason conn.close()
And when I try to use google.com or any other existing website instead of nonexistentsite.com , I get 301 or 302 - Moved permanently .
Could you clarify why this is happening, please? I am using visualStudio2010 (IronPython) if that matters.
source share