##// END OF EJS Templates
hgweb: use parsed request to construct query parameters...
Gregory Szorc -
r36829:cfb9ef24 default
parent child Browse files
Show More
@@ -318,15 +318,10 b' class hgweb(object):'
318 318 if h[0] != 'Content-Security-Policy']
319 319 wsgireq.headers.append(('Content-Security-Policy', rctx.csp))
320 320
321 if r'PATH_INFO' in wsgireq.env:
322 parts = wsgireq.env[r'PATH_INFO'].strip(r'/').split(r'/')
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)
321 if req.havepathinfo:
322 query = req.dispatchpath
327 323 else:
328 query = wsgireq.env[r'QUERY_STRING'].partition(r'&')[0]
329 query = query.partition(r';')[0]
324 query = req.querystring.partition('&')[0].partition(';')[0]
330 325
331 326 # Route it to a wire protocol handler if it looks like a wire protocol
332 327 # request.
@@ -344,7 +339,7 b' class hgweb(object):'
344 339
345 340 # translate user-visible url structure to internal structure
346 341
347 args = query.split(r'/', 2)
342 args = query.split('/', 2)
348 343 if 'cmd' not in wsgireq.form and args and args[0]:
349 344 cmd = args.pop(0)
350 345 style = cmd.rfind('-')
@@ -76,6 +76,9 b' class parsedrequest(object):'
76 76 dispatchparts = attr.ib()
77 77 # URL path component (no query string) used for dispatch.
78 78 dispatchpath = attr.ib()
79 # Whether there is a path component to this request. This can be true
80 # when ``dispatchpath`` is empty due to REPO_NAME muckery.
81 havepathinfo = attr.ib()
79 82 # Raw query string (part after "?" in URL).
80 83 querystring = attr.ib()
81 84 # List of 2-tuples of query string arguments.
@@ -188,6 +191,7 b' def parserequestfromenv(env):'
188 191 advertisedbaseurl=advertisedbaseurl,
189 192 apppath=apppath,
190 193 dispatchparts=dispatchparts, dispatchpath=dispatchpath,
194 havepathinfo='PATH_INFO' in env,
191 195 querystring=querystring,
192 196 querystringlist=querystringlist,
193 197 querystringdict=querystringdict)
General Comments 0
You need to be logged in to leave comments. Login now