diff options
Diffstat (limited to 'src/acit')
| -rw-r--r-- | src/acit/__init__.py | 17 | ||||
| -rw-r--r-- | src/acit/web.py | 29 |
2 files changed, 35 insertions, 11 deletions
diff --git a/src/acit/__init__.py b/src/acit/__init__.py index ac96935..b41abe5 100644 --- a/src/acit/__init__.py +++ b/src/acit/__init__.py @@ -3,7 +3,7 @@ from os import getenv import cherrypy -from .web import Server +from .web import Server, SecureServer from .imapplugin import ImapPlugin from .db import DBPoolManager @@ -25,11 +25,24 @@ def run(): server=Server(dbpool=db,site=site,imap=imap) + + secureserver=SecureServer(server) + + securepath=getenv("ACIT_SECURE_PATH","/secure/") + if not securepath.startswith('/'): + securepath='/'+securepath + + cherrypy.tree.mount(secureserver,securepath,{ + '/':{ + 'tools.sessions.on':True, + } + }) + cherrypy.quickstart(server,'/',{ 'global':{ 'server.socket_host':'0.0.0.0', 'tools.proxy.on':True if getenv("ACIT_BEHIND_PROXY") else False - } + }, }) diff --git a/src/acit/web.py b/src/acit/web.py index 0410f24..a0b6a8e 100644 --- a/src/acit/web.py +++ b/src/acit/web.py @@ -38,15 +38,14 @@ class Server(): @cherrypy.expose - def index(self,quote="nothing"): - import threading - self.site.update_trackers() - cherrypy.log("Listing threads:") - for thread in threading.enumerate(): - cherrypy.log(repr(thread)) - cherrypy.log("Threads holding an IMAP connection:") - for thread in self.imap.mbpool.holding_threads: - cherrypy.log(repr(thread)) + def index(self): + #import threading + #cherrypy.log("Listing threads:") + #for thread in threading.enumerate(): + # cherrypy.log(repr(thread)) + #cherrypy.log("Threads holding an IMAP connection:") + #for thread in self.imap.mbpool.holding_threads: + # cherrypy.log(repr(thread)) from os import getenv raise cherrypy.HTTPRedirect(getenv("ACIT_HOME_REDIRECT","about:blank"),303) @@ -70,3 +69,15 @@ class Server(): return page +class SecureServer(): + def __init__(self,server:Server): + self.site=server.site + self.dbpool=server.dbpool + self.imap=server.imap + + @cherrypy.expose + def index(self): + return "Secure." + #raise cherrypy.HTTPRedirect("/",303) + + |
