Ich versuche, meinen einfachen Twisted Web-Proxy zu ändern, um "Proxy-Authentifizierung" (Benutzername/Passwort) anstelle der aktuellen IP-basierten Authentifizierung zu verwenden. Problem ist, ich bin Twisted neu und weiß nicht einmal wo ich anfangen soll.Wie wechsle ich diesen Proxy zur Verwendung der Proxy-Authentifizierung?
Hier ist meine Fabrikklasse.
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
Haben Sie eine Idee, was ich tun muss, damit dies funktioniert? Danke für Ihre Hilfe!