How come my program can connect to a nonexistent website?

前端 未结 3 821
猫巷女王i
猫巷女王i 2021-01-13 18:27

I am new to python and network programming and I am having trouble with a simple program. I am basically opening a connection to a nonexistent website and somehow it seems t

3条回答
  •  醉梦人生
    2021-01-13 18:56

    Running your code in Cygwin's Python, I get an error for Nonexistentsite.com, so I'm not sure if something weird is happening with IronPython.

    Google.com is Moved permanently because Google has a system of redirects for their main page. For example, if they detect you are in the UK, google.com will redirect you to google.co.uk (untested, I am in the US, but that is what I have read). If I try your code with stackoverflow.com or another site that doesn't have something as complicated set up as Google, I get a 200 OK response.

提交回复
热议问题