comparison tests/test-wireproto-command-heads.t @ 37725:3ea8323d6f95

wireprotov2: change command response protocol to include a leading map The error handling mechanism for the new wire protocol isn't very well-defined. This commit takes us a step in the right direction by introducing a leading CBOR map for command responses. This map will contain an overall result of the command. Currently, the map indicates whether the command was overall successful or if an error occurred. And if an error occurred, that error is present in the map. There is still a dedicated error frame. My intent is to use that for protocol-level errors and for errors that are encountered after the initial response frame has been sent. This will be clarified in a later commit. Differential Revision: https://phab.mercurial-scm.org/D3385
author Gregory Szorc <gregory.szorc@gmail.com>
date Sat, 14 Apr 2018 15:19:36 -0700
parents deff7cf7eefd
children 0f549da54379
comparison
equal deleted inserted replaced
37724:deff7cf7eefd 37725:3ea8323d6f95
35 > EOF 35 > EOF
36 creating http peer for wire protocol version 2 36 creating http peer for wire protocol version 2
37 sending heads command 37 sending heads command
38 s> POST /api/exp-http-v2-0001/ro/heads HTTP/1.1\r\n 38 s> POST /api/exp-http-v2-0001/ro/heads HTTP/1.1\r\n
39 s> Accept-Encoding: identity\r\n 39 s> Accept-Encoding: identity\r\n
40 s> accept: application/mercurial-exp-framing-0004\r\n 40 s> accept: application/mercurial-exp-framing-0005\r\n
41 s> content-type: application/mercurial-exp-framing-0004\r\n 41 s> content-type: application/mercurial-exp-framing-0005\r\n
42 s> content-length: 20\r\n 42 s> content-length: 20\r\n
43 s> host: $LOCALIP:$HGPORT\r\n (glob) 43 s> host: $LOCALIP:$HGPORT\r\n (glob)
44 s> user-agent: Mercurial debugwireproto\r\n 44 s> user-agent: Mercurial debugwireproto\r\n
45 s> \r\n 45 s> \r\n
46 s> \x0c\x00\x00\x01\x00\x01\x01\x11\xa1DnameEheads 46 s> \x0c\x00\x00\x01\x00\x01\x01\x11\xa1DnameEheads
47 s> makefile('rb', None) 47 s> makefile('rb', None)
48 s> HTTP/1.1 200 OK\r\n 48 s> HTTP/1.1 200 OK\r\n
49 s> Server: testing stub value\r\n 49 s> Server: testing stub value\r\n
50 s> Date: $HTTP_DATE$\r\n 50 s> Date: $HTTP_DATE$\r\n
51 s> Content-Type: application/mercurial-exp-framing-0004\r\n 51 s> Content-Type: application/mercurial-exp-framing-0005\r\n
52 s> Transfer-Encoding: chunked\r\n 52 s> Transfer-Encoding: chunked\r\n
53 s> \r\n 53 s> \r\n
54 s> 48\r\n 54 s> 53\r\n
55 s> @\x00\x00\x01\x00\x02\x012 55 s> K\x00\x00\x01\x00\x02\x012
56 s> \x83T\x1dok\x91\xd4J\xab\xa6\xd5\xe5\x80\xbc0\xa9\x94\x850\xdb\xe0\x0bT\xaeI.6\xb0\xc83\x9f\xfa\xf3(\xd0\x0b\x85\xb4R]\xe1\x16^T)Dm-\xc5A\x9c_\x97Dz\x8b\xc0b\xe4\xcc2\x8b\xf2A 56 s> \xa1FstatusBok\x83T\x1dok\x91\xd4J\xab\xa6\xd5\xe5\x80\xbc0\xa9\x94\x850\xdb\xe0\x0bT\xaeI.6\xb0\xc83\x9f\xfa\xf3(\xd0\x0b\x85\xb4R]\xe1\x16^T)Dm-\xc5A\x9c_\x97Dz\x8b\xc0b\xe4\xcc2\x8b\xf2A
57 s> \r\n 57 s> \r\n
58 received frame(size=64; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=eos) 58 received frame(size=75; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=eos)
59 s> 0\r\n 59 s> 0\r\n
60 s> \r\n 60 s> \r\n
61 response: [b'\x1dok\x91\xd4J\xab\xa6\xd5\xe5\x80\xbc0\xa9\x94\x850\xdb\xe0\x0b', b'\xaeI.6\xb0\xc83\x9f\xfa\xf3(\xd0\x0b\x85\xb4R]\xe1\x16^', b')Dm-\xc5A\x9c_\x97Dz\x8b\xc0b\xe4\xcc2\x8b\xf2A'] 61 response: [b'\x1dok\x91\xd4J\xab\xa6\xd5\xe5\x80\xbc0\xa9\x94\x850\xdb\xe0\x0b', b'\xaeI.6\xb0\xc83\x9f\xfa\xf3(\xd0\x0b\x85\xb4R]\xe1\x16^', b')Dm-\xc5A\x9c_\x97Dz\x8b\xc0b\xe4\xcc2\x8b\xf2A']
62 62
63 Requesting just the public heads works 63 Requesting just the public heads works
68 > EOF 68 > EOF
69 creating http peer for wire protocol version 2 69 creating http peer for wire protocol version 2
70 sending heads command 70 sending heads command
71 s> POST /api/exp-http-v2-0001/ro/heads HTTP/1.1\r\n 71 s> POST /api/exp-http-v2-0001/ro/heads HTTP/1.1\r\n
72 s> Accept-Encoding: identity\r\n 72 s> Accept-Encoding: identity\r\n
73 s> accept: application/mercurial-exp-framing-0004\r\n 73 s> accept: application/mercurial-exp-framing-0005\r\n
74 s> content-type: application/mercurial-exp-framing-0004\r\n 74 s> content-type: application/mercurial-exp-framing-0005\r\n
75 s> content-length: 39\r\n 75 s> content-length: 39\r\n
76 s> host: $LOCALIP:$HGPORT\r\n (glob) 76 s> host: $LOCALIP:$HGPORT\r\n (glob)
77 s> user-agent: Mercurial debugwireproto\r\n 77 s> user-agent: Mercurial debugwireproto\r\n
78 s> \r\n 78 s> \r\n
79 s> \x1f\x00\x00\x01\x00\x01\x01\x11\xa2Dargs\xa1JpubliconlyA1DnameEheads 79 s> \x1f\x00\x00\x01\x00\x01\x01\x11\xa2Dargs\xa1JpubliconlyA1DnameEheads
80 s> makefile('rb', None) 80 s> makefile('rb', None)
81 s> HTTP/1.1 200 OK\r\n 81 s> HTTP/1.1 200 OK\r\n
82 s> Server: testing stub value\r\n 82 s> Server: testing stub value\r\n
83 s> Date: $HTTP_DATE$\r\n 83 s> Date: $HTTP_DATE$\r\n
84 s> Content-Type: application/mercurial-exp-framing-0004\r\n 84 s> Content-Type: application/mercurial-exp-framing-0005\r\n
85 s> Transfer-Encoding: chunked\r\n 85 s> Transfer-Encoding: chunked\r\n
86 s> \r\n 86 s> \r\n
87 s> 1e\r\n 87 s> 29\r\n
88 s> \x16\x00\x00\x01\x00\x02\x012 88 s> !\x00\x00\x01\x00\x02\x012
89 s> \x81Tx\xd2\xdc\xa46\xb2\xf5\xb1\x88\xac&~)\xb8\x1e\x07&m8\xfc 89 s> \xa1FstatusBok\x81Tx\xd2\xdc\xa46\xb2\xf5\xb1\x88\xac&~)\xb8\x1e\x07&m8\xfc
90 s> \r\n 90 s> \r\n
91 received frame(size=22; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=eos) 91 received frame(size=33; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=eos)
92 s> 0\r\n 92 s> 0\r\n
93 s> \r\n 93 s> \r\n
94 response: [b'x\xd2\xdc\xa46\xb2\xf5\xb1\x88\xac&~)\xb8\x1e\x07&m8\xfc'] 94 response: [b'x\xd2\xdc\xa46\xb2\xf5\xb1\x88\xac&~)\xb8\x1e\x07&m8\xfc']
95 95
96 $ cat error.log 96 $ cat error.log