##// END OF EJS Templates
sshpeer: initial definition and implementation of new SSH protocol...
sshpeer: initial definition and implementation of new SSH protocol The existing SSH protocol has several design flaws. Future commits will elaborate on these flaws as new features are introduced to combat these flaws. For now, hopefully you can take me for my word that a ground up rewrite of the SSH protocol is needed. This commit lays the foundation for a new SSH protocol by defining a mechanism to upgrade the SSH transport channel away from the default (version 1) protocol to something modern (which we'll call "version 2" for now). This upgrade process is detailed in the internals documentation for the wire protocol. The gist of it is the client sends a request line preceding the "hello" command/line which basically says "I'm requesting an upgrade: here's what I support." If the server recognizes that line, it processes the upgrade request and the transport channel is switched to use the new version of the protocol. If not, it sends an empty response, which is how all Mercurial SSH servers from the beginning of time reacted to unknown commands. The upgrade request is effectively ignored and the client continues to use the existing version of the protocol as if nothing happened. The new version of the SSH protocol is completely identical to version 1 aside from the upgrade dance and the bytes that follow. The immediate bytes that follow the protocol switch are defined to be a length framed "capabilities: " line containing the remote's advertised capabilities. In reality, this looks very similar to what the "hello" response would look like. But it will evolve quickly. The methodology by which the protocol will evolve is important. I'm not going to introduce the new protocol all at once. That would likely lead to endless bike shedding and forward progress would stall. Instead, I intend to tricle out new features and diversions from the existing protocol in small, incremental changes. To support the gradual evolution of the protocol, the on-the-wire advertised protocol name contains an "exp" to denote "experimental" and a 4 digit field to capture the sub-version of the protocol. Whenever we make a BC change to the wire protocol, we can increment this version and lock out all older clients because it will appear as a completely different protocol version. This means we can incur as many breaking changes as we want. We don't have to commit to supporting any one feature or idea for a long period of time. We can even evolve the handshake mechanism, because that is defined as being an implementation detail of the negotiated protocol version! Hopefully this lowers the barrier to accepting changes to the protocol and for experimenting with "radical" ideas during its development. In core, sshpeer received most of the attention. We haven't even implemented the server bits for the new protocol in core yet. Instead, we add very primitive support to our test server, mainly just to exercise the added code paths in sshpeer. Differential Revision: https://phab.mercurial-scm.org/D2061 # no-check-commit because of required foo_bar naming

File last commit:

r35488:c1f7037c default
r35994:48a3a928 default
Show More
test-tools.t
108 lines | 2.8 KiB | text/troff | Tads3Lexer
Mads Kiilerich
tests: add 'f' tool for cross platform file operations in the tests...
r23860 Tests of the file helper tool
$ f -h
Matt Mackall
test-tools: fix portability issues
r23909 ?sage: f [options] [filenames] (glob)
Mads Kiilerich
tests: add 'f' tool for cross platform file operations in the tests...
r23860
Matt Mackall
tests: more fixes for f
r23913 ?ptions: (glob)
Mads Kiilerich
tests: add 'f' tool for cross platform file operations in the tests...
r23860 -h, --help show this help message and exit
-t, --type show file type (file or directory)
-m, --mode show file mode
-l, --links show number of links
-s, --size show size of file
-n NEWER, --newer=NEWER
check if file is newer (or same)
-r, --recurse recurse into directories
-S, --sha1 show sha1 hash of the content
Matt Harbison
tests: teach `f` to handle sha256 checksums
r35488 --sha256 show sha256 hash of the content
Mads Kiilerich
tests: add 'f' tool for cross platform file operations in the tests...
r23860 -M, --md5 show md5 hash of the content
-D, --dump dump file content
-H, --hexdump hexdump file content
-B BYTES, --bytes=BYTES
number of characters to dump
-L LINES, --lines=LINES
number of lines to dump
-q, --quiet no default output
$ mkdir dir
$ cd dir
$ f --size
size=0
$ echo hello | f --md5 --size
size=6, md5=b1946ac92492d2347c6235b4d2611184
$ f foo
foo: file not found
$ echo foo > foo
$ f foo
foo:
Matt Harbison
tests: fix a bug in `f` that prevented calculating sha1sum on a file
r35487 $ f --sha1 foo
foo: sha1=f1d2d2f924e986ac86fdf7b36c94bcdf32beec15
Matt Harbison
tests: teach `f` to handle sha256 checksums
r35488 $ f --sha256 foo
foo: sha256=b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c
Matt Harbison
tests: conditionalize test-tools.t for Windows support...
r23867 #if symlink
Mads Kiilerich
tests: add 'f' tool for cross platform file operations in the tests...
r23860 $ f foo --mode
foo: mode=644
Matt Harbison
tests: conditionalize test-tools.t for Windows support...
r23867 #endif
Mads Kiilerich
tests: add 'f' tool for cross platform file operations in the tests...
r23860
Matt Harbison
tests: make 'f' tool open files in binary mode when hexdumping...
r26950 #if no-windows
Augie Fackler
cleanup: use $PYTHON to run python in many more tests...
r32940 $ $PYTHON $TESTDIR/seq.py 10 > bar
Matt Harbison
tests: make 'f' tool open files in binary mode when hexdumping...
r26950 #else
Convert CRLF -> LF for consistency
Augie Fackler
cleanup: use $PYTHON to run python in many more tests...
r32940 $ $PYTHON $TESTDIR/seq.py 10 | sed "s/$//" > bar
Matt Harbison
tests: make 'f' tool open files in binary mode when hexdumping...
r26950 #endif
Matt Harbison
tests: conditionalize test-tools.t for Windows support...
r23867 #if unix-permissions symlink
Mads Kiilerich
tests: add 'f' tool for cross platform file operations in the tests...
r23860 $ chmod +x bar
$ f bar --newer foo --mode --type --size --dump --links --bytes 7
bar: file, size=21, mode=755, links=1, newer than foo
>>>
1
2
3
4
<<< no trailing newline
Matt Harbison
tests: conditionalize test-tools.t for Windows support...
r23867 #endif
Mads Kiilerich
tests: add 'f' tool for cross platform file operations in the tests...
r23860
Matt Mackall
test-tools: check for unix permissions for hardlinking
r23914 #if unix-permissions
Mads Kiilerich
tests: add 'f' tool for cross platform file operations in the tests...
r23860 $ ln bar baz
$ f bar -n baz -l --hexdump -t --sha1 --lines=9 -B 20
bar: file, links=2, newer than baz, sha1=612ca68d0305c821750a
0000: 31 0a 32 0a 33 0a 34 0a 35 0a 36 0a 37 0a 38 0a |1.2.3.4.5.6.7.8.|
0010: 39 0a |9.|
Matt Mackall
test-tools: another vfat fix
r23915 $ rm baz
Matt Mackall
test-tools: check for unix permissions for hardlinking
r23914 #endif
Mads Kiilerich
tests: add 'f' tool for cross platform file operations in the tests...
r23860
Matt Harbison
tests: conditionalize test-tools.t for Windows support...
r23867 #if unix-permissions symlink
Mads Kiilerich
tests: add 'f' tool for cross platform file operations in the tests...
r23860 $ ln -s yadda l
$ f . --recurse -MStmsB4
Matt Mackall
test-tools: another vfat fix
r23915 .: directory with 3 files, mode=755
Mads Kiilerich
tests: add 'f' tool for cross platform file operations in the tests...
r23860 ./bar: file, size=21, mode=755, md5=3b03, sha1=612c
./foo: file, size=4, mode=644, md5=d3b0, sha1=f1d2
Matt Mackall
tests: teach f not to report symlink mode bits...
r23912 ./l: link, size=5, md5=2faa, sha1=af93
Matt Harbison
tests: conditionalize test-tools.t for Windows support...
r23867 #endif
Mads Kiilerich
tests: add 'f' tool for cross platform file operations in the tests...
r23860
$ f --quiet bar -DL 3
1
2
3
$ cd ..
Matt Harbison
tests: conditionalize test-tools.t for Windows support...
r23867 Yadda is a symlink
Mads Kiilerich
tests: add 'f' tool for cross platform file operations in the tests...
r23860 $ f -qr dir -HB 17
Matt Harbison
test-tools: conditionalize output instead of tests
r33339 dir: directory with 3 files (symlink !)
dir: directory with 2 files (no-symlink !)
Matt Harbison
tests: remove (glob) annotations that were only for '\' matches...
r35394 dir/bar:
Matt Harbison
tests: conditionalize test-tools.t for Windows support...
r23867 0000: 31 0a 32 0a 33 0a 34 0a 35 0a 36 0a 37 0a 38 0a |1.2.3.4.5.6.7.8.|
0010: 39 |9|
Matt Harbison
tests: remove (glob) annotations that were only for '\' matches...
r35394 dir/foo:
Matt Harbison
tests: conditionalize test-tools.t for Windows support...
r23867 0000: 66 6f 6f 0a |foo.|
Matt Harbison
test-tools: conditionalize output instead of tests
r33339 dir/l: (symlink !)
0000: 79 61 64 64 61 |yadda| (symlink !)
Matt Harbison
tests: conditionalize test-tools.t for Windows support...
r23867