Fix a crash with protected Tor control port (#785)
parent
966644baa0
commit
194b2eae74
|
@ -8,6 +8,7 @@ from requests import Response, ConnectionError
|
||||||
import urllib.parse as urlparse
|
import urllib.parse as urlparse
|
||||||
import os
|
import os
|
||||||
from stem import Signal, SocketError
|
from stem import Signal, SocketError
|
||||||
|
from stem.connection import AuthenticationFailure
|
||||||
from stem.control import Controller
|
from stem.control import Controller
|
||||||
from stem.connection import authenticate_cookie, authenticate_password
|
from stem.connection import authenticate_cookie, authenticate_password
|
||||||
|
|
||||||
|
@ -63,7 +64,9 @@ def send_tor_signal(signal: Signal) -> bool:
|
||||||
c.signal(signal)
|
c.signal(signal)
|
||||||
os.environ['TOR_AVAILABLE'] = '1'
|
os.environ['TOR_AVAILABLE'] = '1'
|
||||||
return True
|
return True
|
||||||
except (SocketError, ConnectionRefusedError, ConnectionError):
|
except (SocketError, AuthenticationFailure,
|
||||||
|
ConnectionRefusedError, ConnectionError):
|
||||||
|
# TODO: Handle Tor authentification (password and cookie)
|
||||||
os.environ['TOR_AVAILABLE'] = '0'
|
os.environ['TOR_AVAILABLE'] = '0'
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
Loading…
Reference in New Issue