diff -r cfb9ef24968c -r 158d4ecc03c8 mercurial/hgweb/hgweb_mod.py --- a/mercurial/hgweb/hgweb_mod.py Thu Mar 08 15:37:05 2018 -0800 +++ b/mercurial/hgweb/hgweb_mod.py Thu Mar 08 15:58:52 2018 -0800 @@ -318,25 +318,16 @@ if h[0] != 'Content-Security-Policy'] wsgireq.headers.append(('Content-Security-Policy', rctx.csp)) + handled, res = wireprotoserver.handlewsgirequest( + rctx, wsgireq, req, self.check_perm) + if handled: + return res + if req.havepathinfo: query = req.dispatchpath else: query = req.querystring.partition('&')[0].partition(';')[0] - # Route it to a wire protocol handler if it looks like a wire protocol - # request. - protohandler = wireprotoserver.parsehttprequest(rctx, wsgireq, req, - self.check_perm) - - if protohandler: - try: - if query: - raise ErrorResponse(HTTP_NOT_FOUND) - - return protohandler['dispatch']() - except ErrorResponse as inst: - return protohandler['handleerror'](inst) - # translate user-visible url structure to internal structure args = query.split('/', 2)