为什么 Tor 无法访问本地主机页面 [英] Why Tor cant access localhost pages

查看:82
本文介绍了为什么 Tor 无法访问本地主机页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我运行 Tor 和一个 python 脚本来获取网页:

I have Tor running and a python script to get web pages:

socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, "127.0.0.1", 9050)
socket.socket = socks.socksocket

print urllib2.urlopen(URL).read()

但是,如果网址是

http://localhost/some_page.html

我收到以下错误:

raise Socks5Error(ord(resp[1]),_generalerrors[ord(resp[1])])
TypeError: __init__() takes exactly 2 arguments (3 given)

有人可以向我解释到底发生了什么吗?

Can someone explain to me what exactly happens?

谢谢.

推荐答案

协议就是这样设计的.当您发送请求时,它会通过 Socks5 信封传输到 Internet 上的另一台机器.因此实际请求是从外部服务器发出的,因此无法访问 127.0.0.1.

It is the way protocol is designed. When you send a request, it is transported to another machine on Internet with Socks5 envelope. So actual request is made from external server, thus accessing 127.0.0.1 is not possible.

这篇关于为什么 Tor 无法访问本地主机页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆