Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/hgweb/hgweb_mod.py @ 36024:e69e65b2b4a9
hgweb: move call to protocol handler outside of try..except
The protocol handler doesn't raise ErrorResponse. So it doesn't
need to be in this `try..except ErrorResponse` block.
Differential Revision: https://phab.mercurial-scm.org/D2020
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Wed, 31 Jan 2018 16:43:46 -0800 |
parents | cdc93fe1da77 |
children | 98a00aa0288d |
comparison
equal
deleted
inserted
replaced
36023:cdc93fe1da77 | 36024:e69e65b2b4a9 |
---|---|
366 try: | 366 try: |
367 if query: | 367 if query: |
368 raise ErrorResponse(HTTP_NOT_FOUND) | 368 raise ErrorResponse(HTTP_NOT_FOUND) |
369 if cmd in perms: | 369 if cmd in perms: |
370 self.check_perm(rctx, req, perms[cmd]) | 370 self.check_perm(rctx, req, perms[cmd]) |
371 return protohandler['dispatch']() | |
372 except ErrorResponse as inst: | 371 except ErrorResponse as inst: |
373 # A client that sends unbundle without 100-continue will | 372 # A client that sends unbundle without 100-continue will |
374 # break if we respond early. | 373 # break if we respond early. |
375 if (cmd == 'unbundle' and | 374 if (cmd == 'unbundle' and |
376 (req.env.get('HTTP_EXPECT', | 375 (req.env.get('HTTP_EXPECT', |
380 else: | 379 else: |
381 req.headers.append((r'Connection', r'Close')) | 380 req.headers.append((r'Connection', r'Close')) |
382 req.respond(inst, wireprotoserver.HGTYPE, | 381 req.respond(inst, wireprotoserver.HGTYPE, |
383 body='0\n%s\n' % inst) | 382 body='0\n%s\n' % inst) |
384 return '' | 383 return '' |
384 | |
385 return protohandler['dispatch']() | |
385 | 386 |
386 # translate user-visible url structure to internal structure | 387 # translate user-visible url structure to internal structure |
387 | 388 |
388 args = query.split('/', 2) | 389 args = query.split('/', 2) |
389 if r'cmd' not in req.form and args and args[0]: | 390 if r'cmd' not in req.form and args and args[0]: |