equal
deleted
inserted
replaced
74 import mercurial.hgweb.wsgicgi as wsgicgi |
74 import mercurial.hgweb.wsgicgi as wsgicgi |
75 wsgicgi.launch(self) |
75 wsgicgi.launch(self) |
76 |
76 |
77 def __call__(self, env, respond): |
77 def __call__(self, env, respond): |
78 req = wsgirequest(env, respond) |
78 req = wsgirequest(env, respond) |
79 self.run_wsgi(req) |
79 return self.run_wsgi(req) |
80 return req |
|
81 |
80 |
82 def run_wsgi(self, req): |
81 def run_wsgi(self, req): |
83 |
82 |
84 self.refresh() |
83 self.refresh() |
85 |
84 |
88 # and the clients always use the old URL structure |
87 # and the clients always use the old URL structure |
89 |
88 |
90 cmd = req.form.get('cmd', [''])[0] |
89 cmd = req.form.get('cmd', [''])[0] |
91 if cmd and cmd in protocol.__all__: |
90 if cmd and cmd in protocol.__all__: |
92 if cmd in perms and not self.check_perm(req, perms[cmd]): |
91 if cmd in perms and not self.check_perm(req, perms[cmd]): |
93 return |
92 return [] |
94 method = getattr(protocol, cmd) |
93 method = getattr(protocol, cmd) |
95 method(self.repo, req) |
94 return method(self.repo, req) |
96 return |
|
97 |
95 |
98 # work with CGI variables to create coherent structure |
96 # work with CGI variables to create coherent structure |
99 # use SCRIPT_NAME, PATH_INFO and QUERY_STRING as well as our REPO_NAME |
97 # use SCRIPT_NAME, PATH_INFO and QUERY_STRING as well as our REPO_NAME |
100 |
98 |
101 req.url = req.env['SCRIPT_NAME'] |
99 req.url = req.env['SCRIPT_NAME'] |
169 content = getattr(webcommands, cmd)(self, req, tmpl) |
167 content = getattr(webcommands, cmd)(self, req, tmpl) |
170 req.respond(HTTP_OK, ctype) |
168 req.respond(HTTP_OK, ctype) |
171 |
169 |
172 req.write(content) |
170 req.write(content) |
173 del tmpl |
171 del tmpl |
|
172 return req |
174 |
173 |
175 except revlog.LookupError, err: |
174 except revlog.LookupError, err: |
176 req.respond(HTTP_NOT_FOUND, ctype) |
175 req.respond(HTTP_NOT_FOUND, ctype) |
177 msg = str(err) |
176 msg = str(err) |
178 if 'manifest' not in msg: |
177 if 'manifest' not in msg: |