comparison tests/test-ssh-proto.t @ 36527:44dc34b8d17b

debugcommands: add debugserve command `hg serve --stdio` requires the exact command argument form `hg -R <path> serve --stdio` for security reasons. An upcoming commit will need to start an SSH protocol server process with custom settings. This commit creates a `hg debugserve` command for starting servers with custom options. There are no security restrictions and we can add options here that aren't appropriate for built-in commands. We currently only support starting an SSH protocol server using the process's stdio file descriptors. The server supports logging its I/O activity to a file descriptor number passed as a command argument. Differential Revision: https://phab.mercurial-scm.org/D2464
author Gregory Szorc <gregory.szorc@gmail.com>
date Tue, 27 Feb 2018 15:47:44 -0800
parents 02782e6e2c38
children 72e487851a53
comparison
equal deleted inserted replaced
36526:7cc4a9b9732a 36527:44dc34b8d17b
36 $ hg -R server serve --stdio << EOF 36 $ hg -R server serve --stdio << EOF
37 > hello 37 > hello
38 > EOF 38 > EOF
39 384 39 384
40 capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN 40 capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
41
42 `hg debugserve --sshstdio` works
43
44 $ cd server
45 $ hg debugserve --sshstdio << EOF
46 > hello
47 > EOF
48 384
49 capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
50
51 I/O logging works
52
53 $ hg debugserve --sshstdio --logiofd 1 << EOF
54 > hello
55 > EOF
56 o> write(4) -> None:
57 o> 384\n
58 o> write(384) -> None:
59 o> capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
60 384
61 capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
62 o> flush() -> None
63
64 $ hg debugserve --sshstdio --logiofile $TESTTMP/io << EOF
65 > hello
66 > EOF
67 384
68 capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
69
70 $ cat $TESTTMP/io
71 o> write(4) -> None:
72 o> 384\n
73 o> write(384) -> None:
74 o> capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
75 o> flush() -> None
76
77 $ cd ..
41 78
42 >=0.9.1 clients send a "hello" + "between" for the null range as part of handshake. 79 >=0.9.1 clients send a "hello" + "between" for the null range as part of handshake.
43 Server should reply with capabilities and should send "1\n\n" as a successful 80 Server should reply with capabilities and should send "1\n\n" as a successful
44 reply with empty response to the "between". 81 reply with empty response to the "between".
45 82