##// END OF EJS Templates
wireproto: only expose "getbundle" and "unbundle" to v1 transports...
Gregory Szorc -
r37557:4a0d58d6 default
parent child Browse files
Show More
@@ -1019,7 +1019,8 b' def find_pullbundle(repo, proto, opts, c'
1019 continue
1019 continue
1020 return None
1020 return None
1021
1021
1022 @wireprotocommand('getbundle', '*', permission='pull')
1022 @wireprotocommand('getbundle', '*', permission='pull',
1023 transportpolicy=POLICY_V1_ONLY)
1023 def getbundle(repo, proto, others):
1024 def getbundle(repo, proto, others):
1024 opts = options('getbundle', gboptsmap.keys(), others)
1025 opts = options('getbundle', gboptsmap.keys(), others)
1025 for k, v in opts.iteritems():
1026 for k, v in opts.iteritems():
@@ -1178,7 +1179,8 b' def stream(repo, proto):'
1178 return wireprototypes.streamreslegacy(
1179 return wireprototypes.streamreslegacy(
1179 streamclone.generatev1wireproto(repo))
1180 streamclone.generatev1wireproto(repo))
1180
1181
1181 @wireprotocommand('unbundle', 'heads', permission='push')
1182 @wireprotocommand('unbundle', 'heads', permission='push',
1183 transportpolicy=POLICY_V1_ONLY)
1182 def unbundle(repo, proto, heads):
1184 def unbundle(repo, proto, heads):
1183 their_heads = decodelist(heads)
1185 their_heads = decodelist(heads)
1184
1186
@@ -540,7 +540,7 b' Attempting to run a read-write command v'
540 > accept: $MEDIATYPE
540 > accept: $MEDIATYPE
541 > content-type: $MEDIATYPE
541 > content-type: $MEDIATYPE
542 > user-agent: test
542 > user-agent: test
543 > frame 1 1 stream-begin command-request new cbor:{b'name': b'unbundle'}
543 > frame 1 1 stream-begin command-request new cbor:{b'name': b'pushkey'}
544 > EOF
544 > EOF
545 using raw connection to peer
545 using raw connection to peer
546 s> POST /api/exp-http-v2-0001/ro/multirequest HTTP/1.1\r\n
546 s> POST /api/exp-http-v2-0001/ro/multirequest HTTP/1.1\r\n
@@ -548,17 +548,17 b' Attempting to run a read-write command v'
548 s> accept: application/mercurial-exp-framing-0003\r\n
548 s> accept: application/mercurial-exp-framing-0003\r\n
549 s> content-type: application/mercurial-exp-framing-0003\r\n
549 s> content-type: application/mercurial-exp-framing-0003\r\n
550 s> user-agent: test\r\n
550 s> user-agent: test\r\n
551 s> content-length: 23\r\n
551 s> content-length: 22\r\n
552 s> host: $LOCALIP:$HGPORT\r\n (glob)
552 s> host: $LOCALIP:$HGPORT\r\n (glob)
553 s> \r\n
553 s> \r\n
554 s> \x0f\x00\x00\x01\x00\x01\x01\x11\xa1DnameHunbundle
554 s> \x0e\x00\x00\x01\x00\x01\x01\x11\xa1DnameGpushkey
555 s> makefile('rb', None)
555 s> makefile('rb', None)
556 s> HTTP/1.1 403 Forbidden\r\n
556 s> HTTP/1.1 403 Forbidden\r\n
557 s> Server: testing stub value\r\n
557 s> Server: testing stub value\r\n
558 s> Date: $HTTP_DATE$\r\n
558 s> Date: $HTTP_DATE$\r\n
559 s> Content-Type: text/plain\r\n
559 s> Content-Type: text/plain\r\n
560 s> Content-Length: 53\r\n
560 s> Content-Length: 52\r\n
561 s> \r\n
561 s> \r\n
562 s> insufficient permissions to execute command: unbundle
562 s> insufficient permissions to execute command: pushkey
563
563
564 $ cat error.log
564 $ cat error.log
@@ -30,11 +30,11 b' capabilities request returns an array of'
30 s> \r\n
30 s> \r\n
31 s> *\r\n (glob)
31 s> *\r\n (glob)
32 s> *\x00\x01\x00\x02\x01F (glob)
32 s> *\x00\x01\x00\x02\x01F (glob)
33 s> \xa2Hcommands\xa9Eheads\xa2Dargs\xa1Jpubliconly\xf4Kpermissions\x81DpullEknown\xa2Dargs\xa1Enodes\x81HdeadbeefKpermissions\x81DpullFlookup\xa2Dargs\xa1CkeyCfooKpermissions\x81DpullGpushkey\xa2Dargs\xa4CkeyCkeyCnewCnewColdColdInamespaceBnsKpermissions\x81DpushHlistkeys\xa2Dargs\xa1InamespaceBnsKpermissions\x81DpullHunbundle\xa2Dargs\xa1EheadsFlegacyKpermissions\x81DpushIbranchmap\xa2Dargs\xa0Kpermissions\x81DpullIgetbundle\xa2Dargs\xa1A*FlegacyKpermissions\x81DpullLcapabilities\xa2Dargs\xa0Kpermissions\x81DpullKcompression\x82\xa1DnameDzstd\xa1DnameDzlib
33 s> \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\xa1DnameDzlib
34 s> \r\n
34 s> \r\n
35 received frame(size=*; request=1; stream=2; streamflags=stream-begin; type=bytes-response; flags=eos|cbor) (glob)
35 received frame(size=*; request=1; stream=2; streamflags=stream-begin; type=bytes-response; flags=eos|cbor) (glob)
36 s> 0\r\n
36 s> 0\r\n
37 s> \r\n
37 s> \r\n
38 response: [{b'commands': {b'branchmap': {b'args': {}, b'permissions': [b'pull']}, b'capabilities': {b'args': {}, b'permissions': [b'pull']}, b'getbundle': {b'args': {b'*': b'legacy'}, 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'unbundle': {b'args': {b'heads': b'legacy'}, b'permissions': [b'push']}}, b'compression': [{b'name': b'zstd'}, {b'name': b'zlib'}]}]
38 response: [{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'}]}]
39
39
40 $ cat error.log
40 $ cat error.log
General Comments 0
You need to be logged in to leave comments. Login now