annotate tests/test-debugextensions.t @ 37048:fc5e261915b9

wireproto: require POST for all HTTPv2 requests Wire protocol version 1 transfers argument data via request headers by default. This has historically caused problems because servers institute limits on the length of individual HTTP headers as well as the total size of all request headers. Mercurial servers can advertise the maximum length of an individual header. But there's no guarantee any intermediate HTTP agents will accept headers up to that length. In the existing wire protocol, server operators typically also key off the HTTP request method to implement authentication. For example, GET requests translate to read-only requests and can be allowed. But read-write commands must use POST and require authentication. This has typically worked because the only wire protocol commands that use POST modify the repo (e.g. the "unbundle" command). There is an experimental feature to enable clients to transmit argument data via POST request bodies. This is technically a better and more robust solution. But we can't enable it by default because of servers assuming POST means write access. In version 2 of the wire protocol, the permissions of a request are encoded in the URL. And with it being a new protocol in a new URL space, we're not constrained by backwards compatibility requirements. This commit adopts the technically superior mechanism of using HTTP request bodies to send argument data by requiring POST for all commands. Strictly speaking, it may be possible to send request bodies on GET requests. But my experience is that not all HTTP stacks support this. POST pretty much always works. Using POST for read-only operations does sacrifice some RESTful design purity. But this API cares about practicality, not about being in Roy T. Fielding's REST ivory tower. There's a chance we may relax this restriction in the future. But for now, I want to see how far we can get with a POST only API. Differential Revision: https://phab.mercurial-scm.org/D2837
author Gregory Szorc <gregory.szorc@gmail.com>
date Tue, 13 Mar 2018 11:57:43 -0700
parents 19ec5da944d5
children 4e6a6d0dccee
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
26351
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
1 $ hg debugextensions
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
2
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
3 $ debugpath=`pwd`/extwithoutinfos.py
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
4
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
5 $ cat > extwithoutinfos.py <<EOF
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
6 > EOF
29891
ca6940515485 test-debugextensions: add dummy extension to make ifcontains() test more solid
Yuya Nishihara <yuya@tcha.org>
parents: 29703
diff changeset
7 $ cat > extwithinfos.py <<EOF
36567
19ec5da944d5 py3: add missing b prefixes in test-debugextensions.t
Augie Fackler <augie@google.com>
parents: 33525
diff changeset
8 > testedwith = b'3.0 3.1 3.2.1'
19ec5da944d5 py3: add missing b prefixes in test-debugextensions.t
Augie Fackler <augie@google.com>
parents: 33525
diff changeset
9 > buglink = b'https://example.org/bts'
29891
ca6940515485 test-debugextensions: add dummy extension to make ifcontains() test more solid
Yuya Nishihara <yuya@tcha.org>
parents: 29703
diff changeset
10 > EOF
26351
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
11
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
12 $ cat >> $HGRCPATH <<EOF
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
13 > [extensions]
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
14 > histedit=
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
15 > patchbomb=
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
16 > rebase=
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
17 > mq=
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
18 > ext1 = $debugpath
29891
ca6940515485 test-debugextensions: add dummy extension to make ifcontains() test more solid
Yuya Nishihara <yuya@tcha.org>
parents: 29703
diff changeset
19 > ext2 = `pwd`/extwithinfos.py
26351
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
20 > EOF
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
21
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
22 $ hg debugextensions
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
23 ext1 (untested!)
29891
ca6940515485 test-debugextensions: add dummy extension to make ifcontains() test more solid
Yuya Nishihara <yuya@tcha.org>
parents: 29703
diff changeset
24 ext2 (3.2.1!)
26351
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
25 histedit
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
26 mq
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
27 patchbomb
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
28 rebase
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
29
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
30 $ hg debugextensions -v
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
31 ext1
28615
a6573503342d test-debugextensions: passes with byte-compilation disabled (issue5147)
Kevin Bullock <kbullock@ringworld.org>
parents: 26430
diff changeset
32 location: */extwithoutinfos.py* (glob)
29892
b64eaf947632 debugextensions: show ships-with-hg-core state as a separate field
Yuya Nishihara <yuya@tcha.org>
parents: 29891
diff changeset
33 bundled: no
29891
ca6940515485 test-debugextensions: add dummy extension to make ifcontains() test more solid
Yuya Nishihara <yuya@tcha.org>
parents: 29703
diff changeset
34 ext2
ca6940515485 test-debugextensions: add dummy extension to make ifcontains() test more solid
Yuya Nishihara <yuya@tcha.org>
parents: 29703
diff changeset
35 location: */extwithinfos.py* (glob)
29892
b64eaf947632 debugextensions: show ships-with-hg-core state as a separate field
Yuya Nishihara <yuya@tcha.org>
parents: 29891
diff changeset
36 bundled: no
29891
ca6940515485 test-debugextensions: add dummy extension to make ifcontains() test more solid
Yuya Nishihara <yuya@tcha.org>
parents: 29703
diff changeset
37 tested with: 3.0 3.1 3.2.1
ca6940515485 test-debugextensions: add dummy extension to make ifcontains() test more solid
Yuya Nishihara <yuya@tcha.org>
parents: 29703
diff changeset
38 bug reporting: https://example.org/bts
26351
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
39 histedit
28615
a6573503342d test-debugextensions: passes with byte-compilation disabled (issue5147)
Kevin Bullock <kbullock@ringworld.org>
parents: 26430
diff changeset
40 location: */hgext/histedit.py* (glob)
29892
b64eaf947632 debugextensions: show ships-with-hg-core state as a separate field
Yuya Nishihara <yuya@tcha.org>
parents: 29891
diff changeset
41 bundled: yes
26351
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
42 mq
28615
a6573503342d test-debugextensions: passes with byte-compilation disabled (issue5147)
Kevin Bullock <kbullock@ringworld.org>
parents: 26430
diff changeset
43 location: */hgext/mq.py* (glob)
29892
b64eaf947632 debugextensions: show ships-with-hg-core state as a separate field
Yuya Nishihara <yuya@tcha.org>
parents: 29891
diff changeset
44 bundled: yes
26351
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
45 patchbomb
28615
a6573503342d test-debugextensions: passes with byte-compilation disabled (issue5147)
Kevin Bullock <kbullock@ringworld.org>
parents: 26430
diff changeset
46 location: */hgext/patchbomb.py* (glob)
29892
b64eaf947632 debugextensions: show ships-with-hg-core state as a separate field
Yuya Nishihara <yuya@tcha.org>
parents: 29891
diff changeset
47 bundled: yes
26351
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
48 rebase
28615
a6573503342d test-debugextensions: passes with byte-compilation disabled (issue5147)
Kevin Bullock <kbullock@ringworld.org>
parents: 26430
diff changeset
49 location: */hgext/rebase.py* (glob)
29892
b64eaf947632 debugextensions: show ships-with-hg-core state as a separate field
Yuya Nishihara <yuya@tcha.org>
parents: 29891
diff changeset
50 bundled: yes
26351
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
51
26430
1f8208a7277e test-debugextensions: sanitize JSON output for Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 26351
diff changeset
52 $ hg debugextensions -Tjson | sed 's|\\\\|/|g'
26351
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
53 [
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
54 {
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
55 "buglink": "",
29892
b64eaf947632 debugextensions: show ships-with-hg-core state as a separate field
Yuya Nishihara <yuya@tcha.org>
parents: 29891
diff changeset
56 "bundled": false,
26351
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
57 "name": "ext1",
28615
a6573503342d test-debugextensions: passes with byte-compilation disabled (issue5147)
Kevin Bullock <kbullock@ringworld.org>
parents: 26430
diff changeset
58 "source": "*/extwithoutinfos.py*", (glob)
29703
3ef9aa7ad1fc debugextension: change "testedwith" to a list (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 28615
diff changeset
59 "testedwith": []
26351
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
60 },
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
61 {
29891
ca6940515485 test-debugextensions: add dummy extension to make ifcontains() test more solid
Yuya Nishihara <yuya@tcha.org>
parents: 29703
diff changeset
62 "buglink": "https://example.org/bts",
29892
b64eaf947632 debugextensions: show ships-with-hg-core state as a separate field
Yuya Nishihara <yuya@tcha.org>
parents: 29891
diff changeset
63 "bundled": false,
29891
ca6940515485 test-debugextensions: add dummy extension to make ifcontains() test more solid
Yuya Nishihara <yuya@tcha.org>
parents: 29703
diff changeset
64 "name": "ext2",
ca6940515485 test-debugextensions: add dummy extension to make ifcontains() test more solid
Yuya Nishihara <yuya@tcha.org>
parents: 29703
diff changeset
65 "source": "*/extwithinfos.py*", (glob)
ca6940515485 test-debugextensions: add dummy extension to make ifcontains() test more solid
Yuya Nishihara <yuya@tcha.org>
parents: 29703
diff changeset
66 "testedwith": ["3.0", "3.1", "3.2.1"]
ca6940515485 test-debugextensions: add dummy extension to make ifcontains() test more solid
Yuya Nishihara <yuya@tcha.org>
parents: 29703
diff changeset
67 },
ca6940515485 test-debugextensions: add dummy extension to make ifcontains() test more solid
Yuya Nishihara <yuya@tcha.org>
parents: 29703
diff changeset
68 {
26351
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
69 "buglink": "",
29892
b64eaf947632 debugextensions: show ships-with-hg-core state as a separate field
Yuya Nishihara <yuya@tcha.org>
parents: 29891
diff changeset
70 "bundled": true,
26351
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
71 "name": "histedit",
28615
a6573503342d test-debugextensions: passes with byte-compilation disabled (issue5147)
Kevin Bullock <kbullock@ringworld.org>
parents: 26430
diff changeset
72 "source": "*/hgext/histedit.py*", (glob)
29893
4c28ddda5d48 debugextensions: hide "ships-with-hg-core" magic string (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 29892
diff changeset
73 "testedwith": []
26351
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
74 },
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
75 {
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
76 "buglink": "",
29892
b64eaf947632 debugextensions: show ships-with-hg-core state as a separate field
Yuya Nishihara <yuya@tcha.org>
parents: 29891
diff changeset
77 "bundled": true,
26351
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
78 "name": "mq",
28615
a6573503342d test-debugextensions: passes with byte-compilation disabled (issue5147)
Kevin Bullock <kbullock@ringworld.org>
parents: 26430
diff changeset
79 "source": "*/hgext/mq.py*", (glob)
29893
4c28ddda5d48 debugextensions: hide "ships-with-hg-core" magic string (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 29892
diff changeset
80 "testedwith": []
26351
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
81 },
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
82 {
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
83 "buglink": "",
29892
b64eaf947632 debugextensions: show ships-with-hg-core state as a separate field
Yuya Nishihara <yuya@tcha.org>
parents: 29891
diff changeset
84 "bundled": true,
26351
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
85 "name": "patchbomb",
28615
a6573503342d test-debugextensions: passes with byte-compilation disabled (issue5147)
Kevin Bullock <kbullock@ringworld.org>
parents: 26430
diff changeset
86 "source": "*/hgext/patchbomb.py*", (glob)
29893
4c28ddda5d48 debugextensions: hide "ships-with-hg-core" magic string (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 29892
diff changeset
87 "testedwith": []
26351
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
88 },
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
89 {
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
90 "buglink": "",
29892
b64eaf947632 debugextensions: show ships-with-hg-core state as a separate field
Yuya Nishihara <yuya@tcha.org>
parents: 29891
diff changeset
91 "bundled": true,
26351
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
92 "name": "rebase",
28615
a6573503342d test-debugextensions: passes with byte-compilation disabled (issue5147)
Kevin Bullock <kbullock@ringworld.org>
parents: 26430
diff changeset
93 "source": "*/hgext/rebase.py*", (glob)
29893
4c28ddda5d48 debugextensions: hide "ships-with-hg-core" magic string (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 29892
diff changeset
94 "testedwith": []
26351
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
95 }
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
96 ]
29703
3ef9aa7ad1fc debugextension: change "testedwith" to a list (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 28615
diff changeset
97
29891
ca6940515485 test-debugextensions: add dummy extension to make ifcontains() test more solid
Yuya Nishihara <yuya@tcha.org>
parents: 29703
diff changeset
98 $ hg debugextensions -T '{ifcontains("3.1", testedwith, "{name}\n")}'
ca6940515485 test-debugextensions: add dummy extension to make ifcontains() test more solid
Yuya Nishihara <yuya@tcha.org>
parents: 29703
diff changeset
99 ext2
ca6940515485 test-debugextensions: add dummy extension to make ifcontains() test more solid
Yuya Nishihara <yuya@tcha.org>
parents: 29703
diff changeset
100 $ hg debugextensions \
ca6940515485 test-debugextensions: add dummy extension to make ifcontains() test more solid
Yuya Nishihara <yuya@tcha.org>
parents: 29703
diff changeset
101 > -T '{ifcontains("3.2", testedwith, "no substring match: {name}\n")}'