Make proxies work
This commit is contained in:
@@ -52,7 +52,7 @@ try:
|
||||
except Exception as e:
|
||||
print(e)
|
||||
print("Error: Could not find icons file.")
|
||||
print("Please run 'pyrcc4 icons.qrc -o gui/qt/icons_rc.py', and reinstall Electrum")
|
||||
print("Please run 'pyrcc4 icons.qrc -o gui/qt/icons_rc.py -py3', and reinstall Electrum")
|
||||
sys.exit(1)
|
||||
|
||||
from .util import * # * needed for plugins
|
||||
|
||||
@@ -497,12 +497,12 @@ class TorDetector(QThread):
|
||||
@staticmethod
|
||||
def is_tor_port(port):
|
||||
try:
|
||||
s = socket._socketobject(socket.AF_INET, socket.SOCK_STREAM)
|
||||
s = (socket._socketobject if hasattr(socket, "_socketobject") else socket.socket)(socket.AF_INET, socket.SOCK_STREAM)
|
||||
s.settimeout(0.1)
|
||||
s.connect(("127.0.0.1", port))
|
||||
# Tor responds uniquely to HTTP-like requests
|
||||
s.send("GET\n")
|
||||
if "Tor is not an HTTP Proxy" in s.recv(1024):
|
||||
s.send(b"GET\n")
|
||||
if b"Tor is not an HTTP Proxy" in s.recv(1024):
|
||||
return True
|
||||
except socket.error:
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user