diff options
author | GammaC0de <GammaC0de@users.noreply.github.com> | 2015-05-09 21:38:09 +0200 |
---|---|---|
committer | GammaC0de <GammaC0de@users.noreply.github.com> | 2015-05-09 21:38:09 +0200 |
commit | c4810d1dbf367c4859a00c18b640fdb86a18ff8f (patch) | |
tree | 3bbfa55bfebc314db3edbc08e32b406ab21b646a | |
parent | [MultiHook] Remove unbound method 'getCrypters' (diff) | |
download | pyload-c4810d1dbf367c4859a00c18b640fdb86a18ff8f.tar.xz |
[ClickAndLoad] fix bug when webinterface uses SSL
-rw-r--r-- | module/plugins/hooks/ClickAndLoad.py | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/module/plugins/hooks/ClickAndLoad.py b/module/plugins/hooks/ClickAndLoad.py index 2ddd66daa..1fa89840b 100644 --- a/module/plugins/hooks/ClickAndLoad.py +++ b/module/plugins/hooks/ClickAndLoad.py @@ -3,6 +3,11 @@ import socket import time +try: + import ssl +except ImportError: + pass + from threading import Lock from module.plugins.Hook import Hook, threaded @@ -24,7 +29,7 @@ def forward(source, destination): class ClickAndLoad(Hook): __name__ = "ClickAndLoad" __type__ = "hook" - __version__ = "0.41" + __version__ = "0.42" __config__ = [("activated", "bool", "Activated" , True), ("port" , "int" , "Port" , 9666), @@ -79,6 +84,21 @@ class ClickAndLoad(Hook): self.logDebug("Connection from %s:%s" % client_addr) server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + + if self.config['webinterface']['https']: + try: + server_socket = ssl.wrap_socket(server_socket) + + except NameError: + self.logError(_("pyLoad's webinterface is configured to use HTTPS, Please install python's ssl lib or + client_socket.close() #: reset the connection. + continue + + except Exception, e: + self.logError(_("SSL error: %s") % e.message) + client_socket.close() #: reset the connection. + continue + server_socket.connect(("127.0.0.1", webport)) self.manager.startThread(forward, client_socket, server_socket) |