summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-05-09 22:21:02 +0200
committerGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-05-09 22:21:02 +0200
commiteea28561643ca2baa612d0dbdc0be5080924ecde (patch)
tree3bbfa55bfebc314db3edbc08e32b406ab21b646a
parent[MultiHook] Remove unbound method 'getCrypters' (diff)
parent[ClickAndLoad] fix bug when webinterface uses SSL (diff)
downloadpyload-eea28561643ca2baa612d0dbdc0be5080924ecde.tar.xz
Merge pull request #1405 from GammaC0de/GammaC0de-ClickAndLoad-SSL
[ClickAndLoad] fix bug when webinterface uses SSL
-rw-r--r--module/plugins/hooks/ClickAndLoad.py22
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)