Python 如何切换此代理以使用代理身份验证?
我正在尝试修改我的简单Twisted web代理,以使用“代理身份验证”(用户名/密码),而不是当前基于IP的身份验证。问题是,我对Twisted还不熟悉,甚至不知道从哪里开始 这是我的工厂课Python 如何切换此代理以使用代理身份验证?,python,authentication,proxy,twisted,Python,Authentication,Proxy,Twisted,我正在尝试修改我的简单Twisted web代理,以使用“代理身份验证”(用户名/密码),而不是当前基于IP的身份验证。问题是,我对Twisted还不熟悉,甚至不知道从哪里开始 这是我的工厂课 class ProxyFactory(http.HTTPFactory): def __init__(self, ip, internal_ips): http.HTTPFactory.__init__(self) self.ip = ip self
class ProxyFactory(http.HTTPFactory):
def __init__(self, ip, internal_ips):
http.HTTPFactory.__init__(self)
self.ip = ip
self.protocol = proxy.Proxy
self.INTERNAL_IPS = internal_ips
def buildProtocol(self, addr):
print addr
# IP based authentication -- need to switch this to use standard Proxy password authentication
if addr.host not in self.INTERNAL_IPS:
return None
#p = protocol.ServerFactory.buildProtocol(self, addr)
p = self.protocol()
p.factory = self
# timeOut needs to be on the Protocol instance cause
# TimeoutMixin expects it there
p.timeOut = self.timeOut
return p
你知道我需要做什么才能让这一切顺利吗?谢谢你的帮助 不久前,Twisted邮件列表上出现了一个类似的问题:
正如我在这里提到的,您可能需要对一些twisted.proxy类进行子类化,以便它们理解代理身份验证和代理授权头。不久前twisted邮件列表上出现了一个类似的问题: 正如我在这里提到的,您可能需要对一些twisted.proxy类进行子类化,以便它们理解代理身份验证和代理授权头