##// END OF EJS Templates
tests: arrange for a server in wireproto-command-capabilities.t to be killed...
Matt Harbison -
r37779:ff6b0a20 default
parent child Browse files
Show More
@@ -1,247 +1,248
1 $ . $TESTDIR/wireprotohelpers.sh
1 $ . $TESTDIR/wireprotohelpers.sh
2
2
3 $ hg init server
3 $ hg init server
4 $ hg -R server serve -p $HGPORT -d --pid-file hg.pid -E error.log
4 $ hg -R server serve -p $HGPORT -d --pid-file hg.pid -E error.log
5 $ cat hg.pid > $DAEMON_PIDS
5 $ cat hg.pid > $DAEMON_PIDS
6
6
7 A normal capabilities request is serviced for version 1
7 A normal capabilities request is serviced for version 1
8
8
9 $ sendhttpraw << EOF
9 $ sendhttpraw << EOF
10 > httprequest GET ?cmd=capabilities
10 > httprequest GET ?cmd=capabilities
11 > user-agent: test
11 > user-agent: test
12 > EOF
12 > EOF
13 using raw connection to peer
13 using raw connection to peer
14 s> GET /?cmd=capabilities HTTP/1.1\r\n
14 s> GET /?cmd=capabilities HTTP/1.1\r\n
15 s> Accept-Encoding: identity\r\n
15 s> Accept-Encoding: identity\r\n
16 s> user-agent: test\r\n
16 s> user-agent: test\r\n
17 s> host: $LOCALIP:$HGPORT\r\n (glob)
17 s> host: $LOCALIP:$HGPORT\r\n (glob)
18 s> \r\n
18 s> \r\n
19 s> makefile('rb', None)
19 s> makefile('rb', None)
20 s> HTTP/1.1 200 Script output follows\r\n
20 s> HTTP/1.1 200 Script output follows\r\n
21 s> Server: testing stub value\r\n
21 s> Server: testing stub value\r\n
22 s> Date: $HTTP_DATE$\r\n
22 s> Date: $HTTP_DATE$\r\n
23 s> Content-Type: application/mercurial-0.1\r\n
23 s> Content-Type: application/mercurial-0.1\r\n
24 s> Content-Length: 458\r\n
24 s> Content-Length: 458\r\n
25 s> \r\n
25 s> \r\n
26 s> batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset compression=$BUNDLE2_COMPRESSIONS$ getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash
26 s> batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset compression=$BUNDLE2_COMPRESSIONS$ getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash
27
27
28 A proper request without the API server enabled returns the legacy response
28 A proper request without the API server enabled returns the legacy response
29
29
30 $ sendhttpraw << EOF
30 $ sendhttpraw << EOF
31 > httprequest GET ?cmd=capabilities
31 > httprequest GET ?cmd=capabilities
32 > user-agent: test
32 > user-agent: test
33 > x-hgupgrade-1: foo
33 > x-hgupgrade-1: foo
34 > x-hgproto-1: cbor
34 > x-hgproto-1: cbor
35 > EOF
35 > EOF
36 using raw connection to peer
36 using raw connection to peer
37 s> GET /?cmd=capabilities HTTP/1.1\r\n
37 s> GET /?cmd=capabilities HTTP/1.1\r\n
38 s> Accept-Encoding: identity\r\n
38 s> Accept-Encoding: identity\r\n
39 s> user-agent: test\r\n
39 s> user-agent: test\r\n
40 s> x-hgproto-1: cbor\r\n
40 s> x-hgproto-1: cbor\r\n
41 s> x-hgupgrade-1: foo\r\n
41 s> x-hgupgrade-1: foo\r\n
42 s> host: $LOCALIP:$HGPORT\r\n (glob)
42 s> host: $LOCALIP:$HGPORT\r\n (glob)
43 s> \r\n
43 s> \r\n
44 s> makefile('rb', None)
44 s> makefile('rb', None)
45 s> HTTP/1.1 200 Script output follows\r\n
45 s> HTTP/1.1 200 Script output follows\r\n
46 s> Server: testing stub value\r\n
46 s> Server: testing stub value\r\n
47 s> Date: $HTTP_DATE$\r\n
47 s> Date: $HTTP_DATE$\r\n
48 s> Content-Type: application/mercurial-0.1\r\n
48 s> Content-Type: application/mercurial-0.1\r\n
49 s> Content-Length: 458\r\n
49 s> Content-Length: 458\r\n
50 s> \r\n
50 s> \r\n
51 s> batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset compression=$BUNDLE2_COMPRESSIONS$ getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash
51 s> batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset compression=$BUNDLE2_COMPRESSIONS$ getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash
52
52
53 Restart with just API server enabled. This enables serving the new format.
53 Restart with just API server enabled. This enables serving the new format.
54
54
55 $ killdaemons.py
55 $ killdaemons.py
56 $ cat error.log
56 $ cat error.log
57
57
58 $ cat >> server/.hg/hgrc << EOF
58 $ cat >> server/.hg/hgrc << EOF
59 > [experimental]
59 > [experimental]
60 > web.apiserver = true
60 > web.apiserver = true
61 > EOF
61 > EOF
62
62
63 $ hg -R server serve -p $HGPORT -d --pid-file hg.pid -E error.log
63 $ hg -R server serve -p $HGPORT -d --pid-file hg.pid -E error.log
64 $ cat hg.pid > $DAEMON_PIDS
64 $ cat hg.pid > $DAEMON_PIDS
65
65
66 X-HgUpgrade-<N> without CBOR advertisement uses legacy response
66 X-HgUpgrade-<N> without CBOR advertisement uses legacy response
67
67
68 $ sendhttpraw << EOF
68 $ sendhttpraw << EOF
69 > httprequest GET ?cmd=capabilities
69 > httprequest GET ?cmd=capabilities
70 > user-agent: test
70 > user-agent: test
71 > x-hgupgrade-1: foo bar
71 > x-hgupgrade-1: foo bar
72 > EOF
72 > EOF
73 using raw connection to peer
73 using raw connection to peer
74 s> GET /?cmd=capabilities HTTP/1.1\r\n
74 s> GET /?cmd=capabilities HTTP/1.1\r\n
75 s> Accept-Encoding: identity\r\n
75 s> Accept-Encoding: identity\r\n
76 s> user-agent: test\r\n
76 s> user-agent: test\r\n
77 s> x-hgupgrade-1: foo bar\r\n
77 s> x-hgupgrade-1: foo bar\r\n
78 s> host: $LOCALIP:$HGPORT\r\n (glob)
78 s> host: $LOCALIP:$HGPORT\r\n (glob)
79 s> \r\n
79 s> \r\n
80 s> makefile('rb', None)
80 s> makefile('rb', None)
81 s> HTTP/1.1 200 Script output follows\r\n
81 s> HTTP/1.1 200 Script output follows\r\n
82 s> Server: testing stub value\r\n
82 s> Server: testing stub value\r\n
83 s> Date: $HTTP_DATE$\r\n
83 s> Date: $HTTP_DATE$\r\n
84 s> Content-Type: application/mercurial-0.1\r\n
84 s> Content-Type: application/mercurial-0.1\r\n
85 s> Content-Length: 458\r\n
85 s> Content-Length: 458\r\n
86 s> \r\n
86 s> \r\n
87 s> batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset compression=$BUNDLE2_COMPRESSIONS$ getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash
87 s> batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset compression=$BUNDLE2_COMPRESSIONS$ getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash
88
88
89 X-HgUpgrade-<N> without known serialization in X-HgProto-<N> uses legacy response
89 X-HgUpgrade-<N> without known serialization in X-HgProto-<N> uses legacy response
90
90
91 $ sendhttpraw << EOF
91 $ sendhttpraw << EOF
92 > httprequest GET ?cmd=capabilities
92 > httprequest GET ?cmd=capabilities
93 > user-agent: test
93 > user-agent: test
94 > x-hgupgrade-1: foo bar
94 > x-hgupgrade-1: foo bar
95 > x-hgproto-1: some value
95 > x-hgproto-1: some value
96 > EOF
96 > EOF
97 using raw connection to peer
97 using raw connection to peer
98 s> GET /?cmd=capabilities HTTP/1.1\r\n
98 s> GET /?cmd=capabilities HTTP/1.1\r\n
99 s> Accept-Encoding: identity\r\n
99 s> Accept-Encoding: identity\r\n
100 s> user-agent: test\r\n
100 s> user-agent: test\r\n
101 s> x-hgproto-1: some value\r\n
101 s> x-hgproto-1: some value\r\n
102 s> x-hgupgrade-1: foo bar\r\n
102 s> x-hgupgrade-1: foo bar\r\n
103 s> host: $LOCALIP:$HGPORT\r\n (glob)
103 s> host: $LOCALIP:$HGPORT\r\n (glob)
104 s> \r\n
104 s> \r\n
105 s> makefile('rb', None)
105 s> makefile('rb', None)
106 s> HTTP/1.1 200 Script output follows\r\n
106 s> HTTP/1.1 200 Script output follows\r\n
107 s> Server: testing stub value\r\n
107 s> Server: testing stub value\r\n
108 s> Date: $HTTP_DATE$\r\n
108 s> Date: $HTTP_DATE$\r\n
109 s> Content-Type: application/mercurial-0.1\r\n
109 s> Content-Type: application/mercurial-0.1\r\n
110 s> Content-Length: 458\r\n
110 s> Content-Length: 458\r\n
111 s> \r\n
111 s> \r\n
112 s> batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset compression=$BUNDLE2_COMPRESSIONS$ getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash
112 s> batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset compression=$BUNDLE2_COMPRESSIONS$ getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash
113
113
114 X-HgUpgrade-<N> + X-HgProto-<N> headers trigger new response format
114 X-HgUpgrade-<N> + X-HgProto-<N> headers trigger new response format
115
115
116 $ sendhttpraw << EOF
116 $ sendhttpraw << EOF
117 > httprequest GET ?cmd=capabilities
117 > httprequest GET ?cmd=capabilities
118 > user-agent: test
118 > user-agent: test
119 > x-hgupgrade-1: foo bar
119 > x-hgupgrade-1: foo bar
120 > x-hgproto-1: cbor
120 > x-hgproto-1: cbor
121 > EOF
121 > EOF
122 using raw connection to peer
122 using raw connection to peer
123 s> GET /?cmd=capabilities HTTP/1.1\r\n
123 s> GET /?cmd=capabilities HTTP/1.1\r\n
124 s> Accept-Encoding: identity\r\n
124 s> Accept-Encoding: identity\r\n
125 s> user-agent: test\r\n
125 s> user-agent: test\r\n
126 s> x-hgproto-1: cbor\r\n
126 s> x-hgproto-1: cbor\r\n
127 s> x-hgupgrade-1: foo bar\r\n
127 s> x-hgupgrade-1: foo bar\r\n
128 s> host: $LOCALIP:$HGPORT\r\n (glob)
128 s> host: $LOCALIP:$HGPORT\r\n (glob)
129 s> \r\n
129 s> \r\n
130 s> makefile('rb', None)
130 s> makefile('rb', None)
131 s> HTTP/1.1 200 OK\r\n
131 s> HTTP/1.1 200 OK\r\n
132 s> Server: testing stub value\r\n
132 s> Server: testing stub value\r\n
133 s> Date: $HTTP_DATE$\r\n
133 s> Date: $HTTP_DATE$\r\n
134 s> Content-Type: application/mercurial-cbor\r\n
134 s> Content-Type: application/mercurial-cbor\r\n
135 s> Content-Length: 496\r\n
135 s> Content-Length: 496\r\n
136 s> \r\n
136 s> \r\n
137 s> \xa3Dapis\xa0GapibaseDapi/Nv1capabilitiesY\x01\xcabatch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset compression=$BUNDLE2_COMPRESSIONS$ getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash
137 s> \xa3Dapis\xa0GapibaseDapi/Nv1capabilitiesY\x01\xcabatch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset compression=$BUNDLE2_COMPRESSIONS$ getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash
138 cbor> {b'apibase': b'api/', b'apis': {}, b'v1capabilities': b'batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset compression=$BUNDLE2_COMPRESSIONS$ getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash'}
138 cbor> {b'apibase': b'api/', b'apis': {}, b'v1capabilities': b'batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset compression=$BUNDLE2_COMPRESSIONS$ getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash'}
139
139
140 Restart server to enable HTTPv2
140 Restart server to enable HTTPv2
141
141
142 $ killdaemons.py
142 $ killdaemons.py
143 $ enablehttpv2 server
143 $ enablehttpv2 server
144 $ hg -R server serve -p $HGPORT -d --pid-file hg.pid -E error.log
144 $ hg -R server serve -p $HGPORT -d --pid-file hg.pid -E error.log
145 $ cat hg.pid > $DAEMON_PIDS
145
146
146 Only requested API services are returned
147 Only requested API services are returned
147
148
148 $ sendhttpraw << EOF
149 $ sendhttpraw << EOF
149 > httprequest GET ?cmd=capabilities
150 > httprequest GET ?cmd=capabilities
150 > user-agent: test
151 > user-agent: test
151 > x-hgupgrade-1: foo bar
152 > x-hgupgrade-1: foo bar
152 > x-hgproto-1: cbor
153 > x-hgproto-1: cbor
153 > EOF
154 > EOF
154 using raw connection to peer
155 using raw connection to peer
155 s> GET /?cmd=capabilities HTTP/1.1\r\n
156 s> GET /?cmd=capabilities HTTP/1.1\r\n
156 s> Accept-Encoding: identity\r\n
157 s> Accept-Encoding: identity\r\n
157 s> user-agent: test\r\n
158 s> user-agent: test\r\n
158 s> x-hgproto-1: cbor\r\n
159 s> x-hgproto-1: cbor\r\n
159 s> x-hgupgrade-1: foo bar\r\n
160 s> x-hgupgrade-1: foo bar\r\n
160 s> host: $LOCALIP:$HGPORT\r\n (glob)
161 s> host: $LOCALIP:$HGPORT\r\n (glob)
161 s> \r\n
162 s> \r\n
162 s> makefile('rb', None)
163 s> makefile('rb', None)
163 s> HTTP/1.1 200 OK\r\n
164 s> HTTP/1.1 200 OK\r\n
164 s> Server: testing stub value\r\n
165 s> Server: testing stub value\r\n
165 s> Date: $HTTP_DATE$\r\n
166 s> Date: $HTTP_DATE$\r\n
166 s> Content-Type: application/mercurial-cbor\r\n
167 s> Content-Type: application/mercurial-cbor\r\n
167 s> Content-Length: 496\r\n
168 s> Content-Length: 496\r\n
168 s> \r\n
169 s> \r\n
169 s> \xa3Dapis\xa0GapibaseDapi/Nv1capabilitiesY\x01\xcabatch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset compression=$BUNDLE2_COMPRESSIONS$ getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash
170 s> \xa3Dapis\xa0GapibaseDapi/Nv1capabilitiesY\x01\xcabatch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset compression=$BUNDLE2_COMPRESSIONS$ getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash
170 cbor> {b'apibase': b'api/', b'apis': {}, b'v1capabilities': b'batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset compression=$BUNDLE2_COMPRESSIONS$ getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash'}
171 cbor> {b'apibase': b'api/', b'apis': {}, b'v1capabilities': b'batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset compression=$BUNDLE2_COMPRESSIONS$ getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash'}
171
172
172 Request for HTTPv2 service returns information about it
173 Request for HTTPv2 service returns information about it
173
174
174 $ sendhttpraw << EOF
175 $ sendhttpraw << EOF
175 > httprequest GET ?cmd=capabilities
176 > httprequest GET ?cmd=capabilities
176 > user-agent: test
177 > user-agent: test
177 > x-hgupgrade-1: exp-http-v2-0001 foo bar
178 > x-hgupgrade-1: exp-http-v2-0001 foo bar
178 > x-hgproto-1: cbor
179 > x-hgproto-1: cbor
179 > EOF
180 > EOF
180 using raw connection to peer
181 using raw connection to peer
181 s> GET /?cmd=capabilities HTTP/1.1\r\n
182 s> GET /?cmd=capabilities HTTP/1.1\r\n
182 s> Accept-Encoding: identity\r\n
183 s> Accept-Encoding: identity\r\n
183 s> user-agent: test\r\n
184 s> user-agent: test\r\n
184 s> x-hgproto-1: cbor\r\n
185 s> x-hgproto-1: cbor\r\n
185 s> x-hgupgrade-1: exp-http-v2-0001 foo bar\r\n
186 s> x-hgupgrade-1: exp-http-v2-0001 foo bar\r\n
186 s> host: $LOCALIP:$HGPORT\r\n (glob)
187 s> host: $LOCALIP:$HGPORT\r\n (glob)
187 s> \r\n
188 s> \r\n
188 s> makefile('rb', None)
189 s> makefile('rb', None)
189 s> HTTP/1.1 200 OK\r\n
190 s> HTTP/1.1 200 OK\r\n
190 s> Server: testing stub value\r\n
191 s> Server: testing stub value\r\n
191 s> Date: $HTTP_DATE$\r\n
192 s> Date: $HTTP_DATE$\r\n
192 s> Content-Type: application/mercurial-cbor\r\n
193 s> Content-Type: application/mercurial-cbor\r\n
193 s> Content-Length: *\r\n (glob)
194 s> Content-Length: *\r\n (glob)
194 s> \r\n
195 s> \r\n
195 s> \xa3Dapis\xa1Pexp-http-v2-0001\xa4Hcommands\xa7Eheads\xa2Dargs\xa1Jpubliconly\xf4Kpermissions\x81DpullEknown\xa2Dargs\xa1Enodes\x81HdeadbeefKpermissions\x81DpullFlookup\xa2Dargs\xa1CkeyCfooKpermissions\x81DpullGpushkey\xa2Dargs\xa4CkeyCkeyCnewCnewColdColdInamespaceBnsKpermissions\x81DpushHlistkeys\xa2Dargs\xa1InamespaceBnsKpermissions\x81DpullIbranchmap\xa2Dargs\xa0Kpermissions\x81DpullLcapabilities\xa2Dargs\xa0Kpermissions\x81DpullKcompression\x82\xa1DnameDzstd\xa1DnameDzlibNrawrepoformats\x82LgeneraldeltaHrevlogv1Qframingmediatypes\x81X&application/mercurial-exp-framing-0005GapibaseDapi/Nv1capabilitiesY\x01\xcabatch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset compression=$BUNDLE2_COMPRESSIONS$ getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash
196 s> \xa3Dapis\xa1Pexp-http-v2-0001\xa4Hcommands\xa7Eheads\xa2Dargs\xa1Jpubliconly\xf4Kpermissions\x81DpullEknown\xa2Dargs\xa1Enodes\x81HdeadbeefKpermissions\x81DpullFlookup\xa2Dargs\xa1CkeyCfooKpermissions\x81DpullGpushkey\xa2Dargs\xa4CkeyCkeyCnewCnewColdColdInamespaceBnsKpermissions\x81DpushHlistkeys\xa2Dargs\xa1InamespaceBnsKpermissions\x81DpullIbranchmap\xa2Dargs\xa0Kpermissions\x81DpullLcapabilities\xa2Dargs\xa0Kpermissions\x81DpullKcompression\x82\xa1DnameDzstd\xa1DnameDzlibNrawrepoformats\x82LgeneraldeltaHrevlogv1Qframingmediatypes\x81X&application/mercurial-exp-framing-0005GapibaseDapi/Nv1capabilitiesY\x01\xcabatch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset compression=$BUNDLE2_COMPRESSIONS$ getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash
196 cbor> {b'apibase': b'api/', b'apis': {b'exp-http-v2-0001': {b'commands': {b'branchmap': {b'args': {}, b'permissions': [b'pull']}, b'capabilities': {b'args': {}, b'permissions': [b'pull']}, b'heads': {b'args': {b'publiconly': False}, b'permissions': [b'pull']}, b'known': {b'args': {b'nodes': [b'deadbeef']}, b'permissions': [b'pull']}, b'listkeys': {b'args': {b'namespace': b'ns'}, b'permissions': [b'pull']}, b'lookup': {b'args': {b'key': b'foo'}, b'permissions': [b'pull']}, b'pushkey': {b'args': {b'key': b'key', b'namespace': b'ns', b'new': b'new', b'old': b'old'}, b'permissions': [b'push']}}, b'compression': [{b'name': b'zstd'}, {b'name': b'zlib'}], b'framingmediatypes': [b'application/mercurial-exp-framing-0005'], b'rawrepoformats': [b'generaldelta', b'revlogv1']}}, b'v1capabilities': b'batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset compression=$BUNDLE2_COMPRESSIONS$ getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash'}
197 cbor> {b'apibase': b'api/', b'apis': {b'exp-http-v2-0001': {b'commands': {b'branchmap': {b'args': {}, b'permissions': [b'pull']}, b'capabilities': {b'args': {}, b'permissions': [b'pull']}, b'heads': {b'args': {b'publiconly': False}, b'permissions': [b'pull']}, b'known': {b'args': {b'nodes': [b'deadbeef']}, b'permissions': [b'pull']}, b'listkeys': {b'args': {b'namespace': b'ns'}, b'permissions': [b'pull']}, b'lookup': {b'args': {b'key': b'foo'}, b'permissions': [b'pull']}, b'pushkey': {b'args': {b'key': b'key', b'namespace': b'ns', b'new': b'new', b'old': b'old'}, b'permissions': [b'push']}}, b'compression': [{b'name': b'zstd'}, {b'name': b'zlib'}], b'framingmediatypes': [b'application/mercurial-exp-framing-0005'], b'rawrepoformats': [b'generaldelta', b'revlogv1']}}, b'v1capabilities': b'batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset compression=$BUNDLE2_COMPRESSIONS$ getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash'}
197
198
198 capabilities command returns expected info
199 capabilities command returns expected info
199
200
200 $ sendhttpv2peerhandshake << EOF
201 $ sendhttpv2peerhandshake << EOF
201 > command capabilities
202 > command capabilities
202 > EOF
203 > EOF
203 creating http peer for wire protocol version 2
204 creating http peer for wire protocol version 2
204 s> GET /?cmd=capabilities HTTP/1.1\r\n
205 s> GET /?cmd=capabilities HTTP/1.1\r\n
205 s> Accept-Encoding: identity\r\n
206 s> Accept-Encoding: identity\r\n
206 s> vary: X-HgProto-1,X-HgUpgrade-1\r\n
207 s> vary: X-HgProto-1,X-HgUpgrade-1\r\n
207 s> x-hgproto-1: cbor\r\n
208 s> x-hgproto-1: cbor\r\n
208 s> x-hgupgrade-1: exp-http-v2-0001\r\n
209 s> x-hgupgrade-1: exp-http-v2-0001\r\n
209 s> accept: application/mercurial-0.1\r\n
210 s> accept: application/mercurial-0.1\r\n
210 s> host: $LOCALIP:$HGPORT\r\n (glob)
211 s> host: $LOCALIP:$HGPORT\r\n (glob)
211 s> user-agent: Mercurial debugwireproto\r\n
212 s> user-agent: Mercurial debugwireproto\r\n
212 s> \r\n
213 s> \r\n
213 s> makefile('rb', None)
214 s> makefile('rb', None)
214 s> HTTP/1.1 200 OK\r\n
215 s> HTTP/1.1 200 OK\r\n
215 s> Server: testing stub value\r\n
216 s> Server: testing stub value\r\n
216 s> Date: $HTTP_DATE$\r\n
217 s> Date: $HTTP_DATE$\r\n
217 s> Content-Type: application/mercurial-cbor\r\n
218 s> Content-Type: application/mercurial-cbor\r\n
218 s> Content-Length: *\r\n (glob)
219 s> Content-Length: *\r\n (glob)
219 s> \r\n
220 s> \r\n
220 s> \xa3Dapis\xa1Pexp-http-v2-0001\xa4Hcommands\xa7Eheads\xa2Dargs\xa1Jpubliconly\xf4Kpermissions\x81DpullEknown\xa2Dargs\xa1Enodes\x81HdeadbeefKpermissions\x81DpullFlookup\xa2Dargs\xa1CkeyCfooKpermissions\x81DpullGpushkey\xa2Dargs\xa4CkeyCkeyCnewCnewColdColdInamespaceBnsKpermissions\x81DpushHlistkeys\xa2Dargs\xa1InamespaceBnsKpermissions\x81DpullIbranchmap\xa2Dargs\xa0Kpermissions\x81DpullLcapabilities\xa2Dargs\xa0Kpermissions\x81DpullKcompression\x82\xa1DnameDzstd\xa1DnameDzlibNrawrepoformats\x82LgeneraldeltaHrevlogv1Qframingmediatypes\x81X&application/mercurial-exp-framing-0005GapibaseDapi/Nv1capabilitiesY\x01\xcabatch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset compression=$BUNDLE2_COMPRESSIONS$ getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash
221 s> \xa3Dapis\xa1Pexp-http-v2-0001\xa4Hcommands\xa7Eheads\xa2Dargs\xa1Jpubliconly\xf4Kpermissions\x81DpullEknown\xa2Dargs\xa1Enodes\x81HdeadbeefKpermissions\x81DpullFlookup\xa2Dargs\xa1CkeyCfooKpermissions\x81DpullGpushkey\xa2Dargs\xa4CkeyCkeyCnewCnewColdColdInamespaceBnsKpermissions\x81DpushHlistkeys\xa2Dargs\xa1InamespaceBnsKpermissions\x81DpullIbranchmap\xa2Dargs\xa0Kpermissions\x81DpullLcapabilities\xa2Dargs\xa0Kpermissions\x81DpullKcompression\x82\xa1DnameDzstd\xa1DnameDzlibNrawrepoformats\x82LgeneraldeltaHrevlogv1Qframingmediatypes\x81X&application/mercurial-exp-framing-0005GapibaseDapi/Nv1capabilitiesY\x01\xcabatch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset compression=$BUNDLE2_COMPRESSIONS$ getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash
221 sending capabilities command
222 sending capabilities command
222 s> POST /api/exp-http-v2-0001/ro/capabilities HTTP/1.1\r\n
223 s> POST /api/exp-http-v2-0001/ro/capabilities HTTP/1.1\r\n
223 s> Accept-Encoding: identity\r\n
224 s> Accept-Encoding: identity\r\n
224 s> *\r\n (glob)
225 s> *\r\n (glob)
225 s> content-type: application/mercurial-exp-framing-0005\r\n
226 s> content-type: application/mercurial-exp-framing-0005\r\n
226 s> content-length: 27\r\n
227 s> content-length: 27\r\n
227 s> host: $LOCALIP:$HGPORT\r\n (glob)
228 s> host: $LOCALIP:$HGPORT\r\n (glob)
228 s> user-agent: Mercurial debugwireproto\r\n
229 s> user-agent: Mercurial debugwireproto\r\n
229 s> \r\n
230 s> \r\n
230 s> \x13\x00\x00\x01\x00\x01\x01\x11\xa1DnameLcapabilities
231 s> \x13\x00\x00\x01\x00\x01\x01\x11\xa1DnameLcapabilities
231 s> makefile('rb', None)
232 s> makefile('rb', None)
232 s> HTTP/1.1 200 OK\r\n
233 s> HTTP/1.1 200 OK\r\n
233 s> Server: testing stub value\r\n
234 s> Server: testing stub value\r\n
234 s> Date: $HTTP_DATE$\r\n
235 s> Date: $HTTP_DATE$\r\n
235 s> Content-Type: application/mercurial-exp-framing-0005\r\n
236 s> Content-Type: application/mercurial-exp-framing-0005\r\n
236 s> Transfer-Encoding: chunked\r\n
237 s> Transfer-Encoding: chunked\r\n
237 s> \r\n
238 s> \r\n
238 s> 1e2\r\n
239 s> 1e2\r\n
239 s> \xda\x01\x00\x01\x00\x02\x012
240 s> \xda\x01\x00\x01\x00\x02\x012
240 s> \xa1FstatusBok\xa4Hcommands\xa7Eheads\xa2Dargs\xa1Jpubliconly\xf4Kpermissions\x81DpullEknown\xa2Dargs\xa1Enodes\x81HdeadbeefKpermissions\x81DpullFlookup\xa2Dargs\xa1CkeyCfooKpermissions\x81DpullGpushkey\xa2Dargs\xa4CkeyCkeyCnewCnewColdColdInamespaceBnsKpermissions\x81DpushHlistkeys\xa2Dargs\xa1InamespaceBnsKpermissions\x81DpullIbranchmap\xa2Dargs\xa0Kpermissions\x81DpullLcapabilities\xa2Dargs\xa0Kpermissions\x81DpullKcompression\x82\xa1DnameDzstd\xa1DnameDzlibNrawrepoformats\x82LgeneraldeltaHrevlogv1Qframingmediatypes\x81X&application/mercurial-exp-framing-0005
241 s> \xa1FstatusBok\xa4Hcommands\xa7Eheads\xa2Dargs\xa1Jpubliconly\xf4Kpermissions\x81DpullEknown\xa2Dargs\xa1Enodes\x81HdeadbeefKpermissions\x81DpullFlookup\xa2Dargs\xa1CkeyCfooKpermissions\x81DpullGpushkey\xa2Dargs\xa4CkeyCkeyCnewCnewColdColdInamespaceBnsKpermissions\x81DpushHlistkeys\xa2Dargs\xa1InamespaceBnsKpermissions\x81DpullIbranchmap\xa2Dargs\xa0Kpermissions\x81DpullLcapabilities\xa2Dargs\xa0Kpermissions\x81DpullKcompression\x82\xa1DnameDzstd\xa1DnameDzlibNrawrepoformats\x82LgeneraldeltaHrevlogv1Qframingmediatypes\x81X&application/mercurial-exp-framing-0005
241 s> \r\n
242 s> \r\n
242 received frame(size=474; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=eos)
243 received frame(size=474; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=eos)
243 s> 0\r\n
244 s> 0\r\n
244 s> \r\n
245 s> \r\n
245 response: [{b'status': b'ok'}, {b'commands': {b'branchmap': {b'args': {}, b'permissions': [b'pull']}, b'capabilities': {b'args': {}, b'permissions': [b'pull']}, b'heads': {b'args': {b'publiconly': False}, b'permissions': [b'pull']}, b'known': {b'args': {b'nodes': [b'deadbeef']}, b'permissions': [b'pull']}, b'listkeys': {b'args': {b'namespace': b'ns'}, b'permissions': [b'pull']}, b'lookup': {b'args': {b'key': b'foo'}, b'permissions': [b'pull']}, b'pushkey': {b'args': {b'key': b'key', b'namespace': b'ns', b'new': b'new', b'old': b'old'}, b'permissions': [b'push']}}, b'compression': [{b'name': b'zstd'}, {b'name': b'zlib'}], b'framingmediatypes': [b'application/mercurial-exp-framing-0005'], b'rawrepoformats': [b'generaldelta', b'revlogv1']}]
246 response: [{b'status': b'ok'}, {b'commands': {b'branchmap': {b'args': {}, b'permissions': [b'pull']}, b'capabilities': {b'args': {}, b'permissions': [b'pull']}, b'heads': {b'args': {b'publiconly': False}, b'permissions': [b'pull']}, b'known': {b'args': {b'nodes': [b'deadbeef']}, b'permissions': [b'pull']}, b'listkeys': {b'args': {b'namespace': b'ns'}, b'permissions': [b'pull']}, b'lookup': {b'args': {b'key': b'foo'}, b'permissions': [b'pull']}, b'pushkey': {b'args': {b'key': b'key', b'namespace': b'ns', b'new': b'new', b'old': b'old'}, b'permissions': [b'push']}}, b'compression': [{b'name': b'zstd'}, {b'name': b'zlib'}], b'framingmediatypes': [b'application/mercurial-exp-framing-0005'], b'rawrepoformats': [b'generaldelta', b'revlogv1']}]
246
247
247 $ cat error.log
248 $ cat error.log
General Comments 0
You need to be logged in to leave comments. Login now