##// 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 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.
@@ -344,7 +339,7 b' class hgweb(object):'
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('-')
@@ -76,6 +76,9 b' class parsedrequest(object):'
76 dispatchparts = attr.ib()
76 dispatchparts = attr.ib()
77 # URL path component (no query string) used for dispatch.
77 # URL path component (no query string) used for dispatch.
78 dispatchpath = attr.ib()
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 # Raw query string (part after "?" in URL).
82 # Raw query string (part after "?" in URL).
80 querystring = attr.ib()
83 querystring = attr.ib()
81 # List of 2-tuples of query string arguments.
84 # List of 2-tuples of query string arguments.
@@ -188,6 +191,7 b' def parserequestfromenv(env):'
188 advertisedbaseurl=advertisedbaseurl,
191 advertisedbaseurl=advertisedbaseurl,
189 apppath=apppath,
192 apppath=apppath,
190 dispatchparts=dispatchparts, dispatchpath=dispatchpath,
193 dispatchparts=dispatchparts, dispatchpath=dispatchpath,
194 havepathinfo='PATH_INFO' in env,
191 querystring=querystring,
195 querystring=querystring,
192 querystringlist=querystringlist,
196 querystringlist=querystringlist,
193 querystringdict=querystringdict)
197 querystringdict=querystringdict)
General Comments 0
You need to be logged in to leave comments. Login now