Add proxy authentication

- proxy module was missing initialisation of authentication
This commit is contained in:
Peter Šurda 2018-02-18 20:53:16 +01:00
parent ff9634141e
commit 757740369b
Signed by untrusted user: PeterSurda
GPG Key ID: 0C5F50C0B5F37D87

View File

@ -3,6 +3,7 @@ import time
from advanceddispatcher import AdvancedDispatcher from advanceddispatcher import AdvancedDispatcher
import asyncore_pollchoose as asyncore import asyncore_pollchoose as asyncore
from bmconfigparser import BMConfigParser
from debug import logger from debug import logger
import network.connectionpool import network.connectionpool
import state import state
@ -87,6 +88,11 @@ class Proxy(AdvancedDispatcher):
self.isOutbound = True self.isOutbound = True
self.fullyEstablished = False self.fullyEstablished = False
self.create_socket(socket.AF_INET, socket.SOCK_STREAM) self.create_socket(socket.AF_INET, socket.SOCK_STREAM)
if BMConfigParser().safeGetBoolean("bitmessagesettings", "socksauthentication"):
self.auth = (BMConfigParser().safeGet("bitmessagesettings", "socksusername"),
BMConfigParser().safeGet("bitmessagesettings", "sockspassword"))
else:
self.auth = None
if address.host.endswith(".onion") and self.onion_proxy is not None: if address.host.endswith(".onion") and self.onion_proxy is not None:
self.connect(self.onion_proxy) self.connect(self.onion_proxy)
else: else: