def __call__(self, environ, start_response): req = HTTPRequest(environ) req.params = {} for k, v in req.arguments.items(): req.params[k] = next(iter(v)) path = req.path[:] if not path.startswith('/'): path = urlsplit(path).path target = path[1:].replace('/', '_') method = getattr(self, target, self.index) resp = method(req) if dict(resp.headers).get('Connection') == 'close': # FIXME: Can we kill the connection somehow? pass return resp(environ, start_response)
def __call__(self, environ, start_response): """ Call the correct method in this class based on the incoming URI """ req = HTTPRequest(environ) req.params = {} for k, v in req.arguments.items(): req.params[k] = next(iter(v)) path = req.path[:] if not path.startswith("/"): path = urlsplit(path).path target = path[1:].replace("/", "_") method = getattr(self, target, self.index) resp = method(req) if dict(resp.headers).get("Connection") == "close": # FIXME: Can we kill the connection somehow? pass return resp(environ, start_response)