Show More
@@ -17,6 +17,7 b' import random' | |||
|
17 | 17 | import socket |
|
18 | 18 | import ssl |
|
19 | 19 | import string |
|
20 | import subprocess | |
|
20 | 21 | import sys |
|
21 | 22 | import tempfile |
|
22 | 23 | import time |
@@ -65,6 +66,7 b' from . import (' | |||
|
65 | 66 | setdiscovery, |
|
66 | 67 | simplemerge, |
|
67 | 68 | smartset, |
|
69 | sshpeer, | |
|
68 | 70 | sslutil, |
|
69 | 71 | streamclone, |
|
70 | 72 | templater, |
@@ -2529,3 +2531,204 b' def debugwireargs(ui, repopath, *vals, *' | |||
|
2529 | 2531 | ui.write("%s\n" % res1) |
|
2530 | 2532 | if res1 != res2: |
|
2531 | 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 | 121 | debugupgraderepo |
|
122 | 122 | debugwalk |
|
123 | 123 | debugwireargs |
|
124 | debugwireproto | |
|
124 | 125 | |
|
125 | 126 | Do not show the alias of a debug command if there are other candidates |
|
126 | 127 | (this should hide rawcommit) |
@@ -302,6 +303,7 b' Show all commands + options' | |||
|
302 | 303 | debugupgraderepo: optimize, run |
|
303 | 304 | debugwalk: include, exclude |
|
304 | 305 | debugwireargs: three, four, five, ssh, remotecmd, insecure |
|
306 | debugwireproto: localssh, peer, ssh, remotecmd, insecure | |
|
305 | 307 | files: rev, print0, include, exclude, template, subrepos |
|
306 | 308 | graft: rev, continue, edit, log, force, currentdate, currentuser, date, user, tool, dry-run |
|
307 | 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 | 983 | debugwalk show how files match on given patterns |
|
984 | 984 | debugwireargs |
|
985 | 985 | (no help text available) |
|
986 | debugwireproto | |
|
987 | send wire protocol commands to a server | |
|
986 | 988 | |
|
987 | 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, (1222 lines changed) Show them Hide them | |||
@@ -12,10 +12,29 b'' | |||
|
12 | 12 | $ echo 0 > foo |
|
13 | 13 | $ hg -q add foo |
|
14 | 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 | 34 | Test a normal behaving server, for sanity |
|
18 | 35 | |
|
36 | $ cd .. | |
|
37 | ||
|
19 | 38 | $ hg --debug debugpeer ssh://user@dummy/server |
|
20 | 39 | running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !) |
|
21 | 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 | 53 | Server should answer the "hello" command in isolation |
|
35 | 54 | |
|
36 |
$ hg -R server |
|
|
37 | > hello | |
|
55 | $ hg -R server debugwireproto --localssh --peer raw << EOF | |
|
56 | > raw | |
|
57 | > hello\n | |
|
58 | > readline | |
|
59 | > readline | |
|
38 | 60 | > EOF |
|
39 | 384 | |
|
40 | capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN | |
|
61 | using raw connection to peer | |
|
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 | 69 | `hg debugserve --sshstdio` works |
|
43 | 70 | |
@@ -80,16 +107,33 b' I/O logging works' | |||
|
80 | 107 | Server should reply with capabilities and should send "1\n\n" as a successful |
|
81 | 108 | reply with empty response to the "between". |
|
82 | 109 | |
|
83 |
$ hg -R server |
|
|
84 | > hello | |
|
85 | > between | |
|
86 | > pairs 81 | |
|
87 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
|
110 | $ hg -R server debugwireproto --localssh --peer raw << EOF | |
|
111 | > raw | |
|
112 | > hello\n | |
|
113 | > readline | |
|
114 | > readline | |
|
115 | > raw | |
|
116 | > between\n | |
|
117 | > pairs 81\n | |
|
118 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
|
119 | > readline | |
|
120 | > readline | |
|
88 | 121 | > EOF |
|
89 | 384 | |
|
90 | capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN | |
|
91 | 1 | |
|
92 | ||
|
122 | using raw connection to peer | |
|
123 | i> write(6) -> None: | |
|
124 | i> hello\n | |
|
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 | 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 | 172 | And test the banner with the raw protocol |
|
129 | 173 | |
|
130 |
$ SSHSERVERMODE=banner hg -R server |
|
|
131 | > hello | |
|
132 | > between | |
|
133 | > pairs 81 | |
|
134 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
|
174 | $ SSHSERVERMODE=banner hg -R server debugwireproto --localssh --peer raw << EOF | |
|
175 | > raw | |
|
176 | > hello\n | |
|
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 | |
|
192 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
|
193 | > readline | |
|
194 | > readline | |
|
135 | 195 | > EOF |
|
136 | banner: line 0 | |
|
137 | banner: line 1 | |
|
138 | banner: line 2 | |
|
139 | banner: line 3 | |
|
140 |
banner: line |
|
|
141 | banner: line 5 | |
|
142 |
banner: line |
|
|
143 | banner: line 7 | |
|
144 |
banner: line |
|
|
145 | banner: line 9 | |
|
146 | 384 | |
|
147 | capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN | |
|
148 | 1 | |
|
149 | ||
|
196 | using raw connection to peer | |
|
197 | i> write(6) -> None: | |
|
198 | i> hello\n | |
|
199 | o> readline() -> 15: | |
|
200 | o> banner: line 0\n | |
|
201 | o> readline() -> 15: | |
|
202 | o> banner: line 1\n | |
|
203 | o> readline() -> 15: | |
|
204 | o> banner: line 2\n | |
|
205 | o> readline() -> 15: | |
|
206 | o> banner: line 3\n | |
|
207 | o> readline() -> 15: | |
|
208 | o> banner: line 4\n | |
|
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 | 232 | Connecting to a <0.9.1 server that doesn't support the hello command. |
|
152 | 233 | The client should refuse, as we dropped support for connecting to such |
@@ -167,18 +248,37 b' servers.' | |||
|
167 | 248 | |
|
168 | 249 | Sending an unknown command to the server results in an empty response to that command |
|
169 | 250 | |
|
170 |
$ hg -R server |
|
|
171 | > pre-hello | |
|
172 | > hello | |
|
173 | > between | |
|
174 | > pairs 81 | |
|
175 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
|
251 | $ hg -R server debugwireproto --localssh --peer raw << EOF | |
|
252 | > raw | |
|
253 | > pre-hello\n | |
|
254 | > readline | |
|
255 | > raw | |
|
256 | > hello\n | |
|
257 | > readline | |
|
258 | > raw | |
|
259 | > between\n | |
|
260 | > pairs 81\n | |
|
261 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
|
262 | > readline | |
|
263 | > readline | |
|
176 | 264 | > EOF |
|
177 | 0 | |
|
178 | 384 | |
|
179 | capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN | |
|
180 | 1 | |
|
181 | ||
|
265 | using raw connection to peer | |
|
266 | i> write(10) -> None: | |
|
267 | i> pre-hello\n | |
|
268 | o> readline() -> 2: | |
|
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 | 283 | $ hg --config sshpeer.mode=extra-handshake-commands --config sshpeer.handshake-mode=pre-no-args --debug debugpeer ssh://user@dummy/server |
|
184 | 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 | 300 | Send multiple unknown commands before hello |
|
201 | 301 | |
|
202 |
$ hg -R server |
|
|
203 | > unknown1 | |
|
204 |
> unknown |
|
|
205 | > unknown3 | |
|
206 | > hello | |
|
207 | > between | |
|
208 | > pairs 81 | |
|
209 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
|
302 | $ hg -R server debugwireproto --localssh --peer raw << EOF | |
|
303 | > raw | |
|
304 | > unknown1\n | |
|
305 | > readline | |
|
306 | > raw | |
|
307 | > unknown2\n | |
|
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 | |
|
319 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
|
320 | > readline | |
|
321 | > readline | |
|
210 | 322 | > EOF |
|
211 | 0 | |
|
212 | 0 | |
|
213 | 0 | |
|
214 | 384 | |
|
215 | capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN | |
|
216 | 1 | |
|
217 | ||
|
323 | using raw connection to peer | |
|
324 | i> write(9) -> None: | |
|
325 | i> unknown1\n | |
|
326 | o> readline() -> 2: | |
|
327 | o> 0\n | |
|
328 | i> write(9) -> None: | |
|
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 | 351 | $ hg --config sshpeer.mode=extra-handshake-commands --config sshpeer.handshake-mode=pre-multiple-no-args --debug debugpeer ssh://user@dummy/server |
|
220 | 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 | 372 | Send an unknown command before hello that has arguments |
|
241 | 373 | |
|
242 | $ hg -R server serve --stdio << EOF | |
|
243 | > with-args | |
|
244 | > foo 13 | |
|
245 | > value for foo | |
|
246 | > bar 13 | |
|
247 | > value for bar | |
|
248 | > hello | |
|
249 | > between | |
|
250 | > pairs 81 | |
|
251 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
|
374 | $ cd server | |
|
375 | ||
|
376 | $ hg debugwireproto --localssh --peer raw << EOF | |
|
377 | > raw | |
|
378 | > with-args\n | |
|
379 | > foo 13\n | |
|
380 | > value for foo\n | |
|
381 | > bar 13\n | |
|
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 | |
|
395 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
|
396 | > readline | |
|
397 | > readline | |
|
252 | 398 | > EOF |
|
253 | 0 | |
|
254 | 0 | |
|
255 | 0 | |
|
256 | 0 | |
|
257 | 0 | |
|
258 | 384 | |
|
259 | capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN | |
|
260 | 1 | |
|
261 | ||
|
399 | using raw connection to peer | |
|
400 | i> write(52) -> None: | |
|
401 | i> with-args\n | |
|
402 | i> foo 13\n | |
|
403 | i> value for foo\n | |
|
404 | i> bar 13\n | |
|
405 | i> value for bar\n | |
|
406 | o> readline() -> 2: | |
|
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 | 431 | Send an unknown command having an argument that looks numeric |
|
264 | 432 | |
|
265 | $ hg -R server serve --stdio << EOF | |
|
266 | > unknown | |
|
267 | > foo 1 | |
|
268 | > 0 | |
|
269 | > hello | |
|
270 | > between | |
|
271 | > pairs 81 | |
|
272 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
|
433 | $ hg debugwireproto --localssh --peer raw << EOF | |
|
434 | > raw | |
|
435 | > unknown\n | |
|
436 | > foo 1\n | |
|
437 | > 0\n | |
|
438 | > readline | |
|
439 | > readline | |
|
440 | > readline | |
|
441 | > raw | |
|
442 | > hello\n | |
|
443 | > readline | |
|
444 | > readline | |
|
445 | > raw | |
|
446 | > between\n | |
|
447 | > pairs 81\n | |
|
448 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
|
449 | > readline | |
|
450 | > readline | |
|
273 | 451 | > EOF |
|
274 | 0 | |
|
275 | 0 | |
|
276 | 0 | |
|
277 | 384 | |
|
278 | capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN | |
|
279 | 1 | |
|
280 | ||
|
452 | using raw connection to peer | |
|
453 | i> write(16) -> None: | |
|
454 | i> unknown\n | |
|
455 | i> foo 1\n | |
|
456 | i> 0\n | |
|
457 | o> readline() -> 2: | |
|
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 | |
|
283 | > unknown | |
|
284 | > foo 1 | |
|
285 | > 1 | |
|
286 | > hello | |
|
287 | > between | |
|
288 | > pairs 81 | |
|
289 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
|
478 | $ hg debugwireproto --localssh --peer raw << EOF | |
|
479 | > raw | |
|
480 | > unknown\n | |
|
481 | > foo 1\n | |
|
482 | > 1\n | |
|
483 | > readline | |
|
484 | > readline | |
|
485 | > readline | |
|
486 | > raw | |
|
487 | > hello\n | |
|
488 | > readline | |
|
489 | > readline | |
|
490 | > raw | |
|
491 | > between\n | |
|
492 | > pairs 81\n | |
|
493 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
|
494 | > readline | |
|
495 | > readline | |
|
290 | 496 | > EOF |
|
291 | 0 | |
|
292 | 0 | |
|
293 | 0 | |
|
294 | 384 | |
|
295 | capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN | |
|
296 | 1 | |
|
297 | ||
|
497 | using raw connection to peer | |
|
498 | i> write(16) -> None: | |
|
499 | i> unknown\n | |
|
500 | i> foo 1\n | |
|
501 | i> 1\n | |
|
502 | o> readline() -> 2: | |
|
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 | 523 | When sending a dict argument value, it is serialized to |
|
300 | 524 | "<arg> <item count>" followed by "<key> <len>\n<value>" for each item |
@@ -302,176 +526,402 b' in the dict.' | |||
|
302 | 526 | |
|
303 | 527 | Dictionary value for unknown command |
|
304 | 528 | |
|
305 | $ hg -R server serve --stdio << EOF | |
|
306 | > unknown | |
|
307 | > dict 3 | |
|
308 | > key1 3 | |
|
309 | > foo | |
|
310 | > key2 3 | |
|
311 | > bar | |
|
312 | > key3 3 | |
|
313 | > baz | |
|
314 | > hello | |
|
529 | $ hg debugwireproto --localssh --peer raw << EOF | |
|
530 | > raw | |
|
531 | > unknown\n | |
|
532 | > dict 3\n | |
|
533 | > key1 3\n | |
|
534 | > foo\n | |
|
535 | > key2 3\n | |
|
536 | > bar\n | |
|
537 | > key3 3\n | |
|
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 | 551 | > EOF |
|
316 | 0 | |
|
317 | 0 | |
|
318 | 0 | |
|
319 | 0 | |
|
320 | 0 | |
|
321 | 0 | |
|
322 | 0 | |
|
323 | 0 | |
|
324 | 384 | |
|
325 | capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN | |
|
552 | using raw connection to peer | |
|
553 | i> write(48) -> None: | |
|
554 | i> unknown\n | |
|
555 | i> dict 3\n | |
|
556 | i> key1 3\n | |
|
557 | i> foo\n | |
|
558 | i> key2 3\n | |
|
559 | i> bar\n | |
|
560 | i> key3 3\n | |
|
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 | 585 | Incomplete dictionary send |
|
328 | 586 | |
|
329 | $ hg -R server serve --stdio << EOF | |
|
330 | > unknown | |
|
331 | > dict 3 | |
|
332 | > key1 3 | |
|
333 | > foo | |
|
587 | $ hg debugwireproto --localssh --peer raw << EOF | |
|
588 | > raw | |
|
589 | > unknown\n | |
|
590 | > dict 3\n | |
|
591 | > key1 3\n | |
|
592 | > foo\n | |
|
593 | > readline | |
|
594 | > readline | |
|
595 | > readline | |
|
596 | > readline | |
|
334 | 597 | > EOF |
|
335 | 0 | |
|
336 | 0 | |
|
337 | 0 | |
|
338 | 0 | |
|
598 | using raw connection to peer | |
|
599 | i> write(26) -> None: | |
|
600 | i> unknown\n | |
|
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 | 613 | Incomplete value send |
|
341 | 614 | |
|
342 | $ hg -R server serve --stdio << EOF | |
|
343 | > unknown | |
|
344 | > dict 3 | |
|
345 | > key1 3 | |
|
346 | > fo | |
|
615 | $ hg debugwireproto --localssh --peer raw << EOF | |
|
616 | > raw | |
|
617 | > unknown\n | |
|
618 | > dict 3\n | |
|
619 | > key1 3\n | |
|
620 | > fo | |
|
621 | > readline | |
|
622 | > readline | |
|
623 | > readline | |
|
347 | 624 | > EOF |
|
348 | 0 | |
|
349 | 0 | |
|
350 | 0 | |
|
351 | 0 | |
|
625 | using raw connection to peer | |
|
626 | i> write(24) -> None: | |
|
627 | i> unknown\n | |
|
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 | 638 | Send a command line with spaces |
|
354 | 639 | |
|
355 | $ hg -R server serve --stdio << EOF | |
|
356 | > unknown withspace | |
|
357 | > hello | |
|
358 | > between | |
|
359 | > pairs 81 | |
|
360 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
|
640 | $ hg debugwireproto --localssh --peer raw << EOF | |
|
641 | > raw | |
|
642 | > unknown withspace\n | |
|
643 | > readline | |
|
644 | > raw | |
|
645 | > hello\n | |
|
646 | > readline | |
|
647 | > readline | |
|
648 | > raw | |
|
649 | > between\n | |
|
650 | > pairs 81\n | |
|
651 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
|
652 | > readline | |
|
653 | > readline | |
|
361 | 654 | > EOF |
|
362 | 0 | |
|
363 | 384 | |
|
364 | capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN | |
|
365 | 1 | |
|
366 | ||
|
655 | using raw connection to peer | |
|
656 | i> write(18) -> None: | |
|
657 | i> unknown withspace\n | |
|
658 | o> readline() -> 2: | |
|
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 | |
|
369 | > unknown with multiple spaces | |
|
370 | > hello | |
|
371 | > between | |
|
372 | > pairs 81 | |
|
373 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
|
675 | $ hg debugwireproto --localssh --peer raw << EOF | |
|
676 | > raw | |
|
677 | > unknown with multiple spaces\n | |
|
678 | > readline | |
|
679 | > raw | |
|
680 | > hello\n | |
|
681 | > readline | |
|
682 | > readline | |
|
683 | > raw | |
|
684 | > between\n | |
|
685 | > pairs 81\n | |
|
686 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
|
687 | > readline | |
|
374 | 688 | > EOF |
|
375 | 0 | |
|
376 | 384 | |
|
377 | capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN | |
|
378 | 1 | |
|
379 | ||
|
689 | using raw connection to peer | |
|
690 | i> write(29) -> None: | |
|
691 | i> unknown with multiple spaces\n | |
|
692 | o> readline() -> 2: | |
|
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 | |
|
382 | > unknown with spaces | |
|
383 | > key 10 | |
|
384 | > some value | |
|
385 | > hello | |
|
386 | > between | |
|
387 | > pairs 81 | |
|
388 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
|
707 | $ hg debugwireproto --localssh --peer raw << EOF | |
|
708 | > raw | |
|
709 | > unknown with spaces\n | |
|
710 | > key 10\n | |
|
711 | > some value\n | |
|
712 | > readline | |
|
713 | > readline | |
|
714 | > readline | |
|
715 | > raw | |
|
716 | > hello\n | |
|
717 | > readline | |
|
718 | > readline | |
|
719 | > raw | |
|
720 | > between\n | |
|
721 | > pairs 81\n | |
|
722 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
|
723 | > readline | |
|
724 | > readline | |
|
389 | 725 | > EOF |
|
390 | 0 | |
|
391 | 0 | |
|
392 | 0 | |
|
393 | 384 | |
|
394 | capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN | |
|
395 | 1 | |
|
396 | ||
|
726 | using raw connection to peer | |
|
727 | i> write(38) -> None: | |
|
728 | i> unknown with spaces\n | |
|
729 | i> key 10\n | |
|
730 | i> some value\n | |
|
731 | o> readline() -> 2: | |
|
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 | 752 | Send an unknown command after the "between" |
|
399 | 753 | |
|
400 | $ hg -R server serve --stdio << EOF | |
|
401 | > hello | |
|
402 | > between | |
|
403 | > pairs 81 | |
|
404 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000unknown | |
|
754 | $ hg debugwireproto --localssh --peer raw << EOF | |
|
755 | > raw | |
|
756 | > hello\n | |
|
757 | > readline | |
|
758 | > readline | |
|
759 | > raw | |
|
760 | > between\n | |
|
761 | > pairs 81\n | |
|
762 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000unknown | |
|
763 | > readline | |
|
764 | > readline | |
|
405 | 765 | > EOF |
|
406 | 384 | |
|
407 | capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN | |
|
408 | 1 | |
|
409 | ||
|
410 | 0 | |
|
766 | using raw connection to peer | |
|
767 | i> write(6) -> None: | |
|
768 | i> hello\n | |
|
769 | o> readline() -> 4: | |
|
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 | 782 | And one with arguments |
|
413 | 783 | |
|
414 | $ hg -R server serve --stdio << EOF | |
|
415 | > hello | |
|
416 | > between | |
|
417 | > pairs 81 | |
|
418 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000unknown | |
|
419 | > foo 5 | |
|
420 |
> |
|
|
421 | > bar 3 | |
|
422 | > baz | |
|
784 | $ hg debugwireproto --localssh --peer raw << EOF | |
|
785 | > raw | |
|
786 | > hello\n | |
|
787 | > between\n | |
|
788 | > pairs 81\n | |
|
789 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
|
790 | > readline | |
|
791 | > readline | |
|
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 | 803 | > EOF |
|
424 | 384 | |
|
425 | capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN | |
|
426 | 1 | |
|
427 | ||
|
428 | 0 | |
|
429 | 0 | |
|
430 | 0 | |
|
431 | 0 | |
|
432 | 0 | |
|
804 | using raw connection to peer | |
|
805 | i> write(104) -> None: | |
|
806 | i> hello\n | |
|
807 | i> between\n | |
|
808 | i> pairs 81\n | |
|
809 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
|
810 | o> readline() -> 4: | |
|
811 | o> 384\n | |
|
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 | 831 | Send a valid command before the handshake |
|
435 | 832 | |
|
436 | $ hg -R server serve --stdio << EOF | |
|
437 |
> |
|
|
438 | > hello | |
|
439 | > between | |
|
440 | > pairs 81 | |
|
441 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
|
833 | $ hg debugwireproto --localssh --peer raw << EOF | |
|
834 | > raw | |
|
835 | > heads\n | |
|
836 | > readline | |
|
837 | > raw | |
|
838 | > hello\n | |
|
839 | > between\n | |
|
840 | > pairs 81\n | |
|
841 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
|
842 | > readline | |
|
843 | > readline | |
|
844 | > readline | |
|
845 | > readline | |
|
442 | 846 | > EOF |
|
443 | 41 | |
|
444 | 68986213bd4485ea51533535e3fc9e78007a711f | |
|
445 | 384 | |
|
446 | capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN | |
|
447 | 1 | |
|
448 | ||
|
847 | using raw connection to peer | |
|
848 | i> write(6) -> None: | |
|
849 | i> heads\n | |
|
850 | o> readline() -> 3: | |
|
851 | o> 41\n | |
|
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 | 866 | And a variation that doesn't send the between command |
|
451 | 867 | |
|
452 | $ hg -R server serve --stdio << EOF | |
|
453 |
> |
|
|
454 | > hello | |
|
868 | $ hg debugwireproto --localssh --peer raw << EOF | |
|
869 | > raw | |
|
870 | > heads\n | |
|
871 | > readline | |
|
872 | > raw | |
|
873 | > hello\n | |
|
874 | > readline | |
|
875 | > readline | |
|
455 | 876 | > EOF |
|
456 | 41 | |
|
457 | 68986213bd4485ea51533535e3fc9e78007a711f | |
|
458 | 384 | |
|
459 | capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN | |
|
877 | using raw connection to peer | |
|
878 | i> write(6) -> None: | |
|
879 | i> heads\n | |
|
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 | 889 | Send an upgrade request to a server that doesn't support that command |
|
462 | 890 | |
|
463 | $ hg -R server serve --stdio << EOF | |
|
464 | > upgrade 2e82ab3f-9ce3-4b4e-8f8c-6fd1c0e9e23a proto=irrelevant1%2Cirrelevant2 | |
|
465 | > hello | |
|
466 | > between | |
|
467 | > pairs 81 | |
|
468 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
|
891 | $ hg debugwireproto --localssh --peer raw << EOF | |
|
892 | > raw | |
|
893 | > upgrade 2e82ab3f-9ce3-4b4e-8f8c-6fd1c0e9e23a proto=irrelevant1%2Cirrelevant2\n | |
|
894 | > readline | |
|
895 | > raw | |
|
896 | > hello\n | |
|
897 | > between\n | |
|
898 | > pairs 81\n | |
|
899 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
|
900 | > readline | |
|
901 | > readline | |
|
902 | > readline | |
|
903 | > readline | |
|
469 | 904 | > EOF |
|
470 | 0 | |
|
471 | 384 | |
|
472 | capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN | |
|
473 | 1 | |
|
474 | ||
|
905 | using raw connection to peer | |
|
906 | i> write(77) -> None: | |
|
907 | i> upgrade 2e82ab3f-9ce3-4b4e-8f8c-6fd1c0e9e23a proto=irrelevant1%2Cirrelevant2\n | |
|
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 | |
|
923 | ||
|
924 | $ cd .. | |
|
475 | 925 | |
|
476 | 926 | $ hg --config experimental.sshpeer.advertise-v2=true --debug debugpeer ssh://user@dummy/server |
|
477 | 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 | 951 | Send an upgrade request to a server that supports upgrade |
|
502 | 952 | |
|
503 | >>> with open('payload', 'wb') as fh: | |
|
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') | |
|
953 | $ cd server | |
|
509 | 954 | |
|
510 | $ hg -R server serve --stdio < payload | |
|
511 | upgraded this-is-some-token exp-ssh-v2-0001 | |
|
512 | 383 | |
|
513 | capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN | |
|
955 | $ hg debugwireproto --localssh --peer raw << EOF | |
|
956 | > raw | |
|
957 | > upgrade this-is-some-token proto=exp-ssh-v2-0001\n | |
|
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 | 982 | $ hg --config experimental.sshpeer.advertise-v2=true --debug debugpeer ssh://user@dummy/server |
|
516 | 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 | 1046 | Command after upgrade to version 2 is processed |
|
580 | 1047 | |
|
581 | >>> with open('payload', 'wb') as fh: | |
|
582 | ... fh.write(b'upgrade this-is-some-token proto=exp-ssh-v2-0001\n') | |
|
583 | ... fh.write(b'hello\n') | |
|
584 | ... fh.write(b'between\n') | |
|
585 | ... fh.write(b'pairs 81\n') | |
|
586 | ... fh.write(b'0000000000000000000000000000000000000000-0000000000000000000000000000000000000000') | |
|
587 | ... fh.write(b'hello\n') | |
|
588 | $ hg -R server serve --stdio < payload | |
|
589 | upgraded this-is-some-token exp-ssh-v2-0001 | |
|
590 | 383 | |
|
591 | capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN | |
|
592 | 384 | |
|
593 | capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN | |
|
1048 | $ cd server | |
|
1049 | ||
|
1050 | $ hg debugwireproto --localssh --peer raw << EOF | |
|
1051 | > raw | |
|
1052 | > upgrade this-is-some-token proto=exp-ssh-v2-0001\n | |
|
1053 | > hello\n | |
|
1054 | > between\n | |
|
1055 | > pairs 81\n | |
|
1056 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
|
1057 | > readline | |
|
1058 | > readline | |
|
1059 | > readline | |
|
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 | 1085 | Multiple upgrades is not allowed |
|
596 | 1086 | |
|
597 | >>> with open('payload', 'wb') as fh: | |
|
598 | ... fh.write(b'upgrade this-is-some-token proto=exp-ssh-v2-0001\n') | |
|
599 | ... fh.write(b'hello\n') | |
|
600 | ... fh.write(b'between\n') | |
|
601 | ... fh.write(b'pairs 81\n') | |
|
602 | ... fh.write(b'0000000000000000000000000000000000000000-0000000000000000000000000000000000000000') | |
|
603 | ... fh.write(b'upgrade another-token proto=irrelevant\n') | |
|
604 | ... fh.write(b'hello\n') | |
|
605 | $ hg -R server serve --stdio < payload | |
|
606 | upgraded this-is-some-token exp-ssh-v2-0001 | |
|
607 | 383 | |
|
608 | capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN | |
|
609 | cannot upgrade protocols multiple times | |
|
610 | - | |
|
611 | ||
|
1087 | $ hg debugwireproto --localssh --peer raw << EOF | |
|
1088 | > raw | |
|
1089 | > upgrade this-is-some-token proto=exp-ssh-v2-0001\n | |
|
1090 | > hello\n | |
|
1091 | > between\n | |
|
1092 | > pairs 81\n | |
|
1093 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
|
1094 | > readline | |
|
1095 | > readline | |
|
1096 | > readline | |
|
1097 | > raw | |
|
1098 | > upgrade another-token proto=irrelevant\n | |
|
1099 | > hello\n | |
|
1100 | > readline | |
|
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 | 1125 | Malformed upgrade request line (not exactly 3 space delimited tokens) |
|
614 | 1126 | |
|
615 | $ hg -R server serve --stdio << EOF | |
|
616 |
> |
|
|
1127 | $ hg debugwireproto --localssh --peer raw << EOF | |
|
1128 | > raw | |
|
1129 | > upgrade\n | |
|
1130 | > readline | |
|
617 | 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 | |
|
621 | > upgrade token | |
|
1138 | $ hg debugwireproto --localssh --peer raw << EOF | |
|
1139 | > raw | |
|
1140 | > upgrade token\n | |
|
1141 | > readline | |
|
622 | 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 | |
|
626 | > upgrade token foo=bar extra-token | |
|
1149 | $ hg debugwireproto --localssh --peer raw << EOF | |
|
1150 | > raw | |
|
1151 | > upgrade token foo=bar extra-token\n | |
|
1152 | > readline | |
|
627 | 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 | 1160 | Upgrade request to unsupported protocol is ignored |
|
631 | 1161 | |
|
632 | $ hg -R server serve --stdio << EOF | |
|
633 | > upgrade this-is-some-token proto=unknown1,unknown2 | |
|
634 | > hello | |
|
635 | > between | |
|
636 | > pairs 81 | |
|
637 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
|
1162 | $ hg debugwireproto --localssh --peer raw << EOF | |
|
1163 | > raw | |
|
1164 | > upgrade this-is-some-token proto=unknown1,unknown2\n | |
|
1165 | > readline | |
|
1166 | > raw | |
|
1167 | > hello\n | |
|
1168 | > readline | |
|
1169 | > readline | |
|
1170 | > raw | |
|
1171 | > between\n | |
|
1172 | > pairs 81\n | |
|
1173 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
|
1174 | > readline | |
|
1175 | > readline | |
|
638 | 1176 | > EOF |
|
639 | 0 | |
|
640 | 384 | |
|
641 | capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN | |
|
642 | 1 | |
|
643 | ||
|
1177 | using raw connection to peer | |
|
1178 | i> write(51) -> None: | |
|
1179 | i> upgrade this-is-some-token proto=unknown1,unknown2\n | |
|
1180 | o> readline() -> 2: | |
|
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 | 1197 | Upgrade request must be followed by hello + between |
|
646 | 1198 | |
|
647 | $ hg -R server serve --stdio << EOF | |
|
648 | > upgrade token proto=exp-ssh-v2-0001 | |
|
649 | > invalid | |
|
1199 | $ hg debugwireproto --localssh --peer raw << EOF | |
|
1200 | > raw | |
|
1201 | > upgrade token proto=exp-ssh-v2-0001\n | |
|
1202 | > invalid\n | |
|
1203 | > readline | |
|
1204 | > readavailable | |
|
650 | 1205 | > EOF |
|
651 | malformed handshake protocol: missing hello | |
|
652 | - | |
|
653 | ||
|
1206 | using raw connection to peer | |
|
1207 | i> write(44) -> None: | |
|
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 | |
|
656 | > upgrade token proto=exp-ssh-v2-0001 | |
|
657 | > hello | |
|
658 | > invalid | |
|
1216 | $ hg debugwireproto --localssh --peer raw << EOF | |
|
1217 | > raw | |
|
1218 | > upgrade token proto=exp-ssh-v2-0001\n | |
|
1219 | > hello\n | |
|
1220 | > invalid\n | |
|
1221 | > readline | |
|
1222 | > readavailable | |
|
659 | 1223 | > EOF |
|
660 | malformed handshake protocol: missing between | |
|
661 | - | |
|
662 | ||
|
1224 | using raw connection to peer | |
|
1225 | i> write(50) -> None: | |
|
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 | |
|
665 | > upgrade token proto=exp-ssh-v2-0001 | |
|
666 | > hello | |
|
667 | > between | |
|
668 | > invalid | |
|
1235 | $ hg debugwireproto --localssh --peer raw << EOF | |
|
1236 | > raw | |
|
1237 | > upgrade token proto=exp-ssh-v2-0001\n | |
|
1238 | > hello\n | |
|
1239 | > between\n | |
|
1240 | > invalid\n | |
|
1241 | > readline | |
|
1242 | > readavailable | |
|
669 | 1243 | > EOF |
|
670 | malformed handshake protocol: missing pairs 81 | |
|
671 | - | |
|
672 | ||
|
1244 | using raw connection to peer | |
|
1245 | i> write(58) -> None: | |
|
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