Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: multiplexer.fcgi

Issue 6209629180657664: Issue 2169 - Unify development and production implementation of multiplexer (Closed)
Patch Set: Created March 23, 2015, 4:23 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | multiplexer.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: multiplexer.fcgi
===================================================================
--- a/multiplexer.fcgi
+++ b/multiplexer.fcgi
@@ -18,29 +18,14 @@
import os, re
from flup.server.fcgi import WSGIServer
-from urlparse import urlparse
-from sitescripts.web import handlers
-
-class MultiplexerApp:
- def __call__(self, environ, start_response):
- if 'REQUEST_URI' in environ:
- request = urlparse(environ['REQUEST_URI'])
- if request.path in handlers:
- return handlers[request.path](environ, start_response)
-
- request_dir = re.sub(r'[^/]+$', '', request.path)
- if request_dir in handlers:
- return handlers[request_dir](environ, start_response)
-
- start_response('404 Not Found', [('Content-Type', 'text/html')])
- return ["Not Found"]
+from sitescripts.web import multiplex
bindAddress = None
if 'FCGI_BIND_ADDRESS' in os.environ:
match = re.match(r'^(.*?):(\d+)$', os.environ['FCGI_BIND_ADDRESS'])
bindAddress = (match.group(1), int(match.group(2)))
-srv = WSGIServer(MultiplexerApp(), debug=False, bindAddress=bindAddress)
+srv = WSGIServer(multiplex, debug=False, bindAddress=bindAddress)
if __name__ == '__main__':
srv.run()
« no previous file with comments | « no previous file | multiplexer.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld