Show More
@@ -17,6 +17,7 b' import random' | |||||
17 | import socket |
|
17 | import socket | |
18 | import ssl |
|
18 | import ssl | |
19 | import string |
|
19 | import string | |
|
20 | import subprocess | |||
20 | import sys |
|
21 | import sys | |
21 | import tempfile |
|
22 | import tempfile | |
22 | import time |
|
23 | import time | |
@@ -65,6 +66,7 b' from . import (' | |||||
65 | setdiscovery, |
|
66 | setdiscovery, | |
66 | simplemerge, |
|
67 | simplemerge, | |
67 | smartset, |
|
68 | smartset, | |
|
69 | sshpeer, | |||
68 | sslutil, |
|
70 | sslutil, | |
69 | streamclone, |
|
71 | streamclone, | |
70 | templater, |
|
72 | templater, | |
@@ -2529,3 +2531,204 b' def debugwireargs(ui, repopath, *vals, *' | |||||
2529 | ui.write("%s\n" % res1) |
|
2531 | ui.write("%s\n" % res1) | |
2530 | if res1 != res2: |
|
2532 | if res1 != res2: | |
2531 | ui.warn("%s\n" % res2) |
|
2533 | ui.warn("%s\n" % res2) | |
|
2534 | ||||
|
2535 | def _parsewirelangblocks(fh): | |||
|
2536 | activeaction = None | |||
|
2537 | blocklines = [] | |||
|
2538 | ||||
|
2539 | for line in fh: | |||
|
2540 | line = line.rstrip() | |||
|
2541 | if not line: | |||
|
2542 | continue | |||
|
2543 | ||||
|
2544 | if line.startswith(b'#'): | |||
|
2545 | continue | |||
|
2546 | ||||
|
2547 | if not line.startswith(' '): | |||
|
2548 | # New block. Flush previous one. | |||
|
2549 | if activeaction: | |||
|
2550 | yield activeaction, blocklines | |||
|
2551 | ||||
|
2552 | activeaction = line | |||
|
2553 | blocklines = [] | |||
|
2554 | continue | |||
|
2555 | ||||
|
2556 | # Else we start with an indent. | |||
|
2557 | ||||
|
2558 | if not activeaction: | |||
|
2559 | raise error.Abort(_('indented line outside of block')) | |||
|
2560 | ||||
|
2561 | blocklines.append(line) | |||
|
2562 | ||||
|
2563 | # Flush last block. | |||
|
2564 | if activeaction: | |||
|
2565 | yield activeaction, blocklines | |||
|
2566 | ||||
|
2567 | @command('debugwireproto', | |||
|
2568 | [ | |||
|
2569 | ('', 'localssh', False, _('start an SSH server for this repo')), | |||
|
2570 | ('', 'peer', '', _('construct a specific version of the peer')), | |||
|
2571 | ] + cmdutil.remoteopts, | |||
|
2572 | _('[REPO]'), | |||
|
2573 | optionalrepo=True) | |||
|
2574 | def debugwireproto(ui, repo, **opts): | |||
|
2575 | """send wire protocol commands to a server | |||
|
2576 | ||||
|
2577 | This command can be used to issue wire protocol commands to remote | |||
|
2578 | peers and to debug the raw data being exchanged. | |||
|
2579 | ||||
|
2580 | ``--localssh`` will start an SSH server against the current repository | |||
|
2581 | and connect to that. By default, the connection will perform a handshake | |||
|
2582 | and establish an appropriate peer instance. | |||
|
2583 | ||||
|
2584 | ``--peer`` can be used to bypass the handshake protocol and construct a | |||
|
2585 | peer instance using the specified class type. Valid values are ``raw``, | |||
|
2586 | ``ssh1``, and ``ssh2``. ``raw`` instances only allow sending raw data | |||
|
2587 | payloads and don't support higher-level command actions. | |||
|
2588 | ||||
|
2589 | Commands are issued via a mini language which is specified via stdin. | |||
|
2590 | The language consists of individual actions to perform. An action is | |||
|
2591 | defined by a block. A block is defined as a line with no leading | |||
|
2592 | space followed by 0 or more lines with leading space. Blocks are | |||
|
2593 | effectively a high-level command with additional metadata. | |||
|
2594 | ||||
|
2595 | Lines beginning with ``#`` are ignored. | |||
|
2596 | ||||
|
2597 | The following sections denote available actions. | |||
|
2598 | ||||
|
2599 | raw | |||
|
2600 | --- | |||
|
2601 | ||||
|
2602 | Send raw data to the server. | |||
|
2603 | ||||
|
2604 | The block payload contains the raw data to send as one atomic send | |||
|
2605 | operation. The data may not actually be delivered in a single system | |||
|
2606 | call: it depends on the abilities of the transport being used. | |||
|
2607 | ||||
|
2608 | Each line in the block is de-indented and concatenated. Then, that | |||
|
2609 | value is evaluated as a Python b'' literal. This allows the use of | |||
|
2610 | backslash escaping, etc. | |||
|
2611 | ||||
|
2612 | raw+ | |||
|
2613 | ---- | |||
|
2614 | ||||
|
2615 | Behaves like ``raw`` except flushes output afterwards. | |||
|
2616 | ||||
|
2617 | close | |||
|
2618 | ----- | |||
|
2619 | ||||
|
2620 | Close the connection to the server. | |||
|
2621 | ||||
|
2622 | flush | |||
|
2623 | ----- | |||
|
2624 | ||||
|
2625 | Flush data written to the server. | |||
|
2626 | ||||
|
2627 | readavailable | |||
|
2628 | ------------- | |||
|
2629 | ||||
|
2630 | Read all available data from the server. | |||
|
2631 | ||||
|
2632 | If the connection to the server encompasses multiple pipes, we poll both | |||
|
2633 | pipes and read available data. | |||
|
2634 | ||||
|
2635 | readline | |||
|
2636 | -------- | |||
|
2637 | ||||
|
2638 | Read a line of output from the server. If there are multiple output | |||
|
2639 | pipes, reads only the main pipe. | |||
|
2640 | """ | |||
|
2641 | opts = pycompat.byteskwargs(opts) | |||
|
2642 | ||||
|
2643 | if opts['localssh'] and not repo: | |||
|
2644 | raise error.Abort(_('--localssh requires a repository')) | |||
|
2645 | ||||
|
2646 | if opts['peer'] and opts['peer'] not in ('raw', 'ssh1', 'ssh2'): | |||
|
2647 | raise error.Abort(_('invalid value for --peer'), | |||
|
2648 | hint=_('valid values are "raw", "ssh1", and "ssh2"')) | |||
|
2649 | ||||
|
2650 | if ui.interactive(): | |||
|
2651 | ui.write(_('(waiting for commands on stdin)\n')) | |||
|
2652 | ||||
|
2653 | blocks = list(_parsewirelangblocks(ui.fin)) | |||
|
2654 | ||||
|
2655 | proc = None | |||
|
2656 | ||||
|
2657 | if opts['localssh']: | |||
|
2658 | # We start the SSH server in its own process so there is process | |||
|
2659 | # separation. This prevents a whole class of potential bugs around | |||
|
2660 | # shared state from interfering with server operation. | |||
|
2661 | args = util.hgcmd() + [ | |||
|
2662 | '-R', repo.root, | |||
|
2663 | 'debugserve', '--sshstdio', | |||
|
2664 | ] | |||
|
2665 | proc = subprocess.Popen(args, stdin=subprocess.PIPE, | |||
|
2666 | stdout=subprocess.PIPE, stderr=subprocess.PIPE, | |||
|
2667 | bufsize=0) | |||
|
2668 | ||||
|
2669 | stdin = proc.stdin | |||
|
2670 | stdout = proc.stdout | |||
|
2671 | stderr = proc.stderr | |||
|
2672 | ||||
|
2673 | # We turn the pipes into observers so we can log I/O. | |||
|
2674 | if ui.verbose or opts['peer'] == 'raw': | |||
|
2675 | stdin = util.makeloggingfileobject(ui, proc.stdin, b'i', | |||
|
2676 | logdata=True) | |||
|
2677 | stdout = util.makeloggingfileobject(ui, proc.stdout, b'o', | |||
|
2678 | logdata=True) | |||
|
2679 | stderr = util.makeloggingfileobject(ui, proc.stderr, b'e', | |||
|
2680 | logdata=True) | |||
|
2681 | ||||
|
2682 | # --localssh also implies the peer connection settings. | |||
|
2683 | ||||
|
2684 | url = 'ssh://localserver' | |||
|
2685 | ||||
|
2686 | if opts['peer'] == 'ssh1': | |||
|
2687 | ui.write(_('creating ssh peer for wire protocol version 1\n')) | |||
|
2688 | peer = sshpeer.sshv1peer(ui, url, proc, stdin, stdout, stderr, | |||
|
2689 | None) | |||
|
2690 | elif opts['peer'] == 'ssh2': | |||
|
2691 | ui.write(_('creating ssh peer for wire protocol version 2\n')) | |||
|
2692 | peer = sshpeer.sshv2peer(ui, url, proc, stdin, stdout, stderr, | |||
|
2693 | None) | |||
|
2694 | elif opts['peer'] == 'raw': | |||
|
2695 | ui.write(_('using raw connection to peer\n')) | |||
|
2696 | peer = None | |||
|
2697 | else: | |||
|
2698 | ui.write(_('creating ssh peer from handshake results\n')) | |||
|
2699 | peer = sshpeer.makepeer(ui, url, proc, stdin, stdout, stderr) | |||
|
2700 | ||||
|
2701 | else: | |||
|
2702 | raise error.Abort(_('only --localssh is currently supported')) | |||
|
2703 | ||||
|
2704 | # Now perform actions based on the parsed wire language instructions. | |||
|
2705 | for action, lines in blocks: | |||
|
2706 | if action in ('raw', 'raw+'): | |||
|
2707 | # Concatenate the data together. | |||
|
2708 | data = ''.join(l.lstrip() for l in lines) | |||
|
2709 | data = util.unescapestr(data) | |||
|
2710 | stdin.write(data) | |||
|
2711 | ||||
|
2712 | if action == 'raw+': | |||
|
2713 | stdin.flush() | |||
|
2714 | elif action == 'flush': | |||
|
2715 | stdin.flush() | |||
|
2716 | elif action == 'close': | |||
|
2717 | peer.close() | |||
|
2718 | elif action == 'readavailable': | |||
|
2719 | fds = util.poll([stdout.fileno(), stderr.fileno()]) | |||
|
2720 | ||||
|
2721 | if stdout.fileno() in fds: | |||
|
2722 | util.readpipe(stdout) | |||
|
2723 | if stderr.fileno() in fds: | |||
|
2724 | util.readpipe(stderr) | |||
|
2725 | elif action == 'readline': | |||
|
2726 | stdout.readline() | |||
|
2727 | else: | |||
|
2728 | raise error.Abort(_('unknown action: %s') % action) | |||
|
2729 | ||||
|
2730 | if peer: | |||
|
2731 | peer.close() | |||
|
2732 | ||||
|
2733 | if proc: | |||
|
2734 | proc.kill() |
@@ -121,6 +121,7 b' Show debug commands if there are no othe' | |||||
121 | debugupgraderepo |
|
121 | debugupgraderepo | |
122 | debugwalk |
|
122 | debugwalk | |
123 | debugwireargs |
|
123 | debugwireargs | |
|
124 | debugwireproto | |||
124 |
|
125 | |||
125 | Do not show the alias of a debug command if there are other candidates |
|
126 | Do not show the alias of a debug command if there are other candidates | |
126 | (this should hide rawcommit) |
|
127 | (this should hide rawcommit) | |
@@ -302,6 +303,7 b' Show all commands + options' | |||||
302 | debugupgraderepo: optimize, run |
|
303 | debugupgraderepo: optimize, run | |
303 | debugwalk: include, exclude |
|
304 | debugwalk: include, exclude | |
304 | debugwireargs: three, four, five, ssh, remotecmd, insecure |
|
305 | debugwireargs: three, four, five, ssh, remotecmd, insecure | |
|
306 | debugwireproto: localssh, peer, ssh, remotecmd, insecure | |||
305 | files: rev, print0, include, exclude, template, subrepos |
|
307 | files: rev, print0, include, exclude, template, subrepos | |
306 | graft: rev, continue, edit, log, force, currentdate, currentuser, date, user, tool, dry-run |
|
308 | graft: rev, continue, edit, log, force, currentdate, currentuser, date, user, tool, dry-run | |
307 | grep: print0, all, text, follow, ignore-case, files-with-matches, line-number, rev, user, date, template, include, exclude |
|
309 | grep: print0, all, text, follow, ignore-case, files-with-matches, line-number, rev, user, date, template, include, exclude |
@@ -983,6 +983,8 b' Test list of internal help commands' | |||||
983 | debugwalk show how files match on given patterns |
|
983 | debugwalk show how files match on given patterns | |
984 | debugwireargs |
|
984 | debugwireargs | |
985 | (no help text available) |
|
985 | (no help text available) | |
|
986 | debugwireproto | |||
|
987 | send wire protocol commands to a server | |||
986 |
|
988 | |||
987 | (use 'hg help -v debug' to show built-in aliases and global options) |
|
989 | (use 'hg help -v debug' to show built-in aliases and global options) | |
988 |
|
990 |
This diff has been collapsed as it changes many lines, (1190 lines changed) Show them Hide them | |||||
@@ -12,10 +12,29 b'' | |||||
12 | $ echo 0 > foo |
|
12 | $ echo 0 > foo | |
13 | $ hg -q add foo |
|
13 | $ hg -q add foo | |
14 | $ hg commit -m initial |
|
14 | $ hg commit -m initial | |
15 | $ cd .. |
|
15 | ||
|
16 | A no-op connection performs a handshake | |||
|
17 | ||||
|
18 | $ hg debugwireproto --localssh << EOF | |||
|
19 | > EOF | |||
|
20 | creating ssh peer from handshake results | |||
|
21 | ||||
|
22 | Raw peers don't perform any activity | |||
|
23 | ||||
|
24 | $ hg debugwireproto --localssh --peer raw << EOF | |||
|
25 | > EOF | |||
|
26 | using raw connection to peer | |||
|
27 | $ hg debugwireproto --localssh --peer ssh1 << EOF | |||
|
28 | > EOF | |||
|
29 | creating ssh peer for wire protocol version 1 | |||
|
30 | $ hg debugwireproto --localssh --peer ssh2 << EOF | |||
|
31 | > EOF | |||
|
32 | creating ssh peer for wire protocol version 2 | |||
16 |
|
33 | |||
17 | Test a normal behaving server, for sanity |
|
34 | Test a normal behaving server, for sanity | |
18 |
|
35 | |||
|
36 | $ cd .. | |||
|
37 | ||||
19 | $ hg --debug debugpeer ssh://user@dummy/server |
|
38 | $ hg --debug debugpeer ssh://user@dummy/server | |
20 | running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !) |
|
39 | running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !) | |
21 | running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !) |
|
40 | running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !) | |
@@ -33,11 +52,19 b' Test a normal behaving server, for sanit' | |||||
33 |
|
52 | |||
34 | Server should answer the "hello" command in isolation |
|
53 | Server should answer the "hello" command in isolation | |
35 |
|
54 | |||
36 |
$ hg -R server |
|
55 | $ hg -R server debugwireproto --localssh --peer raw << EOF | |
37 | > hello |
|
56 | > raw | |
|
57 | > hello\n | |||
|
58 | > readline | |||
|
59 | > readline | |||
38 | > EOF |
|
60 | > EOF | |
39 | 384 |
|
61 | using raw connection to peer | |
40 | capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN |
|
62 | i> write(6) -> None: | |
|
63 | i> hello\n | |||
|
64 | o> readline() -> 4: | |||
|
65 | o> 384\n | |||
|
66 | o> readline() -> 384: | |||
|
67 | o> capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n | |||
41 |
|
68 | |||
42 | `hg debugserve --sshstdio` works |
|
69 | `hg debugserve --sshstdio` works | |
43 |
|
70 | |||
@@ -80,16 +107,33 b' I/O logging works' | |||||
80 | Server should reply with capabilities and should send "1\n\n" as a successful |
|
107 | Server should reply with capabilities and should send "1\n\n" as a successful | |
81 | reply with empty response to the "between". |
|
108 | reply with empty response to the "between". | |
82 |
|
109 | |||
83 |
$ hg -R server |
|
110 | $ hg -R server debugwireproto --localssh --peer raw << EOF | |
84 | > hello |
|
111 | > raw | |
85 | > between |
|
112 | > hello\n | |
86 | > pairs 81 |
|
113 | > readline | |
|
114 | > readline | |||
|
115 | > raw | |||
|
116 | > between\n | |||
|
117 | > pairs 81\n | |||
87 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
118 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
|
119 | > readline | |||
|
120 | > readline | |||
88 | > EOF |
|
121 | > EOF | |
89 | 384 |
|
122 | using raw connection to peer | |
90 | capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN |
|
123 | i> write(6) -> None: | |
91 | 1 |
|
124 | i> hello\n | |
92 |
|
125 | o> readline() -> 4: | ||
|
126 | o> 384\n | |||
|
127 | o> readline() -> 384: | |||
|
128 | o> capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n | |||
|
129 | i> write(98) -> None: | |||
|
130 | i> between\n | |||
|
131 | i> pairs 81\n | |||
|
132 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |||
|
133 | o> readline() -> 2: | |||
|
134 | o> 1\n | |||
|
135 | o> readline() -> 1: | |||
|
136 | o> \n | |||
93 |
|
137 | |||
94 | SSH banner is not printed by default, ignored by clients |
|
138 | SSH banner is not printed by default, ignored by clients | |
95 |
|
139 | |||
@@ -127,26 +171,63 b' SSH banner is not printed by default, ig' | |||||
127 |
|
171 | |||
128 | And test the banner with the raw protocol |
|
172 | And test the banner with the raw protocol | |
129 |
|
173 | |||
130 |
$ SSHSERVERMODE=banner hg -R server |
|
174 | $ SSHSERVERMODE=banner hg -R server debugwireproto --localssh --peer raw << EOF | |
131 | > hello |
|
175 | > raw | |
132 | > between |
|
176 | > hello\n | |
133 | > pairs 81 |
|
177 | > readline | |
|
178 | > readline | |||
|
179 | > readline | |||
|
180 | > readline | |||
|
181 | > readline | |||
|
182 | > readline | |||
|
183 | > readline | |||
|
184 | > readline | |||
|
185 | > readline | |||
|
186 | > readline | |||
|
187 | > readline | |||
|
188 | > readline | |||
|
189 | > raw | |||
|
190 | > between\n | |||
|
191 | > pairs 81\n | |||
134 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
192 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
|
193 | > readline | |||
|
194 | > readline | |||
135 | > EOF |
|
195 | > EOF | |
136 | banner: line 0 |
|
196 | using raw connection to peer | |
137 | banner: line 1 |
|
197 | i> write(6) -> None: | |
138 | banner: line 2 |
|
198 | i> hello\n | |
139 | banner: line 3 |
|
199 | o> readline() -> 15: | |
140 |
banner: line |
|
200 | o> banner: line 0\n | |
141 | banner: line 5 |
|
201 | o> readline() -> 15: | |
142 |
banner: line |
|
202 | o> banner: line 1\n | |
143 | banner: line 7 |
|
203 | o> readline() -> 15: | |
144 |
banner: line |
|
204 | o> banner: line 2\n | |
145 | banner: line 9 |
|
205 | o> readline() -> 15: | |
146 | 384 |
|
206 | o> banner: line 3\n | |
147 | capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN |
|
207 | o> readline() -> 15: | |
148 | 1 |
|
208 | o> banner: line 4\n | |
149 |
|
209 | o> readline() -> 15: | ||
|
210 | o> banner: line 5\n | |||
|
211 | o> readline() -> 15: | |||
|
212 | o> banner: line 6\n | |||
|
213 | o> readline() -> 15: | |||
|
214 | o> banner: line 7\n | |||
|
215 | o> readline() -> 15: | |||
|
216 | o> banner: line 8\n | |||
|
217 | o> readline() -> 15: | |||
|
218 | o> banner: line 9\n | |||
|
219 | o> readline() -> 4: | |||
|
220 | o> 384\n | |||
|
221 | o> readline() -> 384: | |||
|
222 | o> capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n | |||
|
223 | i> write(98) -> None: | |||
|
224 | i> between\n | |||
|
225 | i> pairs 81\n | |||
|
226 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |||
|
227 | o> readline() -> 2: | |||
|
228 | o> 1\n | |||
|
229 | o> readline() -> 1: | |||
|
230 | o> \n | |||
150 |
|
231 | |||
151 | Connecting to a <0.9.1 server that doesn't support the hello command. |
|
232 | Connecting to a <0.9.1 server that doesn't support the hello command. | |
152 | The client should refuse, as we dropped support for connecting to such |
|
233 | The client should refuse, as we dropped support for connecting to such | |
@@ -167,18 +248,37 b' servers.' | |||||
167 |
|
248 | |||
168 | Sending an unknown command to the server results in an empty response to that command |
|
249 | Sending an unknown command to the server results in an empty response to that command | |
169 |
|
250 | |||
170 |
$ hg -R server |
|
251 | $ hg -R server debugwireproto --localssh --peer raw << EOF | |
171 | > pre-hello |
|
252 | > raw | |
172 | > hello |
|
253 | > pre-hello\n | |
173 | > between |
|
254 | > readline | |
174 | > pairs 81 |
|
255 | > raw | |
|
256 | > hello\n | |||
|
257 | > readline | |||
|
258 | > raw | |||
|
259 | > between\n | |||
|
260 | > pairs 81\n | |||
175 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
261 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
|
262 | > readline | |||
|
263 | > readline | |||
176 | > EOF |
|
264 | > EOF | |
177 | 0 |
|
265 | using raw connection to peer | |
178 | 384 |
|
266 | i> write(10) -> None: | |
179 | capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN |
|
267 | i> pre-hello\n | |
180 | 1 |
|
268 | o> readline() -> 2: | |
181 |
|
269 | o> 0\n | ||
|
270 | i> write(6) -> None: | |||
|
271 | i> hello\n | |||
|
272 | o> readline() -> 4: | |||
|
273 | o> 384\n | |||
|
274 | i> write(98) -> None: | |||
|
275 | i> between\n | |||
|
276 | i> pairs 81\n | |||
|
277 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |||
|
278 | o> readline() -> 384: | |||
|
279 | o> capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n | |||
|
280 | o> readline() -> 2: | |||
|
281 | o> 1\n | |||
182 |
|
282 | |||
183 | $ hg --config sshpeer.mode=extra-handshake-commands --config sshpeer.handshake-mode=pre-no-args --debug debugpeer ssh://user@dummy/server |
|
283 | $ hg --config sshpeer.mode=extra-handshake-commands --config sshpeer.handshake-mode=pre-no-args --debug debugpeer ssh://user@dummy/server | |
184 | running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !) |
|
284 | running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !) | |
@@ -199,22 +299,54 b' Sending an unknown command to the server' | |||||
199 |
|
299 | |||
200 | Send multiple unknown commands before hello |
|
300 | Send multiple unknown commands before hello | |
201 |
|
301 | |||
202 |
$ hg -R server |
|
302 | $ hg -R server debugwireproto --localssh --peer raw << EOF | |
203 | > unknown1 |
|
303 | > raw | |
204 |
> unknown |
|
304 | > unknown1\n | |
205 | > unknown3 |
|
305 | > readline | |
206 | > hello |
|
306 | > raw | |
207 | > between |
|
307 | > unknown2\n | |
208 | > pairs 81 |
|
308 | > readline | |
|
309 | > raw | |||
|
310 | > unknown3\n | |||
|
311 | > readline | |||
|
312 | > raw | |||
|
313 | > hello\n | |||
|
314 | > readline | |||
|
315 | > readline | |||
|
316 | > raw | |||
|
317 | > between\n | |||
|
318 | > pairs 81\n | |||
209 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
319 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
|
320 | > readline | |||
|
321 | > readline | |||
210 | > EOF |
|
322 | > EOF | |
211 | 0 |
|
323 | using raw connection to peer | |
212 | 0 |
|
324 | i> write(9) -> None: | |
213 | 0 |
|
325 | i> unknown1\n | |
214 | 384 |
|
326 | o> readline() -> 2: | |
215 | capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN |
|
327 | o> 0\n | |
216 | 1 |
|
328 | i> write(9) -> None: | |
217 |
|
329 | i> unknown2\n | ||
|
330 | o> readline() -> 2: | |||
|
331 | o> 0\n | |||
|
332 | i> write(9) -> None: | |||
|
333 | i> unknown3\n | |||
|
334 | o> readline() -> 2: | |||
|
335 | o> 0\n | |||
|
336 | i> write(6) -> None: | |||
|
337 | i> hello\n | |||
|
338 | o> readline() -> 4: | |||
|
339 | o> 384\n | |||
|
340 | o> readline() -> 384: | |||
|
341 | o> capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n | |||
|
342 | i> write(98) -> None: | |||
|
343 | i> between\n | |||
|
344 | i> pairs 81\n | |||
|
345 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |||
|
346 | o> readline() -> 2: | |||
|
347 | o> 1\n | |||
|
348 | o> readline() -> 1: | |||
|
349 | o> \n | |||
218 |
|
350 | |||
219 | $ hg --config sshpeer.mode=extra-handshake-commands --config sshpeer.handshake-mode=pre-multiple-no-args --debug debugpeer ssh://user@dummy/server |
|
351 | $ hg --config sshpeer.mode=extra-handshake-commands --config sshpeer.handshake-mode=pre-multiple-no-args --debug debugpeer ssh://user@dummy/server | |
220 | running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !) |
|
352 | running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !) | |
@@ -239,62 +371,154 b' Send multiple unknown commands before he' | |||||
239 |
|
371 | |||
240 | Send an unknown command before hello that has arguments |
|
372 | Send an unknown command before hello that has arguments | |
241 |
|
373 | |||
242 | $ hg -R server serve --stdio << EOF |
|
374 | $ cd server | |
243 | > with-args |
|
375 | ||
244 | > foo 13 |
|
376 | $ hg debugwireproto --localssh --peer raw << EOF | |
245 | > value for foo |
|
377 | > raw | |
246 | > bar 13 |
|
378 | > with-args\n | |
247 | > value for bar |
|
379 | > foo 13\n | |
248 | > hello |
|
380 | > value for foo\n | |
249 | > between |
|
381 | > bar 13\n | |
250 | > pairs 81 |
|
382 | > value for bar\n | |
|
383 | > readline | |||
|
384 | > readline | |||
|
385 | > readline | |||
|
386 | > readline | |||
|
387 | > readline | |||
|
388 | > raw | |||
|
389 | > hello\n | |||
|
390 | > readline | |||
|
391 | > readline | |||
|
392 | > raw | |||
|
393 | > between\n | |||
|
394 | > pairs 81\n | |||
251 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
395 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
|
396 | > readline | |||
|
397 | > readline | |||
252 | > EOF |
|
398 | > EOF | |
253 | 0 |
|
399 | using raw connection to peer | |
254 | 0 |
|
400 | i> write(52) -> None: | |
255 | 0 |
|
401 | i> with-args\n | |
256 | 0 |
|
402 | i> foo 13\n | |
257 | 0 |
|
403 | i> value for foo\n | |
258 | 384 |
|
404 | i> bar 13\n | |
259 | capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN |
|
405 | i> value for bar\n | |
260 | 1 |
|
406 | o> readline() -> 2: | |
261 |
|
407 | o> 0\n | ||
|
408 | o> readline() -> 2: | |||
|
409 | o> 0\n | |||
|
410 | o> readline() -> 2: | |||
|
411 | o> 0\n | |||
|
412 | o> readline() -> 2: | |||
|
413 | o> 0\n | |||
|
414 | o> readline() -> 2: | |||
|
415 | o> 0\n | |||
|
416 | i> write(6) -> None: | |||
|
417 | i> hello\n | |||
|
418 | o> readline() -> 4: | |||
|
419 | o> 384\n | |||
|
420 | o> readline() -> 384: | |||
|
421 | o> capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n | |||
|
422 | i> write(98) -> None: | |||
|
423 | i> between\n | |||
|
424 | i> pairs 81\n | |||
|
425 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |||
|
426 | o> readline() -> 2: | |||
|
427 | o> 1\n | |||
|
428 | o> readline() -> 1: | |||
|
429 | o> \n | |||
262 |
|
430 | |||
263 | Send an unknown command having an argument that looks numeric |
|
431 | Send an unknown command having an argument that looks numeric | |
264 |
|
432 | |||
265 | $ hg -R server serve --stdio << EOF |
|
433 | $ hg debugwireproto --localssh --peer raw << EOF | |
266 | > unknown |
|
434 | > raw | |
267 | > foo 1 |
|
435 | > unknown\n | |
268 | > 0 |
|
436 | > foo 1\n | |
269 | > hello |
|
437 | > 0\n | |
270 | > between |
|
438 | > readline | |
271 | > pairs 81 |
|
439 | > readline | |
|
440 | > readline | |||
|
441 | > raw | |||
|
442 | > hello\n | |||
|
443 | > readline | |||
|
444 | > readline | |||
|
445 | > raw | |||
|
446 | > between\n | |||
|
447 | > pairs 81\n | |||
272 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
448 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
|
449 | > readline | |||
|
450 | > readline | |||
273 | > EOF |
|
451 | > EOF | |
274 | 0 |
|
452 | using raw connection to peer | |
275 | 0 |
|
453 | i> write(16) -> None: | |
276 | 0 |
|
454 | i> unknown\n | |
277 | 384 |
|
455 | i> foo 1\n | |
278 | capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN |
|
456 | i> 0\n | |
279 | 1 |
|
457 | o> readline() -> 2: | |
280 |
|
458 | o> 0\n | ||
|
459 | o> readline() -> 2: | |||
|
460 | o> 0\n | |||
|
461 | o> readline() -> 2: | |||
|
462 | o> 0\n | |||
|
463 | i> write(6) -> None: | |||
|
464 | i> hello\n | |||
|
465 | o> readline() -> 4: | |||
|
466 | o> 384\n | |||
|
467 | o> readline() -> 384: | |||
|
468 | o> capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n | |||
|
469 | i> write(98) -> None: | |||
|
470 | i> between\n | |||
|
471 | i> pairs 81\n | |||
|
472 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |||
|
473 | o> readline() -> 2: | |||
|
474 | o> 1\n | |||
|
475 | o> readline() -> 1: | |||
|
476 | o> \n | |||
281 |
|
477 | |||
282 | $ hg -R server serve --stdio << EOF |
|
478 | $ hg debugwireproto --localssh --peer raw << EOF | |
283 | > unknown |
|
479 | > raw | |
284 | > foo 1 |
|
480 | > unknown\n | |
285 | > 1 |
|
481 | > foo 1\n | |
286 | > hello |
|
482 | > 1\n | |
287 | > between |
|
483 | > readline | |
288 | > pairs 81 |
|
484 | > readline | |
|
485 | > readline | |||
|
486 | > raw | |||
|
487 | > hello\n | |||
|
488 | > readline | |||
|
489 | > readline | |||
|
490 | > raw | |||
|
491 | > between\n | |||
|
492 | > pairs 81\n | |||
289 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
493 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
|
494 | > readline | |||
|
495 | > readline | |||
290 | > EOF |
|
496 | > EOF | |
291 | 0 |
|
497 | using raw connection to peer | |
292 | 0 |
|
498 | i> write(16) -> None: | |
293 | 0 |
|
499 | i> unknown\n | |
294 | 384 |
|
500 | i> foo 1\n | |
295 | capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN |
|
501 | i> 1\n | |
296 | 1 |
|
502 | o> readline() -> 2: | |
297 |
|
503 | o> 0\n | ||
|
504 | o> readline() -> 2: | |||
|
505 | o> 0\n | |||
|
506 | o> readline() -> 2: | |||
|
507 | o> 0\n | |||
|
508 | i> write(6) -> None: | |||
|
509 | i> hello\n | |||
|
510 | o> readline() -> 4: | |||
|
511 | o> 384\n | |||
|
512 | o> readline() -> 384: | |||
|
513 | o> capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n | |||
|
514 | i> write(98) -> None: | |||
|
515 | i> between\n | |||
|
516 | i> pairs 81\n | |||
|
517 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |||
|
518 | o> readline() -> 2: | |||
|
519 | o> 1\n | |||
|
520 | o> readline() -> 1: | |||
|
521 | o> \n | |||
298 |
|
522 | |||
299 | When sending a dict argument value, it is serialized to |
|
523 | When sending a dict argument value, it is serialized to | |
300 | "<arg> <item count>" followed by "<key> <len>\n<value>" for each item |
|
524 | "<arg> <item count>" followed by "<key> <len>\n<value>" for each item | |
@@ -302,176 +526,402 b' in the dict.' | |||||
302 |
|
526 | |||
303 | Dictionary value for unknown command |
|
527 | Dictionary value for unknown command | |
304 |
|
528 | |||
305 | $ hg -R server serve --stdio << EOF |
|
529 | $ hg debugwireproto --localssh --peer raw << EOF | |
306 | > unknown |
|
530 | > raw | |
307 | > dict 3 |
|
531 | > unknown\n | |
308 | > key1 3 |
|
532 | > dict 3\n | |
309 | > foo |
|
533 | > key1 3\n | |
310 | > key2 3 |
|
534 | > foo\n | |
311 | > bar |
|
535 | > key2 3\n | |
312 | > key3 3 |
|
536 | > bar\n | |
313 | > baz |
|
537 | > key3 3\n | |
314 | > hello |
|
538 | > baz\n | |
|
539 | > readline | |||
|
540 | > readline | |||
|
541 | > readline | |||
|
542 | > readline | |||
|
543 | > readline | |||
|
544 | > readline | |||
|
545 | > readline | |||
|
546 | > readline | |||
|
547 | > raw | |||
|
548 | > hello\n | |||
|
549 | > readline | |||
|
550 | > readline | |||
315 | > EOF |
|
551 | > EOF | |
316 | 0 |
|
552 | using raw connection to peer | |
317 | 0 |
|
553 | i> write(48) -> None: | |
318 | 0 |
|
554 | i> unknown\n | |
319 | 0 |
|
555 | i> dict 3\n | |
320 | 0 |
|
556 | i> key1 3\n | |
321 | 0 |
|
557 | i> foo\n | |
322 | 0 |
|
558 | i> key2 3\n | |
323 | 0 |
|
559 | i> bar\n | |
324 | 384 |
|
560 | i> key3 3\n | |
325 | capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN |
|
561 | i> baz\n | |
|
562 | o> readline() -> 2: | |||
|
563 | o> 0\n | |||
|
564 | o> readline() -> 2: | |||
|
565 | o> 0\n | |||
|
566 | o> readline() -> 2: | |||
|
567 | o> 0\n | |||
|
568 | o> readline() -> 2: | |||
|
569 | o> 0\n | |||
|
570 | o> readline() -> 2: | |||
|
571 | o> 0\n | |||
|
572 | o> readline() -> 2: | |||
|
573 | o> 0\n | |||
|
574 | o> readline() -> 2: | |||
|
575 | o> 0\n | |||
|
576 | o> readline() -> 2: | |||
|
577 | o> 0\n | |||
|
578 | i> write(6) -> None: | |||
|
579 | i> hello\n | |||
|
580 | o> readline() -> 4: | |||
|
581 | o> 384\n | |||
|
582 | o> readline() -> 384: | |||
|
583 | o> capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n | |||
326 |
|
584 | |||
327 | Incomplete dictionary send |
|
585 | Incomplete dictionary send | |
328 |
|
586 | |||
329 | $ hg -R server serve --stdio << EOF |
|
587 | $ hg debugwireproto --localssh --peer raw << EOF | |
330 | > unknown |
|
588 | > raw | |
331 | > dict 3 |
|
589 | > unknown\n | |
332 | > key1 3 |
|
590 | > dict 3\n | |
333 | > foo |
|
591 | > key1 3\n | |
|
592 | > foo\n | |||
|
593 | > readline | |||
|
594 | > readline | |||
|
595 | > readline | |||
|
596 | > readline | |||
334 | > EOF |
|
597 | > EOF | |
335 | 0 |
|
598 | using raw connection to peer | |
336 | 0 |
|
599 | i> write(26) -> None: | |
337 | 0 |
|
600 | i> unknown\n | |
338 | 0 |
|
601 | i> dict 3\n | |
|
602 | i> key1 3\n | |||
|
603 | i> foo\n | |||
|
604 | o> readline() -> 2: | |||
|
605 | o> 0\n | |||
|
606 | o> readline() -> 2: | |||
|
607 | o> 0\n | |||
|
608 | o> readline() -> 2: | |||
|
609 | o> 0\n | |||
|
610 | o> readline() -> 2: | |||
|
611 | o> 0\n | |||
339 |
|
612 | |||
340 | Incomplete value send |
|
613 | Incomplete value send | |
341 |
|
614 | |||
342 | $ hg -R server serve --stdio << EOF |
|
615 | $ hg debugwireproto --localssh --peer raw << EOF | |
343 | > unknown |
|
616 | > raw | |
344 | > dict 3 |
|
617 | > unknown\n | |
345 | > key1 3 |
|
618 | > dict 3\n | |
|
619 | > key1 3\n | |||
346 | > fo |
|
620 | > fo | |
|
621 | > readline | |||
|
622 | > readline | |||
|
623 | > readline | |||
347 | > EOF |
|
624 | > EOF | |
348 | 0 |
|
625 | using raw connection to peer | |
349 | 0 |
|
626 | i> write(24) -> None: | |
350 | 0 |
|
627 | i> unknown\n | |
351 | 0 |
|
628 | i> dict 3\n | |
|
629 | i> key1 3\n | |||
|
630 | i> fo | |||
|
631 | o> readline() -> 2: | |||
|
632 | o> 0\n | |||
|
633 | o> readline() -> 2: | |||
|
634 | o> 0\n | |||
|
635 | o> readline() -> 2: | |||
|
636 | o> 0\n | |||
352 |
|
637 | |||
353 | Send a command line with spaces |
|
638 | Send a command line with spaces | |
354 |
|
639 | |||
355 | $ hg -R server serve --stdio << EOF |
|
640 | $ hg debugwireproto --localssh --peer raw << EOF | |
356 | > unknown withspace |
|
641 | > raw | |
357 | > hello |
|
642 | > unknown withspace\n | |
358 | > between |
|
643 | > readline | |
359 | > pairs 81 |
|
644 | > raw | |
|
645 | > hello\n | |||
|
646 | > readline | |||
|
647 | > readline | |||
|
648 | > raw | |||
|
649 | > between\n | |||
|
650 | > pairs 81\n | |||
360 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
651 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
|
652 | > readline | |||
|
653 | > readline | |||
361 | > EOF |
|
654 | > EOF | |
362 | 0 |
|
655 | using raw connection to peer | |
363 | 384 |
|
656 | i> write(18) -> None: | |
364 | capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN |
|
657 | i> unknown withspace\n | |
365 | 1 |
|
658 | o> readline() -> 2: | |
366 |
|
659 | o> 0\n | ||
|
660 | i> write(6) -> None: | |||
|
661 | i> hello\n | |||
|
662 | o> readline() -> 4: | |||
|
663 | o> 384\n | |||
|
664 | o> readline() -> 384: | |||
|
665 | o> capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n | |||
|
666 | i> write(98) -> None: | |||
|
667 | i> between\n | |||
|
668 | i> pairs 81\n | |||
|
669 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |||
|
670 | o> readline() -> 2: | |||
|
671 | o> 1\n | |||
|
672 | o> readline() -> 1: | |||
|
673 | o> \n | |||
367 |
|
674 | |||
368 | $ hg -R server serve --stdio << EOF |
|
675 | $ hg debugwireproto --localssh --peer raw << EOF | |
369 | > unknown with multiple spaces |
|
676 | > raw | |
370 | > hello |
|
677 | > unknown with multiple spaces\n | |
371 | > between |
|
678 | > readline | |
372 | > pairs 81 |
|
679 | > raw | |
|
680 | > hello\n | |||
|
681 | > readline | |||
|
682 | > readline | |||
|
683 | > raw | |||
|
684 | > between\n | |||
|
685 | > pairs 81\n | |||
373 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
686 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
|
687 | > readline | |||
374 | > EOF |
|
688 | > EOF | |
375 | 0 |
|
689 | using raw connection to peer | |
376 | 384 |
|
690 | i> write(29) -> None: | |
377 | capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN |
|
691 | i> unknown with multiple spaces\n | |
378 | 1 |
|
692 | o> readline() -> 2: | |
379 |
|
693 | o> 0\n | ||
|
694 | i> write(6) -> None: | |||
|
695 | i> hello\n | |||
|
696 | o> readline() -> 4: | |||
|
697 | o> 384\n | |||
|
698 | o> readline() -> 384: | |||
|
699 | o> capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n | |||
|
700 | i> write(98) -> None: | |||
|
701 | i> between\n | |||
|
702 | i> pairs 81\n | |||
|
703 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |||
|
704 | o> readline() -> 2: | |||
|
705 | o> 1\n | |||
380 |
|
706 | |||
381 | $ hg -R server serve --stdio << EOF |
|
707 | $ hg debugwireproto --localssh --peer raw << EOF | |
382 | > unknown with spaces |
|
708 | > raw | |
383 | > key 10 |
|
709 | > unknown with spaces\n | |
384 | > some value |
|
710 | > key 10\n | |
385 | > hello |
|
711 | > some value\n | |
386 | > between |
|
712 | > readline | |
387 | > pairs 81 |
|
713 | > readline | |
|
714 | > readline | |||
|
715 | > raw | |||
|
716 | > hello\n | |||
|
717 | > readline | |||
|
718 | > readline | |||
|
719 | > raw | |||
|
720 | > between\n | |||
|
721 | > pairs 81\n | |||
388 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
722 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
|
723 | > readline | |||
|
724 | > readline | |||
389 | > EOF |
|
725 | > EOF | |
390 | 0 |
|
726 | using raw connection to peer | |
391 | 0 |
|
727 | i> write(38) -> None: | |
392 | 0 |
|
728 | i> unknown with spaces\n | |
393 | 384 |
|
729 | i> key 10\n | |
394 | capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN |
|
730 | i> some value\n | |
395 | 1 |
|
731 | o> readline() -> 2: | |
396 |
|
732 | o> 0\n | ||
|
733 | o> readline() -> 2: | |||
|
734 | o> 0\n | |||
|
735 | o> readline() -> 2: | |||
|
736 | o> 0\n | |||
|
737 | i> write(6) -> None: | |||
|
738 | i> hello\n | |||
|
739 | o> readline() -> 4: | |||
|
740 | o> 384\n | |||
|
741 | o> readline() -> 384: | |||
|
742 | o> capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n | |||
|
743 | i> write(98) -> None: | |||
|
744 | i> between\n | |||
|
745 | i> pairs 81\n | |||
|
746 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |||
|
747 | o> readline() -> 2: | |||
|
748 | o> 1\n | |||
|
749 | o> readline() -> 1: | |||
|
750 | o> \n | |||
397 |
|
751 | |||
398 | Send an unknown command after the "between" |
|
752 | Send an unknown command after the "between" | |
399 |
|
753 | |||
400 | $ hg -R server serve --stdio << EOF |
|
754 | $ hg debugwireproto --localssh --peer raw << EOF | |
401 | > hello |
|
755 | > raw | |
402 | > between |
|
756 | > hello\n | |
403 | > pairs 81 |
|
757 | > readline | |
|
758 | > readline | |||
|
759 | > raw | |||
|
760 | > between\n | |||
|
761 | > pairs 81\n | |||
404 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000unknown |
|
762 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000unknown | |
|
763 | > readline | |||
|
764 | > readline | |||
405 | > EOF |
|
765 | > EOF | |
406 | 384 |
|
766 | using raw connection to peer | |
407 | capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN |
|
767 | i> write(6) -> None: | |
408 | 1 |
|
768 | i> hello\n | |
409 |
|
769 | o> readline() -> 4: | ||
410 | 0 |
|
770 | o> 384\n | |
|
771 | o> readline() -> 384: | |||
|
772 | o> capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n | |||
|
773 | i> write(105) -> None: | |||
|
774 | i> between\n | |||
|
775 | i> pairs 81\n | |||
|
776 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000unknown | |||
|
777 | o> readline() -> 2: | |||
|
778 | o> 1\n | |||
|
779 | o> readline() -> 1: | |||
|
780 | o> \n | |||
411 |
|
781 | |||
412 | And one with arguments |
|
782 | And one with arguments | |
413 |
|
783 | |||
414 | $ hg -R server serve --stdio << EOF |
|
784 | $ hg debugwireproto --localssh --peer raw << EOF | |
415 | > hello |
|
785 | > raw | |
416 | > between |
|
786 | > hello\n | |
417 | > pairs 81 |
|
787 | > between\n | |
418 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000unknown |
|
788 | > pairs 81\n | |
419 | > foo 5 |
|
789 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
420 |
> |
|
790 | > readline | |
421 | > bar 3 |
|
791 | > readline | |
422 | > baz |
|
792 | > readline | |
|
793 | > readline | |||
|
794 | > raw | |||
|
795 | > unknown\n | |||
|
796 | > foo 5\n | |||
|
797 | > \nvalue\n | |||
|
798 | > bar 3\n | |||
|
799 | > baz\n | |||
|
800 | > readline | |||
|
801 | > readline | |||
|
802 | > readline | |||
423 | > EOF |
|
803 | > EOF | |
424 | 384 |
|
804 | using raw connection to peer | |
425 | capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN |
|
805 | i> write(104) -> None: | |
426 | 1 |
|
806 | i> hello\n | |
427 |
|
807 | i> between\n | ||
428 | 0 |
|
808 | i> pairs 81\n | |
429 | 0 |
|
809 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
430 | 0 |
|
810 | o> readline() -> 4: | |
431 | 0 |
|
811 | o> 384\n | |
432 | 0 |
|
812 | o> readline() -> 384: | |
|
813 | o> capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n | |||
|
814 | o> readline() -> 2: | |||
|
815 | o> 1\n | |||
|
816 | o> readline() -> 1: | |||
|
817 | o> \n | |||
|
818 | i> write(31) -> None: | |||
|
819 | i> unknown\n | |||
|
820 | i> foo 5\n | |||
|
821 | i> \n | |||
|
822 | i> value\n | |||
|
823 | i> bar 3\n | |||
|
824 | i> baz\n | |||
|
825 | o> readline() -> 2: | |||
|
826 | o> 0\n | |||
|
827 | o> readline() -> 2: | |||
|
828 | o> 0\n | |||
|
829 | o> readline() -> 0: | |||
433 |
|
830 | |||
434 | Send a valid command before the handshake |
|
831 | Send a valid command before the handshake | |
435 |
|
832 | |||
436 | $ hg -R server serve --stdio << EOF |
|
833 | $ hg debugwireproto --localssh --peer raw << EOF | |
437 |
> |
|
834 | > raw | |
438 | > hello |
|
835 | > heads\n | |
439 | > between |
|
836 | > readline | |
440 | > pairs 81 |
|
837 | > raw | |
|
838 | > hello\n | |||
|
839 | > between\n | |||
|
840 | > pairs 81\n | |||
441 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
841 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
|
842 | > readline | |||
|
843 | > readline | |||
|
844 | > readline | |||
|
845 | > readline | |||
442 | > EOF |
|
846 | > EOF | |
443 | 41 |
|
847 | using raw connection to peer | |
444 | 68986213bd4485ea51533535e3fc9e78007a711f |
|
848 | i> write(6) -> None: | |
445 | 384 |
|
849 | i> heads\n | |
446 | capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN |
|
850 | o> readline() -> 3: | |
447 | 1 |
|
851 | o> 41\n | |
448 |
|
852 | i> write(104) -> None: | ||
|
853 | i> hello\n | |||
|
854 | i> between\n | |||
|
855 | i> pairs 81\n | |||
|
856 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |||
|
857 | o> readline() -> 41: | |||
|
858 | o> 68986213bd4485ea51533535e3fc9e78007a711f\n | |||
|
859 | o> readline() -> 4: | |||
|
860 | o> 384\n | |||
|
861 | o> readline() -> 384: | |||
|
862 | o> capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n | |||
|
863 | o> readline() -> 2: | |||
|
864 | o> 1\n | |||
449 |
|
865 | |||
450 | And a variation that doesn't send the between command |
|
866 | And a variation that doesn't send the between command | |
451 |
|
867 | |||
452 | $ hg -R server serve --stdio << EOF |
|
868 | $ hg debugwireproto --localssh --peer raw << EOF | |
453 |
> |
|
869 | > raw | |
454 | > hello |
|
870 | > heads\n | |
|
871 | > readline | |||
|
872 | > raw | |||
|
873 | > hello\n | |||
|
874 | > readline | |||
|
875 | > readline | |||
455 | > EOF |
|
876 | > EOF | |
456 | 41 |
|
877 | using raw connection to peer | |
457 | 68986213bd4485ea51533535e3fc9e78007a711f |
|
878 | i> write(6) -> None: | |
458 | 384 |
|
879 | i> heads\n | |
459 | capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN |
|
880 | o> readline() -> 3: | |
|
881 | o> 41\n | |||
|
882 | i> write(6) -> None: | |||
|
883 | i> hello\n | |||
|
884 | o> readline() -> 41: | |||
|
885 | o> 68986213bd4485ea51533535e3fc9e78007a711f\n | |||
|
886 | o> readline() -> 4: | |||
|
887 | o> 384\n | |||
460 |
|
888 | |||
461 | Send an upgrade request to a server that doesn't support that command |
|
889 | Send an upgrade request to a server that doesn't support that command | |
462 |
|
890 | |||
463 | $ hg -R server serve --stdio << EOF |
|
891 | $ hg debugwireproto --localssh --peer raw << EOF | |
464 | > upgrade 2e82ab3f-9ce3-4b4e-8f8c-6fd1c0e9e23a proto=irrelevant1%2Cirrelevant2 |
|
892 | > raw | |
465 | > hello |
|
893 | > upgrade 2e82ab3f-9ce3-4b4e-8f8c-6fd1c0e9e23a proto=irrelevant1%2Cirrelevant2\n | |
466 | > between |
|
894 | > readline | |
467 | > pairs 81 |
|
895 | > raw | |
|
896 | > hello\n | |||
|
897 | > between\n | |||
|
898 | > pairs 81\n | |||
468 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
899 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
|
900 | > readline | |||
|
901 | > readline | |||
|
902 | > readline | |||
|
903 | > readline | |||
469 | > EOF |
|
904 | > EOF | |
470 | 0 |
|
905 | using raw connection to peer | |
471 | 384 |
|
906 | i> write(77) -> None: | |
472 | capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN |
|
907 | i> upgrade 2e82ab3f-9ce3-4b4e-8f8c-6fd1c0e9e23a proto=irrelevant1%2Cirrelevant2\n | |
473 | 1 |
|
908 | o> readline() -> 2: | |
|
909 | o> 0\n | |||
|
910 | i> write(104) -> None: | |||
|
911 | i> hello\n | |||
|
912 | i> between\n | |||
|
913 | i> pairs 81\n | |||
|
914 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |||
|
915 | o> readline() -> 4: | |||
|
916 | o> 384\n | |||
|
917 | o> readline() -> 384: | |||
|
918 | o> capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n | |||
|
919 | o> readline() -> 2: | |||
|
920 | o> 1\n | |||
|
921 | o> readline() -> 1: | |||
|
922 | o> \n | |||
474 |
|
923 | |||
|
924 | $ cd .. | |||
475 |
|
925 | |||
476 | $ hg --config experimental.sshpeer.advertise-v2=true --debug debugpeer ssh://user@dummy/server |
|
926 | $ hg --config experimental.sshpeer.advertise-v2=true --debug debugpeer ssh://user@dummy/server | |
477 | running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !) |
|
927 | running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !) | |
@@ -500,17 +950,34 b' use --config with `hg serve --stdio`.' | |||||
500 |
|
950 | |||
501 | Send an upgrade request to a server that supports upgrade |
|
951 | Send an upgrade request to a server that supports upgrade | |
502 |
|
952 | |||
503 | >>> with open('payload', 'wb') as fh: |
|
953 | $ cd server | |
504 | ... fh.write(b'upgrade this-is-some-token proto=exp-ssh-v2-0001\n') |
|
|||
505 | ... fh.write(b'hello\n') |
|
|||
506 | ... fh.write(b'between\n') |
|
|||
507 | ... fh.write(b'pairs 81\n') |
|
|||
508 | ... fh.write(b'0000000000000000000000000000000000000000-0000000000000000000000000000000000000000') |
|
|||
509 |
|
954 | |||
510 | $ hg -R server serve --stdio < payload |
|
955 | $ hg debugwireproto --localssh --peer raw << EOF | |
511 | upgraded this-is-some-token exp-ssh-v2-0001 |
|
956 | > raw | |
512 | 383 |
|
957 | > upgrade this-is-some-token proto=exp-ssh-v2-0001\n | |
513 | capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN |
|
958 | > hello\n | |
|
959 | > between\n | |||
|
960 | > pairs 81\n | |||
|
961 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |||
|
962 | > readline | |||
|
963 | > readline | |||
|
964 | > readline | |||
|
965 | > EOF | |||
|
966 | using raw connection to peer | |||
|
967 | i> write(153) -> None: | |||
|
968 | i> upgrade this-is-some-token proto=exp-ssh-v2-0001\n | |||
|
969 | i> hello\n | |||
|
970 | i> between\n | |||
|
971 | i> pairs 81\n | |||
|
972 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |||
|
973 | o> readline() -> 44: | |||
|
974 | o> upgraded this-is-some-token exp-ssh-v2-0001\n | |||
|
975 | o> readline() -> 4: | |||
|
976 | o> 383\n | |||
|
977 | o> readline() -> 384: | |||
|
978 | o> capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n | |||
|
979 | ||||
|
980 | $ cd .. | |||
514 |
|
981 | |||
515 | $ hg --config experimental.sshpeer.advertise-v2=true --debug debugpeer ssh://user@dummy/server |
|
982 | $ hg --config experimental.sshpeer.advertise-v2=true --debug debugpeer ssh://user@dummy/server | |
516 | running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !) |
|
983 | running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !) | |
@@ -578,95 +1045,210 b' Verify the peer has capabilities' | |||||
578 |
|
1045 | |||
579 | Command after upgrade to version 2 is processed |
|
1046 | Command after upgrade to version 2 is processed | |
580 |
|
1047 | |||
581 | >>> with open('payload', 'wb') as fh: |
|
1048 | $ cd server | |
582 | ... fh.write(b'upgrade this-is-some-token proto=exp-ssh-v2-0001\n') |
|
1049 | ||
583 | ... fh.write(b'hello\n') |
|
1050 | $ hg debugwireproto --localssh --peer raw << EOF | |
584 | ... fh.write(b'between\n') |
|
1051 | > raw | |
585 | ... fh.write(b'pairs 81\n') |
|
1052 | > upgrade this-is-some-token proto=exp-ssh-v2-0001\n | |
586 | ... fh.write(b'0000000000000000000000000000000000000000-0000000000000000000000000000000000000000') |
|
1053 | > hello\n | |
587 | ... fh.write(b'hello\n') |
|
1054 | > between\n | |
588 | $ hg -R server serve --stdio < payload |
|
1055 | > pairs 81\n | |
589 | upgraded this-is-some-token exp-ssh-v2-0001 |
|
1056 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
590 | 383 |
|
1057 | > readline | |
591 | capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN |
|
1058 | > readline | |
592 | 384 |
|
1059 | > readline | |
593 | capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN |
|
1060 | > raw | |
|
1061 | > hello\n | |||
|
1062 | > readline | |||
|
1063 | > readline | |||
|
1064 | > EOF | |||
|
1065 | using raw connection to peer | |||
|
1066 | i> write(153) -> None: | |||
|
1067 | i> upgrade this-is-some-token proto=exp-ssh-v2-0001\n | |||
|
1068 | i> hello\n | |||
|
1069 | i> between\n | |||
|
1070 | i> pairs 81\n | |||
|
1071 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |||
|
1072 | o> readline() -> 44: | |||
|
1073 | o> upgraded this-is-some-token exp-ssh-v2-0001\n | |||
|
1074 | o> readline() -> 4: | |||
|
1075 | o> 383\n | |||
|
1076 | o> readline() -> 384: | |||
|
1077 | o> capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n | |||
|
1078 | i> write(6) -> None: | |||
|
1079 | i> hello\n | |||
|
1080 | o> readline() -> 4: | |||
|
1081 | o> 384\n | |||
|
1082 | o> readline() -> 384: | |||
|
1083 | o> capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n | |||
594 |
|
1084 | |||
595 | Multiple upgrades is not allowed |
|
1085 | Multiple upgrades is not allowed | |
596 |
|
1086 | |||
597 | >>> with open('payload', 'wb') as fh: |
|
1087 | $ hg debugwireproto --localssh --peer raw << EOF | |
598 | ... fh.write(b'upgrade this-is-some-token proto=exp-ssh-v2-0001\n') |
|
1088 | > raw | |
599 | ... fh.write(b'hello\n') |
|
1089 | > upgrade this-is-some-token proto=exp-ssh-v2-0001\n | |
600 | ... fh.write(b'between\n') |
|
1090 | > hello\n | |
601 | ... fh.write(b'pairs 81\n') |
|
1091 | > between\n | |
602 | ... fh.write(b'0000000000000000000000000000000000000000-0000000000000000000000000000000000000000') |
|
1092 | > pairs 81\n | |
603 | ... fh.write(b'upgrade another-token proto=irrelevant\n') |
|
1093 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
604 | ... fh.write(b'hello\n') |
|
1094 | > readline | |
605 | $ hg -R server serve --stdio < payload |
|
1095 | > readline | |
606 | upgraded this-is-some-token exp-ssh-v2-0001 |
|
1096 | > readline | |
607 | 383 |
|
1097 | > raw | |
608 | capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN |
|
1098 | > upgrade another-token proto=irrelevant\n | |
609 | cannot upgrade protocols multiple times |
|
1099 | > hello\n | |
610 | - |
|
1100 | > readline | |
611 |
|
1101 | > readavailable | ||
|
1102 | > EOF | |||
|
1103 | using raw connection to peer | |||
|
1104 | i> write(153) -> None: | |||
|
1105 | i> upgrade this-is-some-token proto=exp-ssh-v2-0001\n | |||
|
1106 | i> hello\n | |||
|
1107 | i> between\n | |||
|
1108 | i> pairs 81\n | |||
|
1109 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |||
|
1110 | o> readline() -> 44: | |||
|
1111 | o> upgraded this-is-some-token exp-ssh-v2-0001\n | |||
|
1112 | o> readline() -> 4: | |||
|
1113 | o> 383\n | |||
|
1114 | o> readline() -> 384: | |||
|
1115 | o> capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n | |||
|
1116 | i> write(45) -> None: | |||
|
1117 | i> upgrade another-token proto=irrelevant\n | |||
|
1118 | i> hello\n | |||
|
1119 | o> readline() -> 1: | |||
|
1120 | o> \n | |||
|
1121 | e> read(-1) -> 42: | |||
|
1122 | e> cannot upgrade protocols multiple times\n | |||
|
1123 | e> -\n | |||
612 |
|
1124 | |||
613 | Malformed upgrade request line (not exactly 3 space delimited tokens) |
|
1125 | Malformed upgrade request line (not exactly 3 space delimited tokens) | |
614 |
|
1126 | |||
615 | $ hg -R server serve --stdio << EOF |
|
1127 | $ hg debugwireproto --localssh --peer raw << EOF | |
616 |
> |
|
1128 | > raw | |
|
1129 | > upgrade\n | |||
|
1130 | > readline | |||
617 | > EOF |
|
1131 | > EOF | |
618 | 0 |
|
1132 | using raw connection to peer | |
|
1133 | i> write(8) -> None: | |||
|
1134 | i> upgrade\n | |||
|
1135 | o> readline() -> 2: | |||
|
1136 | o> 0\n | |||
619 |
|
1137 | |||
620 | $ hg -R server serve --stdio << EOF |
|
1138 | $ hg debugwireproto --localssh --peer raw << EOF | |
621 | > upgrade token |
|
1139 | > raw | |
|
1140 | > upgrade token\n | |||
|
1141 | > readline | |||
622 | > EOF |
|
1142 | > EOF | |
623 | 0 |
|
1143 | using raw connection to peer | |
|
1144 | i> write(14) -> None: | |||
|
1145 | i> upgrade token\n | |||
|
1146 | o> readline() -> 2: | |||
|
1147 | o> 0\n | |||
624 |
|
1148 | |||
625 | $ hg -R server serve --stdio << EOF |
|
1149 | $ hg debugwireproto --localssh --peer raw << EOF | |
626 | > upgrade token foo=bar extra-token |
|
1150 | > raw | |
|
1151 | > upgrade token foo=bar extra-token\n | |||
|
1152 | > readline | |||
627 | > EOF |
|
1153 | > EOF | |
628 | 0 |
|
1154 | using raw connection to peer | |
|
1155 | i> write(34) -> None: | |||
|
1156 | i> upgrade token foo=bar extra-token\n | |||
|
1157 | o> readline() -> 2: | |||
|
1158 | o> 0\n | |||
629 |
|
1159 | |||
630 | Upgrade request to unsupported protocol is ignored |
|
1160 | Upgrade request to unsupported protocol is ignored | |
631 |
|
1161 | |||
632 | $ hg -R server serve --stdio << EOF |
|
1162 | $ hg debugwireproto --localssh --peer raw << EOF | |
633 | > upgrade this-is-some-token proto=unknown1,unknown2 |
|
1163 | > raw | |
634 | > hello |
|
1164 | > upgrade this-is-some-token proto=unknown1,unknown2\n | |
635 | > between |
|
1165 | > readline | |
636 | > pairs 81 |
|
1166 | > raw | |
|
1167 | > hello\n | |||
|
1168 | > readline | |||
|
1169 | > readline | |||
|
1170 | > raw | |||
|
1171 | > between\n | |||
|
1172 | > pairs 81\n | |||
637 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1173 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
|
1174 | > readline | |||
|
1175 | > readline | |||
638 | > EOF |
|
1176 | > EOF | |
639 | 0 |
|
1177 | using raw connection to peer | |
640 | 384 |
|
1178 | i> write(51) -> None: | |
641 | capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN |
|
1179 | i> upgrade this-is-some-token proto=unknown1,unknown2\n | |
642 | 1 |
|
1180 | o> readline() -> 2: | |
643 |
|
1181 | o> 0\n | ||
|
1182 | i> write(6) -> None: | |||
|
1183 | i> hello\n | |||
|
1184 | o> readline() -> 4: | |||
|
1185 | o> 384\n | |||
|
1186 | o> readline() -> 384: | |||
|
1187 | o> capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n | |||
|
1188 | i> write(98) -> None: | |||
|
1189 | i> between\n | |||
|
1190 | i> pairs 81\n | |||
|
1191 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |||
|
1192 | o> readline() -> 2: | |||
|
1193 | o> 1\n | |||
|
1194 | o> readline() -> 1: | |||
|
1195 | o> \n | |||
644 |
|
1196 | |||
645 | Upgrade request must be followed by hello + between |
|
1197 | Upgrade request must be followed by hello + between | |
646 |
|
1198 | |||
647 | $ hg -R server serve --stdio << EOF |
|
1199 | $ hg debugwireproto --localssh --peer raw << EOF | |
648 | > upgrade token proto=exp-ssh-v2-0001 |
|
1200 | > raw | |
649 | > invalid |
|
1201 | > upgrade token proto=exp-ssh-v2-0001\n | |
|
1202 | > invalid\n | |||
|
1203 | > readline | |||
|
1204 | > readavailable | |||
650 | > EOF |
|
1205 | > EOF | |
651 | malformed handshake protocol: missing hello |
|
1206 | using raw connection to peer | |
652 | - |
|
1207 | i> write(44) -> None: | |
653 |
|
1208 | i> upgrade token proto=exp-ssh-v2-0001\n | ||
|
1209 | i> invalid\n | |||
|
1210 | o> readline() -> 1: | |||
|
1211 | o> \n | |||
|
1212 | e> read(-1) -> 46: | |||
|
1213 | e> malformed handshake protocol: missing hello\n | |||
|
1214 | e> -\n | |||
654 |
|
1215 | |||
655 | $ hg -R server serve --stdio << EOF |
|
1216 | $ hg debugwireproto --localssh --peer raw << EOF | |
656 | > upgrade token proto=exp-ssh-v2-0001 |
|
1217 | > raw | |
657 | > hello |
|
1218 | > upgrade token proto=exp-ssh-v2-0001\n | |
658 | > invalid |
|
1219 | > hello\n | |
|
1220 | > invalid\n | |||
|
1221 | > readline | |||
|
1222 | > readavailable | |||
659 | > EOF |
|
1223 | > EOF | |
660 | malformed handshake protocol: missing between |
|
1224 | using raw connection to peer | |
661 | - |
|
1225 | i> write(50) -> None: | |
662 |
|
1226 | i> upgrade token proto=exp-ssh-v2-0001\n | ||
|
1227 | i> hello\n | |||
|
1228 | i> invalid\n | |||
|
1229 | o> readline() -> 1: | |||
|
1230 | o> \n | |||
|
1231 | e> read(-1) -> 48: | |||
|
1232 | e> malformed handshake protocol: missing between\n | |||
|
1233 | e> -\n | |||
663 |
|
1234 | |||
664 | $ hg -R server serve --stdio << EOF |
|
1235 | $ hg debugwireproto --localssh --peer raw << EOF | |
665 | > upgrade token proto=exp-ssh-v2-0001 |
|
1236 | > raw | |
666 | > hello |
|
1237 | > upgrade token proto=exp-ssh-v2-0001\n | |
667 | > between |
|
1238 | > hello\n | |
668 | > invalid |
|
1239 | > between\n | |
|
1240 | > invalid\n | |||
|
1241 | > readline | |||
|
1242 | > readavailable | |||
669 | > EOF |
|
1243 | > EOF | |
670 | malformed handshake protocol: missing pairs 81 |
|
1244 | using raw connection to peer | |
671 | - |
|
1245 | i> write(58) -> None: | |
672 |
|
1246 | i> upgrade token proto=exp-ssh-v2-0001\n | ||
|
1247 | i> hello\n | |||
|
1248 | i> between\n | |||
|
1249 | i> invalid\n | |||
|
1250 | o> readline() -> 1: | |||
|
1251 | o> \n | |||
|
1252 | e> read(-1) -> 49: | |||
|
1253 | e> malformed handshake protocol: missing pairs 81\n | |||
|
1254 | e> -\n |
General Comments 0
You need to be logged in to leave comments.
Login now