summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Wagner <bwgpro@gmail.com>2015-06-03 17:36:25 -0300
committerBruno Wagner <bwgpro@gmail.com>2015-06-03 17:36:25 -0300
commit71cf8ea8469297494c9f010cb4fa607b9656500a (patch)
tree1a32c31f45de7b4b32830c15f639d7222de14832
parent8bde936220ed6330c032f6a60335fec54a5138d8 (diff)
Removed unused redirect to ssl and moved reactor listens one place up in the tree, to remove them from the app in the future
-rw-r--r--service/pixelated/config/app_factory.py23
1 files changed, 2 insertions, 21 deletions
diff --git a/service/pixelated/config/app_factory.py b/service/pixelated/config/app_factory.py
index c74a46f7..6db14885 100644
--- a/service/pixelated/config/app_factory.py
+++ b/service/pixelated/config/app_factory.py
@@ -134,13 +134,9 @@ def create_app(leap_home, leap_session, host, port, sslkey=None, sslcert=None):
resource = RootResource()
init_app(resource, leap_home, leap_session)
if sslkey and sslcert:
- listen_with_ssl(resource, host, port, sslkey, sslcert)
+ reactor.listenSSL(port, Site(resource), _ssl_options(sslkey, sslcert), interface=host)
else:
- listen_without_ssl(resource, host, port)
-
-
-def listen_without_ssl(resource, host, port):
- reactor.listenTCP(port, Site(resource), interface=host)
+ reactor.listenTCP(port, Site(resource), interface=host)
def _ssl_options(sslkey, sslcert):
@@ -156,18 +152,3 @@ def _ssl_options(sslkey, sslcert):
method=SSL.TLSv1_2_METHOD,
acceptableCiphers=acceptable)
return options
-
-
-def listen_with_ssl(resource, host, port, sslkey, sslcert):
- reactor.listenSSL(port, Site(resource), _ssl_options(sslkey, sslcert), interface=host)
-
-
-class RedirectToSSL(resource.Resource):
- isLeaf = True
-
- def __init__(self, ssl_port):
- self.ssl_port = ssl_port
-
- def render_GET(self, request):
- host = request.getHost().host
- return redirectTo("https://%s:%s" % (host, self.ssl_port), request)