comparison tests/test-wireproto-command-known.t @ 37645:72b0982cd509

debugcommands: perform handshake when obtaining httpv2 peer If we obtain an httpv2peer directly, the instance doesn't have an API descriptor and therefore doesn't know about the remote's commands, feature support, etc. This doesn't matter now. But when we implement the peer so it consults the API descriptor as part of sending commands, it will. So we change the logic for obtaining an http version 2 peer to go through makepeer() so the peer will perform the handshake and pass the API descriptor to the httpv2peer instance. Tests changed because we now perform a ?cmd=capabilities when obtaining version 2 peers. The Content-Length header is globbed because compression info will lack zstandard for pure builds. Differential Revision: https://phab.mercurial-scm.org/D3296
author Gregory Szorc <gregory.szorc@gmail.com>
date Thu, 12 Apr 2018 12:33:07 -0700
parents 6847542bb8d7
children b2fa1591fb44
comparison
equal deleted inserted replaced
37644:77c9ee77687c 37645:72b0982cd509
24 24
25 $ sendhttpv2peer << EOF 25 $ sendhttpv2peer << EOF
26 > command known 26 > command known
27 > EOF 27 > EOF
28 creating http peer for wire protocol version 2 28 creating http peer for wire protocol version 2
29 s> GET /?cmd=capabilities HTTP/1.1\r\n
30 s> Accept-Encoding: identity\r\n
31 s> vary: X-HgProto-1,X-HgUpgrade-1\r\n
32 s> x-hgproto-1: cbor\r\n
33 s> x-hgupgrade-1: exp-http-v2-0001\r\n
34 s> accept: application/mercurial-0.1\r\n
35 s> host: $LOCALIP:$HGPORT\r\n (glob)
36 s> user-agent: Mercurial debugwireproto\r\n
37 s> \r\n
38 s> makefile('rb', None)
39 s> HTTP/1.1 200 OK\r\n
40 s> Server: testing stub value\r\n
41 s> Date: $HTTP_DATE$\r\n
42 s> Content-Type: application/mercurial-cbor\r\n
43 s> Content-Length: *\r\n (glob)
44 s> \r\n
45 s> \xa3Dapis\xa1Pexp-http-v2-0001\xa2Hcommands\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\xa1DnameDzlibGapibaseDapi/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
29 sending known command 46 sending known command
30 s> POST /api/exp-http-v2-0001/ro/known HTTP/1.1\r\n 47 s> POST /api/exp-http-v2-0001/ro/known HTTP/1.1\r\n
31 s> Accept-Encoding: identity\r\n 48 s> Accept-Encoding: identity\r\n
32 s> accept: application/mercurial-exp-framing-0003\r\n 49 s> accept: application/mercurial-exp-framing-0003\r\n
33 s> content-type: application/mercurial-exp-framing-0003\r\n 50 s> content-type: application/mercurial-exp-framing-0003\r\n
57 $ sendhttpv2peer << EOF 74 $ sendhttpv2peer << EOF
58 > command known 75 > command known
59 > nodes eval:[b'\x42\x6b\xad\xa5\xc6\x75\x98\xca\x65\x03\x6d\x57\xd9\xe4\xb6\x4b\x0c\x1c\xe7\xa0'] 76 > nodes eval:[b'\x42\x6b\xad\xa5\xc6\x75\x98\xca\x65\x03\x6d\x57\xd9\xe4\xb6\x4b\x0c\x1c\xe7\xa0']
60 > EOF 77 > EOF
61 creating http peer for wire protocol version 2 78 creating http peer for wire protocol version 2
79 s> GET /?cmd=capabilities HTTP/1.1\r\n
80 s> Accept-Encoding: identity\r\n
81 s> vary: X-HgProto-1,X-HgUpgrade-1\r\n
82 s> x-hgproto-1: cbor\r\n
83 s> x-hgupgrade-1: exp-http-v2-0001\r\n
84 s> accept: application/mercurial-0.1\r\n
85 s> host: $LOCALIP:$HGPORT\r\n (glob)
86 s> user-agent: Mercurial debugwireproto\r\n
87 s> \r\n
88 s> makefile('rb', None)
89 s> HTTP/1.1 200 OK\r\n
90 s> Server: testing stub value\r\n
91 s> Date: $HTTP_DATE$\r\n
92 s> Content-Type: application/mercurial-cbor\r\n
93 s> Content-Length: *\r\n (glob)
94 s> \r\n
95 s> \xa3Dapis\xa1Pexp-http-v2-0001\xa2Hcommands\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\xa1DnameDzlibGapibaseDapi/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
62 sending known command 96 sending known command
63 s> POST /api/exp-http-v2-0001/ro/known HTTP/1.1\r\n 97 s> POST /api/exp-http-v2-0001/ro/known HTTP/1.1\r\n
64 s> Accept-Encoding: identity\r\n 98 s> Accept-Encoding: identity\r\n
65 s> accept: application/mercurial-exp-framing-0003\r\n 99 s> accept: application/mercurial-exp-framing-0003\r\n
66 s> content-type: application/mercurial-exp-framing-0003\r\n 100 s> content-type: application/mercurial-exp-framing-0003\r\n
90 $ sendhttpv2peer << EOF 124 $ sendhttpv2peer << EOF
91 > command known 125 > command known
92 > nodes eval:[b'\x42\x6b\xad\xa5\xc6\x75\x98\xca\x65\x03\x6d\x57\xd9\xe4\xb6\x4b\x0c\x1c\xe7\xa0', b'00000000000000000000', b'\x11\x24\x78\x96\x29\x61\x14\x71\x24\xed\xd4\x35\x49\xae\xdd\x1a\x33\x5e\x44\xbf'] 126 > nodes eval:[b'\x42\x6b\xad\xa5\xc6\x75\x98\xca\x65\x03\x6d\x57\xd9\xe4\xb6\x4b\x0c\x1c\xe7\xa0', b'00000000000000000000', b'\x11\x24\x78\x96\x29\x61\x14\x71\x24\xed\xd4\x35\x49\xae\xdd\x1a\x33\x5e\x44\xbf']
93 > EOF 127 > EOF
94 creating http peer for wire protocol version 2 128 creating http peer for wire protocol version 2
129 s> GET /?cmd=capabilities HTTP/1.1\r\n
130 s> Accept-Encoding: identity\r\n
131 s> vary: X-HgProto-1,X-HgUpgrade-1\r\n
132 s> x-hgproto-1: cbor\r\n
133 s> x-hgupgrade-1: exp-http-v2-0001\r\n
134 s> accept: application/mercurial-0.1\r\n
135 s> host: $LOCALIP:$HGPORT\r\n (glob)
136 s> user-agent: Mercurial debugwireproto\r\n
137 s> \r\n
138 s> makefile('rb', None)
139 s> HTTP/1.1 200 OK\r\n
140 s> Server: testing stub value\r\n
141 s> Date: $HTTP_DATE$\r\n
142 s> Content-Type: application/mercurial-cbor\r\n
143 s> Content-Length: *\r\n (glob)
144 s> \r\n
145 s> \xa3Dapis\xa1Pexp-http-v2-0001\xa2Hcommands\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\xa1DnameDzlibGapibaseDapi/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
95 sending known command 146 sending known command
96 s> POST /api/exp-http-v2-0001/ro/known HTTP/1.1\r\n 147 s> POST /api/exp-http-v2-0001/ro/known HTTP/1.1\r\n
97 s> Accept-Encoding: identity\r\n 148 s> Accept-Encoding: identity\r\n
98 s> accept: application/mercurial-exp-framing-0003\r\n 149 s> accept: application/mercurial-exp-framing-0003\r\n
99 s> content-type: application/mercurial-exp-framing-0003\r\n 150 s> content-type: application/mercurial-exp-framing-0003\r\n