112 # protocol bits don't need to create any URLs |
112 # protocol bits don't need to create any URLs |
113 # and the clients always use the old URL structure |
113 # and the clients always use the old URL structure |
114 |
114 |
115 cmd = req.form.get('cmd', [''])[0] |
115 cmd = req.form.get('cmd', [''])[0] |
116 if protocol.iscmd(cmd): |
116 if protocol.iscmd(cmd): |
117 if query: |
117 try: |
118 raise ErrorResponse(HTTP_NOT_FOUND) |
118 if query: |
119 if cmd in perms: |
119 raise ErrorResponse(HTTP_NOT_FOUND) |
120 try: |
120 if cmd in perms: |
121 self.check_perm(req, perms[cmd]) |
121 self.check_perm(req, perms[cmd]) |
122 except ErrorResponse, inst: |
122 return protocol.call(self.repo, req, cmd) |
123 if cmd == 'unbundle': |
123 except ErrorResponse, inst: |
124 req.drain() |
124 if cmd == 'unbundle': |
125 req.respond(inst, protocol.HGTYPE) |
125 req.drain() |
126 return '0\n%s\n' % inst.message |
126 req.respond(inst, protocol.HGTYPE) |
127 return protocol.call(self.repo, req, cmd) |
127 return '0\n%s\n' % inst.message |
128 |
128 |
129 # translate user-visible url structure to internal structure |
129 # translate user-visible url structure to internal structure |
130 |
130 |
131 args = query.split('/', 2) |
131 args = query.split('/', 2) |
132 if 'cmd' not in req.form and args and args[0]: |
132 if 'cmd' not in req.form and args and args[0]: |