Mercurial > hg
comparison tests/test-wireproto-command-manifestdata.t @ 40034:393e44324037
httppeer: report http statistics
Now that keepalive.py records HTTP request count and the
number of bytes sent and received as part of performing those
requests, we can easily print a report on the activity when
closing a peer instance!
Exact byte counts are globbed in tests because they are influenced
by non-deterministic things, such as hostnames and port numbers.
Plus, the exact byte count isn't too important anyway.
I feel obliged to note that printing the byte count could have
security implications. e.g. if sending a password via HTTP basic
auth, the length of that password will influence the byte count
and the reporting of the byte count could be a side-channel leak
of the password length. I /think/ this is beyond our threshold
for concern. But if we think it poses a problem, we can teach the
byte count logging code to e.g. ignore sensitive HTTP request
headers. We could also consider not reporting the byte count of
request headers altogether. But since the wire protocol uses HTTP
headers for sending command arguments, it is kind of important to
report their size.
Differential Revision: https://phab.mercurial-scm.org/D4858
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Mon, 01 Oct 2018 13:17:38 -0700 |
parents | d059cb669632 |
children | a732d70253b0 |
comparison
equal
deleted
inserted
replaced
40033:5e5b06087ec5 | 40034:393e44324037 |
---|---|
189 }, | 189 }, |
190 { | 190 { |
191 b'node': b'F\xa6r\x1b^\xda\xf0\xea\x04\xb7\x9a\\\xb3!\x88T\xa4\xd2\xab\xa0' | 191 b'node': b'F\xa6r\x1b^\xda\xf0\xea\x04\xb7\x9a\\\xb3!\x88T\xa4\xd2\xab\xa0' |
192 } | 192 } |
193 ] | 193 ] |
194 (sent 2 HTTP requests and * bytes; received * bytes in responses) (glob) | |
194 | 195 |
195 Requesting parents works | 196 Requesting parents works |
196 | 197 |
197 $ sendhttpv2peer << EOF | 198 $ sendhttpv2peer << EOF |
198 > command manifestdata | 199 > command manifestdata |
244 b'\x1b\x17[Y_\x02,\xfa\xb5\xb8\t\xcc\x0e\xd5Q\xbd\x0b?\xf5\xe4', | 245 b'\x1b\x17[Y_\x02,\xfa\xb5\xb8\t\xcc\x0e\xd5Q\xbd\x0b?\xf5\xe4', |
245 b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' | 246 b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' |
246 ] | 247 ] |
247 } | 248 } |
248 ] | 249 ] |
250 (sent 2 HTTP requests and * bytes; received * bytes in responses) (glob) | |
249 | 251 |
250 Requesting revision data works | 252 Requesting revision data works |
251 (haveparents defaults to false, so fulltext is emitted) | 253 (haveparents defaults to false, so fulltext is emitted) |
252 | 254 |
253 $ sendhttpv2peer << EOF | 255 $ sendhttpv2peer << EOF |
308 ], | 310 ], |
309 b'node': b'F\xa6r\x1b^\xda\xf0\xea\x04\xb7\x9a\\\xb3!\x88T\xa4\xd2\xab\xa0' | 311 b'node': b'F\xa6r\x1b^\xda\xf0\xea\x04\xb7\x9a\\\xb3!\x88T\xa4\xd2\xab\xa0' |
310 }, | 312 }, |
311 b'a\x000879345e39377229634b420c639454156726c6b6\nb\x00819e258d31a5e1606629f365bb902a1b21ee4216\ndir0/c\x00914445346a0ca0629bd47ceb5dfe07e4d4cf2501\ndir0/child0/e\x00bbba6c06b30f443d34ff841bc985c4d0827c6be4\ndir0/child1/f\x0012fc7dcd773b5a0a929ce195228083c6ddc9cec4\ndir0/d\x00538206dc971e521540d6843abfe6d16032f6d426\n' | 313 b'a\x000879345e39377229634b420c639454156726c6b6\nb\x00819e258d31a5e1606629f365bb902a1b21ee4216\ndir0/c\x00914445346a0ca0629bd47ceb5dfe07e4d4cf2501\ndir0/child0/e\x00bbba6c06b30f443d34ff841bc985c4d0827c6be4\ndir0/child1/f\x0012fc7dcd773b5a0a929ce195228083c6ddc9cec4\ndir0/d\x00538206dc971e521540d6843abfe6d16032f6d426\n' |
312 ] | 314 ] |
315 (sent 2 HTTP requests and * bytes; received * bytes in responses) (glob) | |
313 | 316 |
314 haveparents=False yields same output | 317 haveparents=False yields same output |
315 | 318 |
316 $ sendhttpv2peer << EOF | 319 $ sendhttpv2peer << EOF |
317 > command manifestdata | 320 > command manifestdata |
372 ], | 375 ], |
373 b'node': b'F\xa6r\x1b^\xda\xf0\xea\x04\xb7\x9a\\\xb3!\x88T\xa4\xd2\xab\xa0' | 376 b'node': b'F\xa6r\x1b^\xda\xf0\xea\x04\xb7\x9a\\\xb3!\x88T\xa4\xd2\xab\xa0' |
374 }, | 377 }, |
375 b'a\x000879345e39377229634b420c639454156726c6b6\nb\x00819e258d31a5e1606629f365bb902a1b21ee4216\ndir0/c\x00914445346a0ca0629bd47ceb5dfe07e4d4cf2501\ndir0/child0/e\x00bbba6c06b30f443d34ff841bc985c4d0827c6be4\ndir0/child1/f\x0012fc7dcd773b5a0a929ce195228083c6ddc9cec4\ndir0/d\x00538206dc971e521540d6843abfe6d16032f6d426\n' | 378 b'a\x000879345e39377229634b420c639454156726c6b6\nb\x00819e258d31a5e1606629f365bb902a1b21ee4216\ndir0/c\x00914445346a0ca0629bd47ceb5dfe07e4d4cf2501\ndir0/child0/e\x00bbba6c06b30f443d34ff841bc985c4d0827c6be4\ndir0/child1/f\x0012fc7dcd773b5a0a929ce195228083c6ddc9cec4\ndir0/d\x00538206dc971e521540d6843abfe6d16032f6d426\n' |
376 ] | 379 ] |
380 (sent 2 HTTP requests and * bytes; received * bytes in responses) (glob) | |
377 | 381 |
378 haveparents=True will emit delta | 382 haveparents=True will emit delta |
379 | 383 |
380 $ sendhttpv2peer << EOF | 384 $ sendhttpv2peer << EOF |
381 > command manifestdata | 385 > command manifestdata |
432 ], | 436 ], |
433 b'node': b'F\xa6r\x1b^\xda\xf0\xea\x04\xb7\x9a\\\xb3!\x88T\xa4\xd2\xab\xa0' | 437 b'node': b'F\xa6r\x1b^\xda\xf0\xea\x04\xb7\x9a\\\xb3!\x88T\xa4\xd2\xab\xa0' |
434 }, | 438 }, |
435 b'\x00\x00\x00\x00\x00\x00\x00+\x00\x00\x00+a\x000879345e39377229634b420c639454156726c6b6\n' | 439 b'\x00\x00\x00\x00\x00\x00\x00+\x00\x00\x00+a\x000879345e39377229634b420c639454156726c6b6\n' |
436 ] | 440 ] |
441 (sent 2 HTTP requests and * bytes; received * bytes in responses) (glob) | |
437 | 442 |
438 Requesting multiple revisions works | 443 Requesting multiple revisions works |
439 (haveparents defaults to false, so fulltext is emitted unless a parent | 444 (haveparents defaults to false, so fulltext is emitted unless a parent |
440 has been emitted) | 445 has been emitted) |
441 | 446 |
509 ], | 514 ], |
510 b'node': b'F\xa6r\x1b^\xda\xf0\xea\x04\xb7\x9a\\\xb3!\x88T\xa4\xd2\xab\xa0' | 515 b'node': b'F\xa6r\x1b^\xda\xf0\xea\x04\xb7\x9a\\\xb3!\x88T\xa4\xd2\xab\xa0' |
511 }, | 516 }, |
512 b'\x00\x00\x00\x00\x00\x00\x00+\x00\x00\x00+a\x000879345e39377229634b420c639454156726c6b6\n' | 517 b'\x00\x00\x00\x00\x00\x00\x00+\x00\x00\x00+a\x000879345e39377229634b420c639454156726c6b6\n' |
513 ] | 518 ] |
519 (sent 2 HTTP requests and * bytes; received * bytes in responses) (glob) | |
514 | 520 |
515 With haveparents=True, first revision is a delta instead of fulltext | 521 With haveparents=True, first revision is a delta instead of fulltext |
516 | 522 |
517 $ sendhttpv2peer << EOF | 523 $ sendhttpv2peer << EOF |
518 > command manifestdata | 524 > command manifestdata |
585 ], | 591 ], |
586 b'node': b'F\xa6r\x1b^\xda\xf0\xea\x04\xb7\x9a\\\xb3!\x88T\xa4\xd2\xab\xa0' | 592 b'node': b'F\xa6r\x1b^\xda\xf0\xea\x04\xb7\x9a\\\xb3!\x88T\xa4\xd2\xab\xa0' |
587 }, | 593 }, |
588 b'\x00\x00\x00\x00\x00\x00\x00+\x00\x00\x00+a\x000879345e39377229634b420c639454156726c6b6\n' | 594 b'\x00\x00\x00\x00\x00\x00\x00+\x00\x00\x00+a\x000879345e39377229634b420c639454156726c6b6\n' |
589 ] | 595 ] |
596 (sent 2 HTTP requests and * bytes; received * bytes in responses) (glob) | |
590 | 597 |
591 Revisions are sorted by DAG order, parents first | 598 Revisions are sorted by DAG order, parents first |
592 | 599 |
593 $ sendhttpv2peer << EOF | 600 $ sendhttpv2peer << EOF |
594 > command manifestdata | 601 > command manifestdata |
660 ], | 667 ], |
661 b'node': b'F\xa6r\x1b^\xda\xf0\xea\x04\xb7\x9a\\\xb3!\x88T\xa4\xd2\xab\xa0' | 668 b'node': b'F\xa6r\x1b^\xda\xf0\xea\x04\xb7\x9a\\\xb3!\x88T\xa4\xd2\xab\xa0' |
662 }, | 669 }, |
663 b'\x00\x00\x00\x00\x00\x00\x00+\x00\x00\x00+a\x000879345e39377229634b420c639454156726c6b6\n' | 670 b'\x00\x00\x00\x00\x00\x00\x00+\x00\x00\x00+a\x000879345e39377229634b420c639454156726c6b6\n' |
664 ] | 671 ] |
672 (sent 2 HTTP requests and * bytes; received * bytes in responses) (glob) | |
665 | 673 |
666 Requesting parents and revision data works | 674 Requesting parents and revision data works |
667 | 675 |
668 $ sendhttpv2peer << EOF | 676 $ sendhttpv2peer << EOF |
669 > command manifestdata | 677 > command manifestdata |
743 b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' | 751 b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' |
744 ] | 752 ] |
745 }, | 753 }, |
746 b'\x00\x00\x00\x00\x00\x00\x00+\x00\x00\x00+a\x000879345e39377229634b420c639454156726c6b6\n' | 754 b'\x00\x00\x00\x00\x00\x00\x00+\x00\x00\x00+a\x000879345e39377229634b420c639454156726c6b6\n' |
747 ] | 755 ] |
756 (sent 2 HTTP requests and * bytes; received * bytes in responses) (glob) | |
748 | 757 |
749 $ cat error.log | 758 $ cat error.log |