diff options
| author | tkikuchi | 2006-10-09 02:03:45 +0000 |
|---|---|---|
| committer | tkikuchi | 2006-10-09 02:03:45 +0000 |
| commit | 454e264245c2f24e7e5d32f9d31734cb23c99026 (patch) | |
| tree | edcfd0a6a2a0b5b02143b0c91d88ea7e85cd183d /Mailman/Queue | |
| parent | e22c46d9d4f440bf23d053f80954ab91928f33f7 (diff) | |
| download | mailman-454e264245c2f24e7e5d32f9d31734cb23c99026.tar.gz mailman-454e264245c2f24e7e5d32f9d31734cb23c99026.tar.zst mailman-454e264245c2f24e7e5d32f9d31734cb23c99026.zip | |
WSGI HTTP Server for Mailman Web interface.
Add: HTTPRunner.py ... Start/Restart/Stop HTTP Server under Runner framework.
wsgi_app.py ... WSGI to CGI wrapper. Mostly taken from scripts/driver.
loginit.py ... Add http log. Time stamp is duplicated :-(
Defaults.py ... HTTP_HOST and HTTP_PORT.
Note that WSGI server should be used under reverse proxy environment.
Diffstat (limited to 'Mailman/Queue')
| -rw-r--r-- | Mailman/Queue/HTTPRunner.py | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/Mailman/Queue/HTTPRunner.py b/Mailman/Queue/HTTPRunner.py new file mode 100644 index 000000000..df36db0d8 --- /dev/null +++ b/Mailman/Queue/HTTPRunner.py @@ -0,0 +1,63 @@ +# Copyright (C) 2006 by the Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +# USA. + +"""Mailman HTTP runner (server). + +""" + +import sys +import logging +import StringIO + +from wsgiref.simple_server import make_server, WSGIRequestHandler + +from Mailman.Queue.Runner import Runner +from Mailman.configuration import config +from Mailman.Cgi.wsgi_app import mailman_app + +hlog = logging.getLogger('mailman.http') +qlog = logging.getLogger('mailman.qrunner') + +class HTTPRunner(Runner): + + def __init__(self, slice=None, numslices=1): + pass + + def _cleanup(self): + pass + + +class MailmanWSGIRequestHandler(WSGIRequestHandler): + + def handle(self): + """Handle a single HTTP request with error output to elog""" + stderr = StringIO.StringIO() + save_stderr = sys.stderr + sys.stderr = stderr + WSGIRequestHandler.handle(self) + sys.stderr = save_stderr + hlog.info(stderr.getvalue().strip()) + + +server = make_server(config.HTTP_HOST, config.HTTP_PORT, + mailman_app, + handler_class=MailmanWSGIRequestHandler) +qlog.info('HTTPRunner qrunner started.') +server.serve_forever() +# We'll never get here, but just in case... +qlog.info('HTTPRunner qrunner exiting.') + |
