annotate tests/test-http-protocol.t @ 30762:35b516f800e0

wireproto: advertise supported media types and compression formats This commit introduces support for advertising a server's support for media types and compression formats in accordance with the spec defined in internals.wireproto. The bulk of the new code is a helper function in wireproto.py to obtain a prioritized list of compression engines available to the wire protocol. While not utilized yet, we implement support for obtaining the list of compression engines advertised by the client. The upcoming HTTP protocol enhancements are a bit lower-level than existing tests (most existing tests are command centric). So, this commit establishes a new test file that will be appropriate for holding tests around the functionality of the HTTP protocol itself. Rounding out this change, `hg debuginstall` now prints compression engines available to the server.
author Gregory Szorc <gregory.szorc@gmail.com>
date Sat, 24 Dec 2016 15:21:46 -0700
parents
children e75463e3179f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
30762
35b516f800e0 wireproto: advertise supported media types and compression formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1 $ cat >> $HGRCPATH << EOF
35b516f800e0 wireproto: advertise supported media types and compression formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
2 > [web]
35b516f800e0 wireproto: advertise supported media types and compression formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
3 > push_ssl = false
35b516f800e0 wireproto: advertise supported media types and compression formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
4 > allow_push = *
35b516f800e0 wireproto: advertise supported media types and compression formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
5 > EOF
35b516f800e0 wireproto: advertise supported media types and compression formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
6
35b516f800e0 wireproto: advertise supported media types and compression formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
7 $ hg init server
35b516f800e0 wireproto: advertise supported media types and compression formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
8 $ cd server
35b516f800e0 wireproto: advertise supported media types and compression formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
9 $ touch a
35b516f800e0 wireproto: advertise supported media types and compression formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
10 $ hg -q commit -A -m initial
35b516f800e0 wireproto: advertise supported media types and compression formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
11 $ cd ..
35b516f800e0 wireproto: advertise supported media types and compression formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
12
35b516f800e0 wireproto: advertise supported media types and compression formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
13 $ hg -R server serve -p $HGPORT -d --pid-file hg.pid
35b516f800e0 wireproto: advertise supported media types and compression formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
14 $ cat hg.pid >> $DAEMON_PIDS
35b516f800e0 wireproto: advertise supported media types and compression formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
15
35b516f800e0 wireproto: advertise supported media types and compression formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
16 compression formats are advertised in compression capability
35b516f800e0 wireproto: advertise supported media types and compression formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
17
35b516f800e0 wireproto: advertise supported media types and compression formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
18 #if zstd
35b516f800e0 wireproto: advertise supported media types and compression formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
19 $ get-with-headers.py 127.0.0.1:$HGPORT '?cmd=capabilities' | tr ' ' '\n' | grep compression
35b516f800e0 wireproto: advertise supported media types and compression formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
20 compression=zstd,zlib
35b516f800e0 wireproto: advertise supported media types and compression formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
21 #else
35b516f800e0 wireproto: advertise supported media types and compression formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
22 $ get-with-headers.py 127.0.0.1:$HGPORT '?cmd=capabilities' | tr ' ' '\n' | grep compression
35b516f800e0 wireproto: advertise supported media types and compression formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
23 compression=ZL
35b516f800e0 wireproto: advertise supported media types and compression formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
24 #endif
35b516f800e0 wireproto: advertise supported media types and compression formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
25
35b516f800e0 wireproto: advertise supported media types and compression formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
26 $ killdaemons.py
35b516f800e0 wireproto: advertise supported media types and compression formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
27
35b516f800e0 wireproto: advertise supported media types and compression formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
28 server.compressionengines can replace engines list wholesale
35b516f800e0 wireproto: advertise supported media types and compression formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
29
35b516f800e0 wireproto: advertise supported media types and compression formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
30 $ hg --config server.compressionengines=none -R server serve -p $HGPORT -d --pid-file hg.pid
35b516f800e0 wireproto: advertise supported media types and compression formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
31 $ cat hg.pid > $DAEMON_PIDS
35b516f800e0 wireproto: advertise supported media types and compression formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
32 $ get-with-headers.py 127.0.0.1:$HGPORT '?cmd=capabilities' | tr ' ' '\n' | grep compression
35b516f800e0 wireproto: advertise supported media types and compression formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
33 compression=none
35b516f800e0 wireproto: advertise supported media types and compression formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
34
35b516f800e0 wireproto: advertise supported media types and compression formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
35 $ killdaemons.py
35b516f800e0 wireproto: advertise supported media types and compression formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
36
35b516f800e0 wireproto: advertise supported media types and compression formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
37 Order of engines can also change
35b516f800e0 wireproto: advertise supported media types and compression formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
38
35b516f800e0 wireproto: advertise supported media types and compression formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
39 $ hg --config server.compressionengines=none,zlib -R server serve -p $HGPORT -d --pid-file hg.pid
35b516f800e0 wireproto: advertise supported media types and compression formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
40 $ cat hg.pid > $DAEMON_PIDS
35b516f800e0 wireproto: advertise supported media types and compression formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
41 $ get-with-headers.py 127.0.0.1:$HGPORT '?cmd=capabilities' | tr ' ' '\n' | grep compression
35b516f800e0 wireproto: advertise supported media types and compression formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
42 compression=none,zlib
35b516f800e0 wireproto: advertise supported media types and compression formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
43
35b516f800e0 wireproto: advertise supported media types and compression formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
44 $ killdaemons.py