mercurial/hgweb/hgweb_mod.py
changeset 36811 cfb9ef24968c
parent 36810 886fba199022
child 36812 158d4ecc03c8
equal deleted inserted replaced
36810:886fba199022 36811:cfb9ef24968c
   316             # replace it.
   316             # replace it.
   317             wsgireq.headers = [h for h in wsgireq.headers
   317             wsgireq.headers = [h for h in wsgireq.headers
   318                                if h[0] != 'Content-Security-Policy']
   318                                if h[0] != 'Content-Security-Policy']
   319             wsgireq.headers.append(('Content-Security-Policy', rctx.csp))
   319             wsgireq.headers.append(('Content-Security-Policy', rctx.csp))
   320 
   320 
   321         if r'PATH_INFO' in wsgireq.env:
   321         if req.havepathinfo:
   322             parts = wsgireq.env[r'PATH_INFO'].strip(r'/').split(r'/')
   322             query = req.dispatchpath
   323             repo_parts = wsgireq.env.get(r'REPO_NAME', r'').split(r'/')
       
   324             if parts[:len(repo_parts)] == repo_parts:
       
   325                 parts = parts[len(repo_parts):]
       
   326             query = r'/'.join(parts)
       
   327         else:
   323         else:
   328             query = wsgireq.env[r'QUERY_STRING'].partition(r'&')[0]
   324             query = req.querystring.partition('&')[0].partition(';')[0]
   329             query = query.partition(r';')[0]
       
   330 
   325 
   331         # Route it to a wire protocol handler if it looks like a wire protocol
   326         # Route it to a wire protocol handler if it looks like a wire protocol
   332         # request.
   327         # request.
   333         protohandler = wireprotoserver.parsehttprequest(rctx, wsgireq, req,
   328         protohandler = wireprotoserver.parsehttprequest(rctx, wsgireq, req,
   334                                                         self.check_perm)
   329                                                         self.check_perm)
   342             except ErrorResponse as inst:
   337             except ErrorResponse as inst:
   343                 return protohandler['handleerror'](inst)
   338                 return protohandler['handleerror'](inst)
   344 
   339 
   345         # translate user-visible url structure to internal structure
   340         # translate user-visible url structure to internal structure
   346 
   341 
   347         args = query.split(r'/', 2)
   342         args = query.split('/', 2)
   348         if 'cmd' not in wsgireq.form and args and args[0]:
   343         if 'cmd' not in wsgireq.form and args and args[0]:
   349             cmd = args.pop(0)
   344             cmd = args.pop(0)
   350             style = cmd.rfind('-')
   345             style = cmd.rfind('-')
   351             if style != -1:
   346             if style != -1:
   352                 wsgireq.form['style'] = [cmd[:style]]
   347                 wsgireq.form['style'] = [cmd[:style]]