Show More
@@ -377,7 +377,7 b' class hgweb(object):' | |||||
377 | # translate user-visible url structure to internal structure |
|
377 | # translate user-visible url structure to internal structure | |
378 |
|
378 | |||
379 | args = query.split('/', 2) |
|
379 | args = query.split('/', 2) | |
380 |
if |
|
380 | if 'cmd' not in req.form and args and args[0]: | |
381 | cmd = args.pop(0) |
|
381 | cmd = args.pop(0) | |
382 | style = cmd.rfind('-') |
|
382 | style = cmd.rfind('-') | |
383 | if style != -1: |
|
383 | if style != -1: | |
@@ -386,7 +386,7 b' class hgweb(object):' | |||||
386 |
|
386 | |||
387 | # avoid accepting e.g. style parameter as command |
|
387 | # avoid accepting e.g. style parameter as command | |
388 | if util.safehasattr(webcommands, cmd): |
|
388 | if util.safehasattr(webcommands, cmd): | |
389 |
req.form[ |
|
389 | req.form['cmd'] = [cmd] | |
390 |
|
390 | |||
391 | if cmd == 'static': |
|
391 | if cmd == 'static': | |
392 | req.form['file'] = ['/'.join(args)] |
|
392 | req.form['file'] = ['/'.join(args)] | |
@@ -409,7 +409,7 b' class hgweb(object):' | |||||
409 | req.form['node'] = [fn[:-len(ext)]] |
|
409 | req.form['node'] = [fn[:-len(ext)]] | |
410 | req.form['type'] = [type_] |
|
410 | req.form['type'] = [type_] | |
411 | else: |
|
411 | else: | |
412 |
cmd = |
|
412 | cmd = req.form.get('cmd', [''])[0] | |
413 |
|
413 | |||
414 | # process the web interface request |
|
414 | # process the web interface request | |
415 |
|
415 | |||
@@ -423,8 +423,8 b' class hgweb(object):' | |||||
423 | self.check_perm(rctx, req, None) |
|
423 | self.check_perm(rctx, req, None) | |
424 |
|
424 | |||
425 | if cmd == '': |
|
425 | if cmd == '': | |
426 |
req.form[ |
|
426 | req.form['cmd'] = [tmpl.cache['default']] | |
427 |
cmd = req.form[ |
|
427 | cmd = req.form['cmd'][0] | |
428 |
|
428 | |||
429 | # Don't enable caching if using a CSP nonce because then it wouldn't |
|
429 | # Don't enable caching if using a CSP nonce because then it wouldn't | |
430 | # be a nonce. |
|
430 | # be a nonce. | |
@@ -433,7 +433,7 b' class hgweb(object):' | |||||
433 | if cmd not in webcommands.__all__: |
|
433 | if cmd not in webcommands.__all__: | |
434 | msg = 'no such method: %s' % cmd |
|
434 | msg = 'no such method: %s' % cmd | |
435 | raise ErrorResponse(HTTP_BAD_REQUEST, msg) |
|
435 | raise ErrorResponse(HTTP_BAD_REQUEST, msg) | |
436 |
elif cmd == 'file' and |
|
436 | elif cmd == 'file' and 'raw' in req.form.get('style', []): | |
437 | rctx.ctype = ctype |
|
437 | rctx.ctype = ctype | |
438 | content = webcommands.rawfile(rctx, req, tmpl) |
|
438 | content = webcommands.rawfile(rctx, req, tmpl) | |
439 | else: |
|
439 | else: |
@@ -48,9 +48,11 b' def normalize(form):' | |||||
48 | form[name] = value |
|
48 | form[name] = value | |
49 | del form[k] |
|
49 | del form[k] | |
50 | # And strip the values |
|
50 | # And strip the values | |
|
51 | bytesform = {} | |||
51 | for k, v in form.iteritems(): |
|
52 | for k, v in form.iteritems(): | |
52 | form[k] = [i.strip() for i in v] |
|
53 | bytesform[pycompat.bytesurl(k)] = [ | |
53 | return form |
|
54 | pycompat.bytesurl(i.strip()) for i in v] | |
|
55 | return bytesform | |||
54 |
|
56 | |||
55 | class wsgirequest(object): |
|
57 | class wsgirequest(object): | |
56 | """Higher-level API for a WSGI request. |
|
58 | """Higher-level API for a WSGI request. |
@@ -159,10 +159,10 b' def parsehttprequest(repo, req, query):' | |||||
159 | # HTTP version 1 wire protocol requests are denoted by a "cmd" query |
|
159 | # HTTP version 1 wire protocol requests are denoted by a "cmd" query | |
160 | # string parameter. If it isn't present, this isn't a wire protocol |
|
160 | # string parameter. If it isn't present, this isn't a wire protocol | |
161 | # request. |
|
161 | # request. | |
162 |
if |
|
162 | if 'cmd' not in req.form: | |
163 | return None |
|
163 | return None | |
164 |
|
164 | |||
165 |
cmd = |
|
165 | cmd = req.form['cmd'][0] | |
166 |
|
166 | |||
167 | # The "cmd" request parameter is used by both the wire protocol and hgweb. |
|
167 | # The "cmd" request parameter is used by both the wire protocol and hgweb. | |
168 | # While not all wire protocol commands are available for all transports, |
|
168 | # While not all wire protocol commands are available for all transports, |
General Comments 0
You need to be logged in to leave comments.
Login now