339 req.qsparams['style'] = cmd[:style] |
339 req.qsparams['style'] = cmd[:style] |
340 cmd = cmd[style + 1:] |
340 cmd = cmd[style + 1:] |
341 |
341 |
342 # avoid accepting e.g. style parameter as command |
342 # avoid accepting e.g. style parameter as command |
343 if util.safehasattr(webcommands, cmd): |
343 if util.safehasattr(webcommands, cmd): |
344 wsgireq.form['cmd'] = [cmd] |
|
345 req.qsparams['cmd'] = cmd |
344 req.qsparams['cmd'] = cmd |
346 |
345 |
347 if cmd == 'static': |
346 if cmd == 'static': |
348 wsgireq.form['file'] = ['/'.join(args)] |
|
349 req.qsparams['file'] = '/'.join(args) |
347 req.qsparams['file'] = '/'.join(args) |
350 else: |
348 else: |
351 if args and args[0]: |
349 if args and args[0]: |
352 node = args.pop(0).replace('%2F', '/') |
350 node = args.pop(0).replace('%2F', '/') |
353 wsgireq.form['node'] = [node] |
|
354 req.qsparams['node'] = node |
351 req.qsparams['node'] = node |
355 if args: |
352 if args: |
356 wsgireq.form['file'] = args |
|
357 if 'file' in req.qsparams: |
353 if 'file' in req.qsparams: |
358 del req.qsparams['file'] |
354 del req.qsparams['file'] |
359 for a in args: |
355 for a in args: |
360 req.qsparams.add('file', a) |
356 req.qsparams.add('file', a) |
361 |
357 |
366 if cmd == 'archive': |
362 if cmd == 'archive': |
367 fn = req.qsparams['node'] |
363 fn = req.qsparams['node'] |
368 for type_, spec in rctx.archivespecs.iteritems(): |
364 for type_, spec in rctx.archivespecs.iteritems(): |
369 ext = spec[2] |
365 ext = spec[2] |
370 if fn.endswith(ext): |
366 if fn.endswith(ext): |
371 wsgireq.form['node'] = [fn[:-len(ext)]] |
|
372 req.qsparams['node'] = fn[:-len(ext)] |
367 req.qsparams['node'] = fn[:-len(ext)] |
373 wsgireq.form['type'] = [type_] |
|
374 req.qsparams['type'] = type_ |
368 req.qsparams['type'] = type_ |
375 else: |
369 else: |
376 cmd = req.qsparams.get('cmd', '') |
370 cmd = req.qsparams.get('cmd', '') |
377 |
371 |
378 # process the web interface request |
372 # process the web interface request |
385 # check read permissions non-static content |
379 # check read permissions non-static content |
386 if cmd != 'static': |
380 if cmd != 'static': |
387 self.check_perm(rctx, wsgireq, None) |
381 self.check_perm(rctx, wsgireq, None) |
388 |
382 |
389 if cmd == '': |
383 if cmd == '': |
390 wsgireq.form['cmd'] = [tmpl.cache['default']] |
|
391 req.qsparams['cmd'] = tmpl.cache['default'] |
384 req.qsparams['cmd'] = tmpl.cache['default'] |
392 cmd = req.qsparams['cmd'] |
385 cmd = req.qsparams['cmd'] |
393 |
386 |
394 # Don't enable caching if using a CSP nonce because then it wouldn't |
387 # Don't enable caching if using a CSP nonce because then it wouldn't |
395 # be a nonce. |
388 # be a nonce. |