Mercurial > hg
diff tests/test-http-api-httpv2.t @ 40138:b5bf3dd6ec5b
wireprotov2: send content encoded frames from server
Now that we have support for negotiating encodings and configuring
an encoder, we can start sending content encoded frames from the
server.
This commit teaches the wireprotov2 server code to send content
encoded frames.
On the mozilla-unified repository with zstd enabled peers, this change
reduces the total amount of data transferred from server to client
drastically:
befor: 7,190,995,812 bytes
after: 1,605,508,691 bytes
Differential Revision: https://phab.mercurial-scm.org/D4927
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Mon, 08 Oct 2018 17:24:28 -0700 |
parents | 762ef19a07e3 |
children | 41263df08109 |
line wrap: on
line diff
--- a/tests/test-http-api-httpv2.t Mon Oct 08 15:19:32 2018 -0700 +++ b/tests/test-http-api-httpv2.t Mon Oct 08 17:24:28 2018 -0700 @@ -176,11 +176,14 @@ s> Content-Type: application/mercurial-exp-framing-0006\r\n s> Transfer-Encoding: chunked\r\n s> \r\n + s> 11\r\n + s> \t\x00\x00\x01\x00\x02\x01\x92Hidentity + s> \r\n s> 13\r\n - s> \x0b\x00\x00\x01\x00\x02\x011\xa1FstatusBok + s> \x0b\x00\x00\x01\x00\x02\x041\xa1FstatusBok s> \r\n s> 27\r\n - s> \x1f\x00\x00\x01\x00\x02\x001X\x1dcustomreadonly bytes response + s> \x1f\x00\x00\x01\x00\x02\x041X\x1dcustomreadonly bytes response s> \r\n s> 8\r\n s> \x00\x00\x00\x01\x00\x02\x002 @@ -209,16 +212,21 @@ s> Content-Type: application/mercurial-exp-framing-0006\r\n s> Transfer-Encoding: chunked\r\n s> \r\n + s> 11\r\n + s> \t\x00\x00\x01\x00\x02\x01\x92 + s> Hidentity + s> \r\n + received frame(size=9; request=1; stream=2; streamflags=stream-begin; type=stream-settings; flags=eos) s> 13\r\n - s> \x0b\x00\x00\x01\x00\x02\x011 + s> \x0b\x00\x00\x01\x00\x02\x041 s> \xa1FstatusBok s> \r\n - received frame(size=11; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=continuation) + received frame(size=11; request=1; stream=2; streamflags=encoded; type=command-response; flags=continuation) s> 27\r\n - s> \x1f\x00\x00\x01\x00\x02\x001 + s> \x1f\x00\x00\x01\x00\x02\x041 s> X\x1dcustomreadonly bytes response s> \r\n - received frame(size=31; request=1; stream=2; streamflags=; type=command-response; flags=continuation) + received frame(size=31; request=1; stream=2; streamflags=encoded; type=command-response; flags=continuation) s> 8\r\n s> \x00\x00\x00\x01\x00\x02\x002 s> \r\n @@ -335,11 +343,14 @@ s> Content-Type: application/mercurial-exp-framing-0006\r\n s> Transfer-Encoding: chunked\r\n s> \r\n + s> 11\r\n + s> \t\x00\x00\x01\x00\x02\x01\x92Hidentity + s> \r\n s> 13\r\n - s> \x0b\x00\x00\x01\x00\x02\x011\xa1FstatusBok + s> \x0b\x00\x00\x01\x00\x02\x041\xa1FstatusBok s> \r\n s> 27\r\n - s> \x1f\x00\x00\x01\x00\x02\x001X\x1dcustomreadonly bytes response + s> \x1f\x00\x00\x01\x00\x02\x041X\x1dcustomreadonly bytes response s> \r\n s> 8\r\n s> \x00\x00\x00\x01\x00\x02\x002 @@ -464,11 +475,14 @@ s> Content-Type: application/mercurial-exp-framing-0006\r\n s> Transfer-Encoding: chunked\r\n s> \r\n + s> 11\r\n + s> \t\x00\x00\x01\x00\x02\x01\x92Hidentity + s> \r\n s> 13\r\n - s> \x0b\x00\x00\x01\x00\x02\x011\xa1FstatusBok + s> \x0b\x00\x00\x01\x00\x02\x041\xa1FstatusBok s> \r\n s> 27\r\n - s> \x1f\x00\x00\x01\x00\x02\x001X\x1dcustomreadonly bytes response + s> \x1f\x00\x00\x01\x00\x02\x041X\x1dcustomreadonly bytes response s> \r\n s> 8\r\n s> \x00\x00\x00\x01\x00\x02\x002 @@ -503,20 +517,23 @@ s> Content-Type: application/mercurial-exp-framing-0006\r\n s> Transfer-Encoding: chunked\r\n s> \r\n + s> 11\r\n + s> \t\x00\x00\x01\x00\x02\x01\x92Hidentity + s> \r\n s> 13\r\n - s> \x0b\x00\x00\x01\x00\x02\x011\xa1FstatusBok + s> \x0b\x00\x00\x01\x00\x02\x041\xa1FstatusBok s> \r\n s> 27\r\n - s> \x1f\x00\x00\x01\x00\x02\x001X\x1dcustomreadonly bytes response + s> \x1f\x00\x00\x01\x00\x02\x041X\x1dcustomreadonly bytes response s> \r\n s> 8\r\n s> \x00\x00\x00\x01\x00\x02\x002 s> \r\n s> 13\r\n - s> \x0b\x00\x00\x03\x00\x02\x001\xa1FstatusBok + s> \x0b\x00\x00\x03\x00\x02\x041\xa1FstatusBok s> \r\n s> 27\r\n - s> \x1f\x00\x00\x03\x00\x02\x001X\x1dcustomreadonly bytes response + s> \x1f\x00\x00\x03\x00\x02\x041X\x1dcustomreadonly bytes response s> \r\n s> 8\r\n s> \x00\x00\x00\x03\x00\x02\x002 @@ -553,20 +570,23 @@ s> Content-Type: application/mercurial-exp-framing-0006\r\n s> Transfer-Encoding: chunked\r\n s> \r\n + s> 11\r\n + s> \t\x00\x00\x03\x00\x02\x01\x92Hidentity + s> \r\n s> 13\r\n - s> \x0b\x00\x00\x03\x00\x02\x011\xa1FstatusBok + s> \x0b\x00\x00\x03\x00\x02\x041\xa1FstatusBok s> \r\n s> 28\r\n - s> \x00\x00\x03\x00\x02\x001\xa3Ibookmarks@Jnamespaces@Fphases@ + s> \x00\x00\x03\x00\x02\x041\xa3Ibookmarks@Jnamespaces@Fphases@ s> \r\n s> 8\r\n s> \x00\x00\x00\x03\x00\x02\x002 s> \r\n s> 13\r\n - s> \x0b\x00\x00\x01\x00\x02\x001\xa1FstatusBok + s> \x0b\x00\x00\x01\x00\x02\x041\xa1FstatusBok s> \r\n s> 9\r\n - s> \x01\x00\x00\x01\x00\x02\x001\xa0 + s> \x01\x00\x00\x01\x00\x02\x041\xa0 s> \r\n s> 8\r\n s> \x00\x00\x00\x01\x00\x02\x002 @@ -641,16 +661,21 @@ s> Content-Type: application/mercurial-exp-framing-0006\r\n s> Transfer-Encoding: chunked\r\n s> \r\n + s> 11\r\n + s> \t\x00\x00\x01\x00\x02\x01\x92 + s> Hidentity + s> \r\n + received frame(size=9; request=1; stream=2; streamflags=stream-begin; type=stream-settings; flags=eos) s> 13\r\n - s> \x0b\x00\x00\x01\x00\x02\x011 + s> \x0b\x00\x00\x01\x00\x02\x041 s> \xa1FstatusBok s> \r\n - received frame(size=11; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=continuation) + received frame(size=11; request=1; stream=2; streamflags=encoded; type=command-response; flags=continuation) s> 1e\r\n - s> \x16\x00\x00\x01\x00\x02\x001 + s> \x16\x00\x00\x01\x00\x02\x041 s> \x81T\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 s> \r\n - received frame(size=22; request=1; stream=2; streamflags=; type=command-response; flags=continuation) + received frame(size=22; request=1; stream=2; streamflags=encoded; type=command-response; flags=continuation) s> 8\r\n s> \x00\x00\x00\x01\x00\x02\x002 s> \r\n @@ -685,22 +710,18 @@ s> Content-Type: application/mercurial-exp-framing-0006\r\n s> Transfer-Encoding: chunked\r\n s> \r\n - s> 13\r\n - s> \x0b\x00\x00\x01\x00\x02\x011 - s> \xa1FstatusBok + s> 11\r\n + s> \t\x00\x00\x01\x00\x02\x01\x92 + s> Hzstd-8mb s> \r\n - received frame(size=11; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=continuation) - s> 1e\r\n - s> \x16\x00\x00\x01\x00\x02\x001 - s> \x81T\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 + received frame(size=9; request=1; stream=2; streamflags=stream-begin; type=stream-settings; flags=eos) + s> 25\r\n + s> \x1d\x00\x00\x01\x00\x02\x042 + s> (\xb5/\xfd\x00P\xa4\x00\x00p\xa1FstatusBok\x81T\x00\x01\x00\tP\x02 s> \r\n - received frame(size=22; request=1; stream=2; streamflags=; type=command-response; flags=continuation) - s> 8\r\n - s> \x00\x00\x00\x01\x00\x02\x002 - s> \r\n + received frame(size=29; request=1; stream=2; streamflags=encoded; type=command-response; flags=eos) s> 0\r\n s> \r\n - received frame(size=0; request=1; stream=2; streamflags=; type=command-response; flags=eos) response: [ b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' ]