##// END OF EJS Templates
wireprotov2: change command response protocol to include a leading map...
Gregory Szorc -
r37743:3ea8323d default
parent child Browse files
Show More
@@ -673,7 +673,7 b' Command Response Data (``0x03``)'
673 673
674 674 This frame contains response data to an issued command.
675 675
676 Response data ALWAYS consists of a series of 0 or more CBOR encoded
676 Response data ALWAYS consists of a series of 1 or more CBOR encoded
677 677 values. A CBOR value may be using indefinite length encoding. And the
678 678 bytes constituting the value may span several frames.
679 679
@@ -914,7 +914,7 b' The following profiles are defined:'
914 914
915 915 TBD
916 916
917 Issuing Commands
917 Command Protocol
918 918 ----------------
919 919
920 920 A client can request that a remote run a command by sending it
@@ -960,6 +960,35 b' TODO define failure mechanism.'
960 960 Servers MAY dispatch to commands immediately once argument data
961 961 is available or delay until command data is received in full.
962 962
963 Once a ``Command Request`` frame is sent, a client must be prepared to
964 receive any of the following frames associated with that request:
965 ``Command Response``, ``Error Response``, ``Human Output Side-Channel``,
966 ``Progress Update``.
967
968 The *main* response for a command will be in ``Command Response`` frames.
969 The payloads of these frames consist of 1 or more CBOR encoded values.
970 The first CBOR value on the first ``Command Response`` frame is special
971 and denotes the overall status of the command. This CBOR map contains
972 the following bytestring keys:
973
974 status
975 (bytestring) A well-defined message containing the overall status of
976 this command request. The following values are defined:
977
978 ok
979 The command was received successfully and its response follows.
980 error
981 There was an error processing the command. More details about the
982 error are encoded in the ``error`` key.
983
984 error (optional)
985 A map containing information about an encountered error. The map has the
986 following keys:
987
988 message
989 (array of maps) A message describing the error. The message uses the
990 same format as those in the ``Human Output Side-Channel`` frame.
991
963 992 Capabilities
964 993 ============
965 994
@@ -354,16 +354,27 b' def createcommandresponseframesfrombytes'
354 354
355 355 Returns a generator of bytearrays.
356 356 """
357 # Automatically send the overall CBOR response map.
358 overall = cbor.dumps({b'status': b'ok'}, canonical=True)
359 if len(overall) > maxframesize:
360 raise error.ProgrammingError('not yet implemented')
357 361
358 # Simple case of a single frame.
359 if len(data) <= maxframesize:
362 # Simple case where we can fit the full response in a single frame.
363 if len(overall) + len(data) <= maxframesize:
360 364 flags = FLAG_COMMAND_RESPONSE_EOS
361 365 yield stream.makeframe(requestid=requestid,
362 366 typeid=FRAME_TYPE_COMMAND_RESPONSE,
363 367 flags=flags,
364 payload=data)
368 payload=overall + data)
365 369 return
366 370
371 # It's easier to send the overall CBOR map in its own frame than to track
372 # offsets.
373 yield stream.makeframe(requestid=requestid,
374 typeid=FRAME_TYPE_COMMAND_RESPONSE,
375 flags=FLAG_COMMAND_RESPONSE_CONTINUATION,
376 payload=overall)
377
367 378 offset = 0
368 379 while True:
369 380 chunk = data[offset:offset + maxframesize]
@@ -18,6 +18,21 b' from . import ('
18 18 wireprotoframing,
19 19 )
20 20
21 def formatrichmessage(atoms):
22 """Format an encoded message from the framing protocol."""
23
24 chunks = []
25
26 for atom in atoms:
27 msg = _(atom[b'msg'])
28
29 if b'args' in atom:
30 msg = msg % atom[b'args']
31
32 chunks.append(msg)
33
34 return b''.join(chunks)
35
21 36 class commandresponse(object):
22 37 """Represents the response to a command request."""
23 38
@@ -128,9 +143,20 b' class clienthandler(object):'
128 143 # decoded value. Otherwise resolve to the rich response object.
129 144 decoder = COMMAND_DECODERS.get(response.command)
130 145
131 result = decoder(response) if decoder else response
146 # TODO consider always resolving the overall status map.
147 if decoder:
148 objs = response.cborobjects()
149
150 overall = next(objs)
132 151
133 self._futures[frame.requestid].set_result(result)
152 if overall['status'] == 'ok':
153 self._futures[frame.requestid].set_result(decoder(objs))
154 else:
155 e = error.RepoError(
156 formatrichmessage(overall['error']['message']))
157 self._futures[frame.requestid].set_exception(e)
158 else:
159 self._futures[frame.requestid].set_result(response)
134 160
135 161 del self._requests[frame.requestid]
136 162 del self._futures[frame.requestid]
@@ -139,31 +165,31 b' class clienthandler(object):'
139 165 raise error.ProgrammingError(
140 166 'unhandled action from clientreactor: %s' % action)
141 167
142 def decodebranchmap(resp):
168 def decodebranchmap(objs):
143 169 # Response should be a single CBOR map of branch name to array of nodes.
144 bm = next(resp.cborobjects())
170 bm = next(objs)
145 171
146 172 return {encoding.tolocal(k): v for k, v in bm.items()}
147 173
148 def decodeheads(resp):
174 def decodeheads(objs):
149 175 # Array of node bytestrings.
150 return next(resp.cborobjects())
176 return next(objs)
151 177
152 def decodeknown(resp):
178 def decodeknown(objs):
153 179 # Bytestring where each byte is a 0 or 1.
154 raw = next(resp.cborobjects())
180 raw = next(objs)
155 181
156 182 return [True if c == '1' else False for c in raw]
157 183
158 def decodelistkeys(resp):
184 def decodelistkeys(objs):
159 185 # Map with bytestring keys and values.
160 return next(resp.cborobjects())
186 return next(objs)
161 187
162 def decodelookup(resp):
163 return next(resp.cborobjects())
188 def decodelookup(objs):
189 return next(objs)
164 190
165 def decodepushkey(resp):
166 return next(resp.cborobjects())
191 def decodepushkey(objs):
192 return next(objs)
167 193
168 194 COMMAND_DECODERS = {
169 195 'branchmap': decodebranchmap,
@@ -26,7 +26,7 b' from . import ('
26 26 wireprototypes,
27 27 )
28 28
29 FRAMINGTYPE = b'application/mercurial-exp-framing-0004'
29 FRAMINGTYPE = b'application/mercurial-exp-framing-0005'
30 30
31 31 HTTP_WIREPROTO_V2 = wireprototypes.HTTP_WIREPROTO_V2
32 32
@@ -98,7 +98,7 b' Missing Accept header results in 406'
98 98 s> Content-Type: text/plain\r\n
99 99 s> Content-Length: 85\r\n
100 100 s> \r\n
101 s> client MUST specify Accept header with value: application/mercurial-exp-framing-0004\n
101 s> client MUST specify Accept header with value: application/mercurial-exp-framing-0005\n
102 102
103 103 Bad Accept header results in 406
104 104
@@ -121,7 +121,7 b' Bad Accept header results in 406'
121 121 s> Content-Type: text/plain\r\n
122 122 s> Content-Length: 85\r\n
123 123 s> \r\n
124 s> client MUST specify Accept header with value: application/mercurial-exp-framing-0004\n
124 s> client MUST specify Accept header with value: application/mercurial-exp-framing-0005\n
125 125
126 126 Bad Content-Type header results in 415
127 127
@@ -134,7 +134,7 b' Bad Content-Type header results in 415'
134 134 using raw connection to peer
135 135 s> POST /api/exp-http-v2-0001/ro/customreadonly HTTP/1.1\r\n
136 136 s> Accept-Encoding: identity\r\n
137 s> accept: application/mercurial-exp-framing-0004\r\n
137 s> accept: application/mercurial-exp-framing-0005\r\n
138 138 s> content-type: badmedia\r\n
139 139 s> user-agent: test\r\n
140 140 s> host: $LOCALIP:$HGPORT\r\n (glob)
@@ -146,7 +146,7 b' Bad Content-Type header results in 415'
146 146 s> Content-Type: text/plain\r\n
147 147 s> Content-Length: 88\r\n
148 148 s> \r\n
149 s> client MUST send Content-Type header with value: application/mercurial-exp-framing-0004\n
149 s> client MUST send Content-Type header with value: application/mercurial-exp-framing-0005\n
150 150
151 151 Request to read-only command works out of the box
152 152
@@ -161,7 +161,7 b' Request to read-only command works out o'
161 161 s> POST /api/exp-http-v2-0001/ro/customreadonly HTTP/1.1\r\n
162 162 s> Accept-Encoding: identity\r\n
163 163 s> *\r\n (glob)
164 s> content-type: application/mercurial-exp-framing-0004\r\n
164 s> content-type: application/mercurial-exp-framing-0005\r\n
165 165 s> user-agent: test\r\n
166 166 s> content-length: 29\r\n
167 167 s> host: $LOCALIP:$HGPORT\r\n (glob)
@@ -171,11 +171,11 b' Request to read-only command works out o'
171 171 s> HTTP/1.1 200 OK\r\n
172 172 s> Server: testing stub value\r\n
173 173 s> Date: $HTTP_DATE$\r\n
174 s> Content-Type: application/mercurial-exp-framing-0004\r\n
174 s> Content-Type: application/mercurial-exp-framing-0005\r\n
175 175 s> Transfer-Encoding: chunked\r\n
176 176 s> \r\n
177 s> 27\r\n
178 s> \x1f\x00\x00\x01\x00\x02\x012X\x1dcustomreadonly bytes response
177 s> 32\r\n
178 s> *\x00\x00\x01\x00\x02\x012\xa1FstatusBokX\x1dcustomreadonly bytes response
179 179 s> \r\n
180 180 s> 0\r\n
181 181 s> \r\n
@@ -187,8 +187,8 b' Request to read-only command works out o'
187 187 sending customreadonly command
188 188 s> POST /api/exp-http-v2-0001/ro/customreadonly HTTP/1.1\r\n
189 189 s> Accept-Encoding: identity\r\n
190 s> accept: application/mercurial-exp-framing-0004\r\n
191 s> content-type: application/mercurial-exp-framing-0004\r\n
190 s> accept: application/mercurial-exp-framing-0005\r\n
191 s> content-type: application/mercurial-exp-framing-0005\r\n
192 192 s> content-length: 29\r\n
193 193 s> host: $LOCALIP:$HGPORT\r\n (glob)
194 194 s> user-agent: Mercurial debugwireproto\r\n
@@ -198,17 +198,17 b' Request to read-only command works out o'
198 198 s> HTTP/1.1 200 OK\r\n
199 199 s> Server: testing stub value\r\n
200 200 s> Date: $HTTP_DATE$\r\n
201 s> Content-Type: application/mercurial-exp-framing-0004\r\n
201 s> Content-Type: application/mercurial-exp-framing-0005\r\n
202 202 s> Transfer-Encoding: chunked\r\n
203 203 s> \r\n
204 s> 27\r\n
205 s> \x1f\x00\x00\x01\x00\x02\x012
206 s> X\x1dcustomreadonly bytes response
204 s> 32\r\n
205 s> *\x00\x00\x01\x00\x02\x012
206 s> \xa1FstatusBokX\x1dcustomreadonly bytes response
207 207 s> \r\n
208 received frame(size=31; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=eos)
208 received frame(size=42; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=eos)
209 209 s> 0\r\n
210 210 s> \r\n
211 response: [b'customreadonly bytes response']
211 response: [{b'status': b'ok'}, b'customreadonly bytes response']
212 212
213 213 Request to read-write command fails because server is read-only by default
214 214
@@ -301,8 +301,8 b' Authorized request for valid read-write '
301 301 using raw connection to peer
302 302 s> POST /api/exp-http-v2-0001/rw/customreadonly HTTP/1.1\r\n
303 303 s> Accept-Encoding: identity\r\n
304 s> accept: application/mercurial-exp-framing-0004\r\n
305 s> content-type: application/mercurial-exp-framing-0004\r\n
304 s> accept: application/mercurial-exp-framing-0005\r\n
305 s> content-type: application/mercurial-exp-framing-0005\r\n
306 306 s> user-agent: test\r\n
307 307 s> content-length: 29\r\n
308 308 s> host: $LOCALIP:$HGPORT\r\n (glob)
@@ -312,11 +312,11 b' Authorized request for valid read-write '
312 312 s> HTTP/1.1 200 OK\r\n
313 313 s> Server: testing stub value\r\n
314 314 s> Date: $HTTP_DATE$\r\n
315 s> Content-Type: application/mercurial-exp-framing-0004\r\n
315 s> Content-Type: application/mercurial-exp-framing-0005\r\n
316 316 s> Transfer-Encoding: chunked\r\n
317 317 s> \r\n
318 s> 27\r\n
319 s> \x1f\x00\x00\x01\x00\x02\x012X\x1dcustomreadonly bytes response
318 s> 32\r\n
319 s> *\x00\x00\x01\x00\x02\x012\xa1FstatusBokX\x1dcustomreadonly bytes response
320 320 s> \r\n
321 321 s> 0\r\n
322 322 s> \r\n
@@ -331,7 +331,7 b' Authorized request for unknown command i'
331 331 using raw connection to peer
332 332 s> POST /api/exp-http-v2-0001/rw/badcommand HTTP/1.1\r\n
333 333 s> Accept-Encoding: identity\r\n
334 s> accept: application/mercurial-exp-framing-0004\r\n
334 s> accept: application/mercurial-exp-framing-0005\r\n
335 335 s> user-agent: test\r\n
336 336 s> host: $LOCALIP:$HGPORT\r\n (glob)
337 337 s> \r\n
@@ -393,8 +393,8 b' Command frames can be reflected via debu'
393 393 using raw connection to peer
394 394 s> POST /api/exp-http-v2-0001/ro/debugreflect HTTP/1.1\r\n
395 395 s> Accept-Encoding: identity\r\n
396 s> accept: application/mercurial-exp-framing-0004\r\n
397 s> content-type: application/mercurial-exp-framing-0004\r\n
396 s> accept: application/mercurial-exp-framing-0005\r\n
397 s> content-type: application/mercurial-exp-framing-0005\r\n
398 398 s> user-agent: test\r\n
399 399 s> content-length: 47\r\n
400 400 s> host: $LOCALIP:$HGPORT\r\n (glob)
@@ -424,8 +424,8 b' Multiple requests to regular command URL'
424 424 using raw connection to peer
425 425 s> POST /api/exp-http-v2-0001/ro/customreadonly HTTP/1.1\r\n
426 426 s> Accept-Encoding: identity\r\n
427 s> accept: application/mercurial-exp-framing-0004\r\n
428 s> content-type: application/mercurial-exp-framing-0004\r\n
427 s> accept: application/mercurial-exp-framing-0005\r\n
428 s> content-type: application/mercurial-exp-framing-0005\r\n
429 429 s> user-agent: test\r\n
430 430 s> content-length: 29\r\n
431 431 s> host: $LOCALIP:$HGPORT\r\n (glob)
@@ -435,11 +435,11 b' Multiple requests to regular command URL'
435 435 s> HTTP/1.1 200 OK\r\n
436 436 s> Server: testing stub value\r\n
437 437 s> Date: $HTTP_DATE$\r\n
438 s> Content-Type: application/mercurial-exp-framing-0004\r\n
438 s> Content-Type: application/mercurial-exp-framing-0005\r\n
439 439 s> Transfer-Encoding: chunked\r\n
440 440 s> \r\n
441 s> 27\r\n
442 s> \x1f\x00\x00\x01\x00\x02\x012X\x1dcustomreadonly bytes response
441 s> 32\r\n
442 s> *\x00\x00\x01\x00\x02\x012\xa1FstatusBokX\x1dcustomreadonly bytes response
443 443 s> \r\n
444 444 s> 0\r\n
445 445 s> \r\n
@@ -468,14 +468,14 b' Multiple requests to "multirequest" URL '
468 468 s> HTTP/1.1 200 OK\r\n
469 469 s> Server: testing stub value\r\n
470 470 s> Date: $HTTP_DATE$\r\n
471 s> Content-Type: application/mercurial-exp-framing-0004\r\n
471 s> Content-Type: application/mercurial-exp-framing-0005\r\n
472 472 s> Transfer-Encoding: chunked\r\n
473 473 s> \r\n
474 s> 27\r\n
475 s> \x1f\x00\x00\x01\x00\x02\x012X\x1dcustomreadonly bytes response
474 s> 32\r\n
475 s> *\x00\x00\x01\x00\x02\x012\xa1FstatusBokX\x1dcustomreadonly bytes response
476 476 s> \r\n
477 s> 27\r\n
478 s> \x1f\x00\x00\x03\x00\x02\x002X\x1dcustomreadonly bytes response
477 s> 32\r\n
478 s> *\x00\x00\x03\x00\x02\x002\xa1FstatusBokX\x1dcustomreadonly bytes response
479 479 s> \r\n
480 480 s> 0\r\n
481 481 s> \r\n
@@ -495,8 +495,8 b' Interleaved requests to "multirequest" a'
495 495 using raw connection to peer
496 496 s> POST /api/exp-http-v2-0001/ro/multirequest HTTP/1.1\r\n
497 497 s> Accept-Encoding: identity\r\n
498 s> accept: application/mercurial-exp-framing-0004\r\n
499 s> content-type: application/mercurial-exp-framing-0004\r\n
498 s> accept: application/mercurial-exp-framing-0005\r\n
499 s> content-type: application/mercurial-exp-framing-0005\r\n
500 500 s> user-agent: test\r\n
501 501 s> content-length: 115\r\n
502 502 s> host: $LOCALIP:$HGPORT\r\n (glob)
@@ -506,14 +506,14 b' Interleaved requests to "multirequest" a'
506 506 s> HTTP/1.1 200 OK\r\n
507 507 s> Server: testing stub value\r\n
508 508 s> Date: $HTTP_DATE$\r\n
509 s> Content-Type: application/mercurial-exp-framing-0004\r\n
509 s> Content-Type: application/mercurial-exp-framing-0005\r\n
510 510 s> Transfer-Encoding: chunked\r\n
511 511 s> \r\n
512 s> 28\r\n
513 s> \x00\x00\x03\x00\x02\x012\xa3Fphases@Ibookmarks@Jnamespaces@
512 s> 33\r\n
513 s> +\x00\x00\x03\x00\x02\x012\xa1FstatusBok\xa3Fphases@Ibookmarks@Jnamespaces@
514 514 s> \r\n
515 s> 9\r\n
516 s> \x01\x00\x00\x01\x00\x02\x002\xa0
515 s> 14\r\n
516 s> \x0c\x00\x00\x01\x00\x02\x002\xa1FstatusBok\xa0
517 517 s> \r\n
518 518 s> 0\r\n
519 519 s> \r\n
@@ -545,8 +545,8 b' Attempting to run a read-write command v'
545 545 using raw connection to peer
546 546 s> POST /api/exp-http-v2-0001/ro/multirequest HTTP/1.1\r\n
547 547 s> Accept-Encoding: identity\r\n
548 s> accept: application/mercurial-exp-framing-0004\r\n
549 s> content-type: application/mercurial-exp-framing-0004\r\n
548 s> accept: application/mercurial-exp-framing-0005\r\n
549 s> content-type: application/mercurial-exp-framing-0005\r\n
550 550 s> user-agent: test\r\n
551 551 s> content-length: 22\r\n
552 552 s> host: $LOCALIP:$HGPORT\r\n (glob)
@@ -305,12 +305,12 b' Client with HTTPv2 enabled automatically'
305 305 s> Content-Type: application/mercurial-cbor\r\n
306 306 s> Content-Length: *\r\n (glob)
307 307 s> \r\n
308 s> \xa3Dapis\xa1Pexp-http-v2-0001\xa4Hcommands\xa7Eheads\xa2Dargs\xa1Jpubliconly\xf4Kpermissions\x81DpullEknown\xa2Dargs\xa1Enodes\x81HdeadbeefKpermissions\x81DpullFlookup\xa2Dargs\xa1CkeyCfooKpermissions\x81DpullGpushkey\xa2Dargs\xa4CkeyCkeyCnewCnewColdColdInamespaceBnsKpermissions\x81DpushHlistkeys\xa2Dargs\xa1InamespaceBnsKpermissions\x81DpullIbranchmap\xa2Dargs\xa0Kpermissions\x81DpullLcapabilities\xa2Dargs\xa0Kpermissions\x81DpullKcompression\x82\xa1DnameDzstd\xa1DnameDzlibNrawrepoformats\x82LgeneraldeltaHrevlogv1Qframingmediatypes\x81X&application/mercurial-exp-framing-0004GapibaseDapi/Nv1capabilitiesY\x01\xcabatch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset compression=$BUNDLE2_COMPRESSIONS$ getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash
308 s> \xa3Dapis\xa1Pexp-http-v2-0001\xa4Hcommands\xa7Eheads\xa2Dargs\xa1Jpubliconly\xf4Kpermissions\x81DpullEknown\xa2Dargs\xa1Enodes\x81HdeadbeefKpermissions\x81DpullFlookup\xa2Dargs\xa1CkeyCfooKpermissions\x81DpullGpushkey\xa2Dargs\xa4CkeyCkeyCnewCnewColdColdInamespaceBnsKpermissions\x81DpushHlistkeys\xa2Dargs\xa1InamespaceBnsKpermissions\x81DpullIbranchmap\xa2Dargs\xa0Kpermissions\x81DpullLcapabilities\xa2Dargs\xa0Kpermissions\x81DpullKcompression\x82\xa1DnameDzstd\xa1DnameDzlibNrawrepoformats\x82LgeneraldeltaHrevlogv1Qframingmediatypes\x81X&application/mercurial-exp-framing-0005GapibaseDapi/Nv1capabilitiesY\x01\xcabatch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset compression=$BUNDLE2_COMPRESSIONS$ getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash
309 309 sending heads command
310 310 s> POST /api/exp-http-v2-0001/ro/heads HTTP/1.1\r\n
311 311 s> Accept-Encoding: identity\r\n
312 s> accept: application/mercurial-exp-framing-0004\r\n
313 s> content-type: application/mercurial-exp-framing-0004\r\n
312 s> accept: application/mercurial-exp-framing-0005\r\n
313 s> content-type: application/mercurial-exp-framing-0005\r\n
314 314 s> content-length: 20\r\n
315 315 s> host: $LOCALIP:$HGPORT\r\n (glob)
316 316 s> user-agent: Mercurial debugwireproto\r\n
@@ -320,14 +320,14 b' Client with HTTPv2 enabled automatically'
320 320 s> HTTP/1.1 200 OK\r\n
321 321 s> Server: testing stub value\r\n
322 322 s> Date: $HTTP_DATE$\r\n
323 s> Content-Type: application/mercurial-exp-framing-0004\r\n
323 s> Content-Type: application/mercurial-exp-framing-0005\r\n
324 324 s> Transfer-Encoding: chunked\r\n
325 325 s> \r\n
326 s> 1e\r\n
327 s> \x16\x00\x00\x01\x00\x02\x012
328 s> \x81T\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00
326 s> 29\r\n
327 s> !\x00\x00\x01\x00\x02\x012
328 s> \xa1FstatusBok\x81T\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00
329 329 s> \r\n
330 received frame(size=22; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=eos)
330 received frame(size=33; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=eos)
331 331 s> 0\r\n
332 332 s> \r\n
333 333 response: [b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00']
@@ -45,8 +45,8 b' No arguments returns something reasonabl'
45 45 sending branchmap command
46 46 s> POST /api/exp-http-v2-0001/ro/branchmap HTTP/1.1\r\n
47 47 s> Accept-Encoding: identity\r\n
48 s> accept: application/mercurial-exp-framing-0004\r\n
49 s> content-type: application/mercurial-exp-framing-0004\r\n
48 s> accept: application/mercurial-exp-framing-0005\r\n
49 s> content-type: application/mercurial-exp-framing-0005\r\n
50 50 s> content-length: 24\r\n
51 51 s> host: $LOCALIP:$HGPORT\r\n (glob)
52 52 s> user-agent: Mercurial debugwireproto\r\n
@@ -56,15 +56,15 b' No arguments returns something reasonabl'
56 56 s> HTTP/1.1 200 OK\r\n
57 57 s> Server: testing stub value\r\n
58 58 s> Date: $HTTP_DATE$\r\n
59 s> Content-Type: application/mercurial-exp-framing-0004\r\n
59 s> Content-Type: application/mercurial-exp-framing-0005\r\n
60 60 s> Transfer-Encoding: chunked\r\n
61 61 s> \r\n
62 s> 78\r\n
63 s> p\x00\x00\x01\x00\x02\x012
64 s> \xa3Gbranch1\x81T\xb5\xfa\xac\xdf\xd2c7h\xcb1R3l\xc0\x953\x81&f\x88Gbranch2\x81T"Aa\xc7X\x9a\xa4\x8f\xa8:H\xfe\xff^\x95\xb5j\xe3\'\xfcGdefault\x82T&\x80Z\xba\x1e`\n
62 s> 83\r\n
63 s> {\x00\x00\x01\x00\x02\x012
64 s> \xa1FstatusBok\xa3Gbranch1\x81T\xb5\xfa\xac\xdf\xd2c7h\xcb1R3l\xc0\x953\x81&f\x88Gbranch2\x81T"Aa\xc7X\x9a\xa4\x8f\xa8:H\xfe\xff^\x95\xb5j\xe3\'\xfcGdefault\x82T&\x80Z\xba\x1e`\n
65 65 s> \x82\xe96a\x14\x9f#\x13\x86j"\x1a{T\xbe\x0e\xf7<\x17\xad\xe3\xfc\x89\xdcAp\x1e\xb9\xfc:\x91\xb5\x82\x82
66 66 s> \r\n
67 received frame(size=112; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=eos)
67 received frame(size=123; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=eos)
68 68 s> 0\r\n
69 69 s> \r\n
70 70 response: {b'branch1': [b'\xb5\xfa\xac\xdf\xd2c7h\xcb1R3l\xc0\x953\x81&f\x88'], b'branch2': [b'"Aa\xc7X\x9a\xa4\x8f\xa8:H\xfe\xff^\x95\xb5j\xe3\'\xfc'], b'default': [b'&\x80Z\xba\x1e`\n\x82\xe96a\x14\x9f#\x13\x86j"\x1a{', b'\xbe\x0e\xf7<\x17\xad\xe3\xfc\x89\xdcAp\x1e\xb9\xfc:\x91\xb5\x82\x82']}
@@ -192,8 +192,8 b' Request for HTTPv2 service returns infor'
192 192 s> Content-Type: application/mercurial-cbor\r\n
193 193 s> Content-Length: *\r\n (glob)
194 194 s> \r\n
195 s> \xa3Dapis\xa1Pexp-http-v2-0001\xa4Hcommands\xa7Eheads\xa2Dargs\xa1Jpubliconly\xf4Kpermissions\x81DpullEknown\xa2Dargs\xa1Enodes\x81HdeadbeefKpermissions\x81DpullFlookup\xa2Dargs\xa1CkeyCfooKpermissions\x81DpullGpushkey\xa2Dargs\xa4CkeyCkeyCnewCnewColdColdInamespaceBnsKpermissions\x81DpushHlistkeys\xa2Dargs\xa1InamespaceBnsKpermissions\x81DpullIbranchmap\xa2Dargs\xa0Kpermissions\x81DpullLcapabilities\xa2Dargs\xa0Kpermissions\x81DpullKcompression\x82\xa1DnameDzstd\xa1DnameDzlibNrawrepoformats\x82LgeneraldeltaHrevlogv1Qframingmediatypes\x81X&application/mercurial-exp-framing-0004GapibaseDapi/Nv1capabilitiesY\x01\xcabatch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset compression=$BUNDLE2_COMPRESSIONS$ getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash
196 cbor> {b'apibase': b'api/', b'apis': {b'exp-http-v2-0001': {b'commands': {b'branchmap': {b'args': {}, b'permissions': [b'pull']}, b'capabilities': {b'args': {}, b'permissions': [b'pull']}, b'heads': {b'args': {b'publiconly': False}, b'permissions': [b'pull']}, b'known': {b'args': {b'nodes': [b'deadbeef']}, b'permissions': [b'pull']}, b'listkeys': {b'args': {b'namespace': b'ns'}, b'permissions': [b'pull']}, b'lookup': {b'args': {b'key': b'foo'}, b'permissions': [b'pull']}, b'pushkey': {b'args': {b'key': b'key', b'namespace': b'ns', b'new': b'new', b'old': b'old'}, b'permissions': [b'push']}}, b'compression': [{b'name': b'zstd'}, {b'name': b'zlib'}], b'framingmediatypes': [b'application/mercurial-exp-framing-0004'], b'rawrepoformats': [b'generaldelta', b'revlogv1']}}, b'v1capabilities': b'batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset compression=$BUNDLE2_COMPRESSIONS$ getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash'}
195 s> \xa3Dapis\xa1Pexp-http-v2-0001\xa4Hcommands\xa7Eheads\xa2Dargs\xa1Jpubliconly\xf4Kpermissions\x81DpullEknown\xa2Dargs\xa1Enodes\x81HdeadbeefKpermissions\x81DpullFlookup\xa2Dargs\xa1CkeyCfooKpermissions\x81DpullGpushkey\xa2Dargs\xa4CkeyCkeyCnewCnewColdColdInamespaceBnsKpermissions\x81DpushHlistkeys\xa2Dargs\xa1InamespaceBnsKpermissions\x81DpullIbranchmap\xa2Dargs\xa0Kpermissions\x81DpullLcapabilities\xa2Dargs\xa0Kpermissions\x81DpullKcompression\x82\xa1DnameDzstd\xa1DnameDzlibNrawrepoformats\x82LgeneraldeltaHrevlogv1Qframingmediatypes\x81X&application/mercurial-exp-framing-0005GapibaseDapi/Nv1capabilitiesY\x01\xcabatch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset compression=$BUNDLE2_COMPRESSIONS$ getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash
196 cbor> {b'apibase': b'api/', b'apis': {b'exp-http-v2-0001': {b'commands': {b'branchmap': {b'args': {}, b'permissions': [b'pull']}, b'capabilities': {b'args': {}, b'permissions': [b'pull']}, b'heads': {b'args': {b'publiconly': False}, b'permissions': [b'pull']}, b'known': {b'args': {b'nodes': [b'deadbeef']}, b'permissions': [b'pull']}, b'listkeys': {b'args': {b'namespace': b'ns'}, b'permissions': [b'pull']}, b'lookup': {b'args': {b'key': b'foo'}, b'permissions': [b'pull']}, b'pushkey': {b'args': {b'key': b'key', b'namespace': b'ns', b'new': b'new', b'old': b'old'}, b'permissions': [b'push']}}, b'compression': [{b'name': b'zstd'}, {b'name': b'zlib'}], b'framingmediatypes': [b'application/mercurial-exp-framing-0005'], b'rawrepoformats': [b'generaldelta', b'revlogv1']}}, b'v1capabilities': b'batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset compression=$BUNDLE2_COMPRESSIONS$ getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash'}
197 197
198 198 capabilities command returns expected info
199 199
@@ -217,12 +217,12 b' capabilities command returns expected in'
217 217 s> Content-Type: application/mercurial-cbor\r\n
218 218 s> Content-Length: *\r\n (glob)
219 219 s> \r\n
220 s> \xa3Dapis\xa1Pexp-http-v2-0001\xa4Hcommands\xa7Eheads\xa2Dargs\xa1Jpubliconly\xf4Kpermissions\x81DpullEknown\xa2Dargs\xa1Enodes\x81HdeadbeefKpermissions\x81DpullFlookup\xa2Dargs\xa1CkeyCfooKpermissions\x81DpullGpushkey\xa2Dargs\xa4CkeyCkeyCnewCnewColdColdInamespaceBnsKpermissions\x81DpushHlistkeys\xa2Dargs\xa1InamespaceBnsKpermissions\x81DpullIbranchmap\xa2Dargs\xa0Kpermissions\x81DpullLcapabilities\xa2Dargs\xa0Kpermissions\x81DpullKcompression\x82\xa1DnameDzstd\xa1DnameDzlibNrawrepoformats\x82LgeneraldeltaHrevlogv1Qframingmediatypes\x81X&application/mercurial-exp-framing-0004GapibaseDapi/Nv1capabilitiesY\x01\xcabatch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset compression=$BUNDLE2_COMPRESSIONS$ getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash
220 s> \xa3Dapis\xa1Pexp-http-v2-0001\xa4Hcommands\xa7Eheads\xa2Dargs\xa1Jpubliconly\xf4Kpermissions\x81DpullEknown\xa2Dargs\xa1Enodes\x81HdeadbeefKpermissions\x81DpullFlookup\xa2Dargs\xa1CkeyCfooKpermissions\x81DpullGpushkey\xa2Dargs\xa4CkeyCkeyCnewCnewColdColdInamespaceBnsKpermissions\x81DpushHlistkeys\xa2Dargs\xa1InamespaceBnsKpermissions\x81DpullIbranchmap\xa2Dargs\xa0Kpermissions\x81DpullLcapabilities\xa2Dargs\xa0Kpermissions\x81DpullKcompression\x82\xa1DnameDzstd\xa1DnameDzlibNrawrepoformats\x82LgeneraldeltaHrevlogv1Qframingmediatypes\x81X&application/mercurial-exp-framing-0005GapibaseDapi/Nv1capabilitiesY\x01\xcabatch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset compression=$BUNDLE2_COMPRESSIONS$ getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash
221 221 sending capabilities command
222 222 s> POST /api/exp-http-v2-0001/ro/capabilities HTTP/1.1\r\n
223 223 s> Accept-Encoding: identity\r\n
224 224 s> *\r\n (glob)
225 s> content-type: application/mercurial-exp-framing-0004\r\n
225 s> content-type: application/mercurial-exp-framing-0005\r\n
226 226 s> content-length: 27\r\n
227 227 s> host: $LOCALIP:$HGPORT\r\n (glob)
228 228 s> user-agent: Mercurial debugwireproto\r\n
@@ -232,16 +232,16 b' capabilities command returns expected in'
232 232 s> HTTP/1.1 200 OK\r\n
233 233 s> Server: testing stub value\r\n
234 234 s> Date: $HTTP_DATE$\r\n
235 s> Content-Type: application/mercurial-exp-framing-0004\r\n
235 s> Content-Type: application/mercurial-exp-framing-0005\r\n
236 236 s> Transfer-Encoding: chunked\r\n
237 237 s> \r\n
238 s> 1d7\r\n
239 s> \xcf\x01\x00\x01\x00\x02\x012
240 s> \xa4Hcommands\xa7Eheads\xa2Dargs\xa1Jpubliconly\xf4Kpermissions\x81DpullEknown\xa2Dargs\xa1Enodes\x81HdeadbeefKpermissions\x81DpullFlookup\xa2Dargs\xa1CkeyCfooKpermissions\x81DpullGpushkey\xa2Dargs\xa4CkeyCkeyCnewCnewColdColdInamespaceBnsKpermissions\x81DpushHlistkeys\xa2Dargs\xa1InamespaceBnsKpermissions\x81DpullIbranchmap\xa2Dargs\xa0Kpermissions\x81DpullLcapabilities\xa2Dargs\xa0Kpermissions\x81DpullKcompression\x82\xa1DnameDzstd\xa1DnameDzlibNrawrepoformats\x82LgeneraldeltaHrevlogv1Qframingmediatypes\x81X&application/mercurial-exp-framing-0004
238 s> 1e2\r\n
239 s> \xda\x01\x00\x01\x00\x02\x012
240 s> \xa1FstatusBok\xa4Hcommands\xa7Eheads\xa2Dargs\xa1Jpubliconly\xf4Kpermissions\x81DpullEknown\xa2Dargs\xa1Enodes\x81HdeadbeefKpermissions\x81DpullFlookup\xa2Dargs\xa1CkeyCfooKpermissions\x81DpullGpushkey\xa2Dargs\xa4CkeyCkeyCnewCnewColdColdInamespaceBnsKpermissions\x81DpushHlistkeys\xa2Dargs\xa1InamespaceBnsKpermissions\x81DpullIbranchmap\xa2Dargs\xa0Kpermissions\x81DpullLcapabilities\xa2Dargs\xa0Kpermissions\x81DpullKcompression\x82\xa1DnameDzstd\xa1DnameDzlibNrawrepoformats\x82LgeneraldeltaHrevlogv1Qframingmediatypes\x81X&application/mercurial-exp-framing-0005
241 241 s> \r\n
242 received frame(size=463; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=eos)
242 received frame(size=474; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=eos)
243 243 s> 0\r\n
244 244 s> \r\n
245 response: [{b'commands': {b'branchmap': {b'args': {}, b'permissions': [b'pull']}, b'capabilities': {b'args': {}, b'permissions': [b'pull']}, b'heads': {b'args': {b'publiconly': False}, b'permissions': [b'pull']}, b'known': {b'args': {b'nodes': [b'deadbeef']}, b'permissions': [b'pull']}, b'listkeys': {b'args': {b'namespace': b'ns'}, b'permissions': [b'pull']}, b'lookup': {b'args': {b'key': b'foo'}, b'permissions': [b'pull']}, b'pushkey': {b'args': {b'key': b'key', b'namespace': b'ns', b'new': b'new', b'old': b'old'}, b'permissions': [b'push']}}, b'compression': [{b'name': b'zstd'}, {b'name': b'zlib'}], b'framingmediatypes': [b'application/mercurial-exp-framing-0004'], b'rawrepoformats': [b'generaldelta', b'revlogv1']}]
245 response: [{b'status': b'ok'}, {b'commands': {b'branchmap': {b'args': {}, b'permissions': [b'pull']}, b'capabilities': {b'args': {}, b'permissions': [b'pull']}, b'heads': {b'args': {b'publiconly': False}, b'permissions': [b'pull']}, b'known': {b'args': {b'nodes': [b'deadbeef']}, b'permissions': [b'pull']}, b'listkeys': {b'args': {b'namespace': b'ns'}, b'permissions': [b'pull']}, b'lookup': {b'args': {b'key': b'foo'}, b'permissions': [b'pull']}, b'pushkey': {b'args': {b'key': b'key', b'namespace': b'ns', b'new': b'new', b'old': b'old'}, b'permissions': [b'push']}}, b'compression': [{b'name': b'zstd'}, {b'name': b'zlib'}], b'framingmediatypes': [b'application/mercurial-exp-framing-0005'], b'rawrepoformats': [b'generaldelta', b'revlogv1']}]
246 246
247 247 $ cat error.log
@@ -37,8 +37,8 b' All non-secret heads returned by default'
37 37 sending heads command
38 38 s> POST /api/exp-http-v2-0001/ro/heads HTTP/1.1\r\n
39 39 s> Accept-Encoding: identity\r\n
40 s> accept: application/mercurial-exp-framing-0004\r\n
41 s> content-type: 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-0005\r\n
42 42 s> content-length: 20\r\n
43 43 s> host: $LOCALIP:$HGPORT\r\n (glob)
44 44 s> user-agent: Mercurial debugwireproto\r\n
@@ -48,14 +48,14 b' All non-secret heads returned by default'
48 48 s> HTTP/1.1 200 OK\r\n
49 49 s> Server: testing stub value\r\n
50 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 52 s> Transfer-Encoding: chunked\r\n
53 53 s> \r\n
54 s> 48\r\n
55 s> @\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
54 s> 53\r\n
55 s> K\x00\x00\x01\x00\x02\x012
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 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 59 s> 0\r\n
60 60 s> \r\n
61 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']
@@ -70,8 +70,8 b' Requesting just the public heads works'
70 70 sending heads command
71 71 s> POST /api/exp-http-v2-0001/ro/heads HTTP/1.1\r\n
72 72 s> Accept-Encoding: identity\r\n
73 s> accept: application/mercurial-exp-framing-0004\r\n
74 s> content-type: 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-0005\r\n
75 75 s> content-length: 39\r\n
76 76 s> host: $LOCALIP:$HGPORT\r\n (glob)
77 77 s> user-agent: Mercurial debugwireproto\r\n
@@ -81,14 +81,14 b' Requesting just the public heads works'
81 81 s> HTTP/1.1 200 OK\r\n
82 82 s> Server: testing stub value\r\n
83 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 85 s> Transfer-Encoding: chunked\r\n
86 86 s> \r\n
87 s> 1e\r\n
88 s> \x16\x00\x00\x01\x00\x02\x012
89 s> \x81Tx\xd2\xdc\xa46\xb2\xf5\xb1\x88\xac&~)\xb8\x1e\x07&m8\xfc
87 s> 29\r\n
88 s> !\x00\x00\x01\x00\x02\x012
89 s> \xa1FstatusBok\x81Tx\xd2\xdc\xa46\xb2\xf5\xb1\x88\xac&~)\xb8\x1e\x07&m8\xfc
90 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 92 s> 0\r\n
93 93 s> \r\n
94 94 response: [b'x\xd2\xdc\xa46\xb2\xf5\xb1\x88\xac&~)\xb8\x1e\x07&m8\xfc']
@@ -29,8 +29,8 b' No arguments returns something reasonabl'
29 29 sending known command
30 30 s> POST /api/exp-http-v2-0001/ro/known HTTP/1.1\r\n
31 31 s> Accept-Encoding: identity\r\n
32 s> accept: application/mercurial-exp-framing-0004\r\n
33 s> content-type: application/mercurial-exp-framing-0004\r\n
32 s> accept: application/mercurial-exp-framing-0005\r\n
33 s> content-type: application/mercurial-exp-framing-0005\r\n
34 34 s> content-length: 20\r\n
35 35 s> host: $LOCALIP:$HGPORT\r\n (glob)
36 36 s> user-agent: Mercurial debugwireproto\r\n
@@ -40,14 +40,14 b' No arguments returns something reasonabl'
40 40 s> HTTP/1.1 200 OK\r\n
41 41 s> Server: testing stub value\r\n
42 42 s> Date: $HTTP_DATE$\r\n
43 s> Content-Type: application/mercurial-exp-framing-0004\r\n
43 s> Content-Type: application/mercurial-exp-framing-0005\r\n
44 44 s> Transfer-Encoding: chunked\r\n
45 45 s> \r\n
46 s> 9\r\n
47 s> \x01\x00\x00\x01\x00\x02\x012
48 s> @
46 s> 14\r\n
47 s> \x0c\x00\x00\x01\x00\x02\x012
48 s> \xa1FstatusBok@
49 49 s> \r\n
50 received frame(size=1; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=eos)
50 received frame(size=12; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=eos)
51 51 s> 0\r\n
52 52 s> \r\n
53 53 response: []
@@ -62,8 +62,8 b' Single known node works'
62 62 sending known command
63 63 s> POST /api/exp-http-v2-0001/ro/known HTTP/1.1\r\n
64 64 s> Accept-Encoding: identity\r\n
65 s> accept: application/mercurial-exp-framing-0004\r\n
66 s> content-type: application/mercurial-exp-framing-0004\r\n
65 s> accept: application/mercurial-exp-framing-0005\r\n
66 s> content-type: application/mercurial-exp-framing-0005\r\n
67 67 s> content-length: 54\r\n
68 68 s> host: $LOCALIP:$HGPORT\r\n (glob)
69 69 s> user-agent: Mercurial debugwireproto\r\n
@@ -73,14 +73,14 b' Single known node works'
73 73 s> HTTP/1.1 200 OK\r\n
74 74 s> Server: testing stub value\r\n
75 75 s> Date: $HTTP_DATE$\r\n
76 s> Content-Type: application/mercurial-exp-framing-0004\r\n
76 s> Content-Type: application/mercurial-exp-framing-0005\r\n
77 77 s> Transfer-Encoding: chunked\r\n
78 78 s> \r\n
79 s> a\r\n
80 s> \x02\x00\x00\x01\x00\x02\x012
81 s> A1
79 s> 15\r\n
80 s> \r\x00\x00\x01\x00\x02\x012
81 s> \xa1FstatusBokA1
82 82 s> \r\n
83 received frame(size=2; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=eos)
83 received frame(size=13; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=eos)
84 84 s> 0\r\n
85 85 s> \r\n
86 86 response: [True]
@@ -95,8 +95,8 b' Multiple nodes works'
95 95 sending known command
96 96 s> POST /api/exp-http-v2-0001/ro/known HTTP/1.1\r\n
97 97 s> Accept-Encoding: identity\r\n
98 s> accept: application/mercurial-exp-framing-0004\r\n
99 s> content-type: application/mercurial-exp-framing-0004\r\n
98 s> accept: application/mercurial-exp-framing-0005\r\n
99 s> content-type: application/mercurial-exp-framing-0005\r\n
100 100 s> content-length: 96\r\n
101 101 s> host: $LOCALIP:$HGPORT\r\n (glob)
102 102 s> user-agent: Mercurial debugwireproto\r\n
@@ -106,14 +106,14 b' Multiple nodes works'
106 106 s> HTTP/1.1 200 OK\r\n
107 107 s> Server: testing stub value\r\n
108 108 s> Date: $HTTP_DATE$\r\n
109 s> Content-Type: application/mercurial-exp-framing-0004\r\n
109 s> Content-Type: application/mercurial-exp-framing-0005\r\n
110 110 s> Transfer-Encoding: chunked\r\n
111 111 s> \r\n
112 s> c\r\n
113 s> \x04\x00\x00\x01\x00\x02\x012
114 s> C101
112 s> 17\r\n
113 s> \x0f\x00\x00\x01\x00\x02\x012
114 s> \xa1FstatusBokC101
115 115 s> \r\n
116 received frame(size=4; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=eos)
116 received frame(size=15; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=eos)
117 117 s> 0\r\n
118 118 s> \r\n
119 119 response: [True, False, True]
@@ -33,8 +33,8 b' Request for namespaces works'
33 33 sending listkeys command
34 34 s> POST /api/exp-http-v2-0001/ro/listkeys HTTP/1.1\r\n
35 35 s> Accept-Encoding: identity\r\n
36 s> accept: application/mercurial-exp-framing-0004\r\n
37 s> content-type: application/mercurial-exp-framing-0004\r\n
36 s> accept: application/mercurial-exp-framing-0005\r\n
37 s> content-type: application/mercurial-exp-framing-0005\r\n
38 38 s> content-length: 50\r\n
39 39 s> host: $LOCALIP:$HGPORT\r\n (glob)
40 40 s> user-agent: Mercurial debugwireproto\r\n
@@ -44,14 +44,14 b' Request for namespaces works'
44 44 s> HTTP/1.1 200 OK\r\n
45 45 s> Server: testing stub value\r\n
46 46 s> Date: $HTTP_DATE$\r\n
47 s> Content-Type: application/mercurial-exp-framing-0004\r\n
47 s> Content-Type: application/mercurial-exp-framing-0005\r\n
48 48 s> Transfer-Encoding: chunked\r\n
49 49 s> \r\n
50 s> 28\r\n
51 s> \x00\x00\x01\x00\x02\x012
52 s> \xa3Fphases@Ibookmarks@Jnamespaces@
50 s> 33\r\n
51 s> +\x00\x00\x01\x00\x02\x012
52 s> \xa1FstatusBok\xa3Fphases@Ibookmarks@Jnamespaces@
53 53 s> \r\n
54 received frame(size=32; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=eos)
54 received frame(size=43; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=eos)
55 55 s> 0\r\n
56 56 s> \r\n
57 57 response: {b'bookmarks': b'', b'namespaces': b'', b'phases': b''}
@@ -66,8 +66,8 b' Request for phases works'
66 66 sending listkeys command
67 67 s> POST /api/exp-http-v2-0001/ro/listkeys HTTP/1.1\r\n
68 68 s> Accept-Encoding: identity\r\n
69 s> accept: application/mercurial-exp-framing-0004\r\n
70 s> content-type: application/mercurial-exp-framing-0004\r\n
69 s> accept: application/mercurial-exp-framing-0005\r\n
70 s> content-type: application/mercurial-exp-framing-0005\r\n
71 71 s> content-length: 46\r\n
72 72 s> host: $LOCALIP:$HGPORT\r\n (glob)
73 73 s> user-agent: Mercurial debugwireproto\r\n
@@ -77,14 +77,14 b' Request for phases works'
77 77 s> HTTP/1.1 200 OK\r\n
78 78 s> Server: testing stub value\r\n
79 79 s> Date: $HTTP_DATE$\r\n
80 s> Content-Type: application/mercurial-exp-framing-0004\r\n
80 s> Content-Type: application/mercurial-exp-framing-0005\r\n
81 81 s> Transfer-Encoding: chunked\r\n
82 82 s> \r\n
83 s> 45\r\n
84 s> =\x00\x00\x01\x00\x02\x012
85 s> \xa2JpublishingDTrueX(be0ef73c17ade3fc89dc41701eb9fc3a91b58282A1
83 s> 50\r\n
84 s> H\x00\x00\x01\x00\x02\x012
85 s> \xa1FstatusBok\xa2JpublishingDTrueX(be0ef73c17ade3fc89dc41701eb9fc3a91b58282A1
86 86 s> \r\n
87 received frame(size=61; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=eos)
87 received frame(size=72; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=eos)
88 88 s> 0\r\n
89 89 s> \r\n
90 90 response: {b'be0ef73c17ade3fc89dc41701eb9fc3a91b58282': b'1', b'publishing': b'True'}
@@ -99,8 +99,8 b' Request for bookmarks works'
99 99 sending listkeys command
100 100 s> POST /api/exp-http-v2-0001/ro/listkeys HTTP/1.1\r\n
101 101 s> Accept-Encoding: identity\r\n
102 s> accept: application/mercurial-exp-framing-0004\r\n
103 s> content-type: application/mercurial-exp-framing-0004\r\n
102 s> accept: application/mercurial-exp-framing-0005\r\n
103 s> content-type: application/mercurial-exp-framing-0005\r\n
104 104 s> content-length: 49\r\n
105 105 s> host: $LOCALIP:$HGPORT\r\n (glob)
106 106 s> user-agent: Mercurial debugwireproto\r\n
@@ -110,14 +110,14 b' Request for bookmarks works'
110 110 s> HTTP/1.1 200 OK\r\n
111 111 s> Server: testing stub value\r\n
112 112 s> Date: $HTTP_DATE$\r\n
113 s> Content-Type: application/mercurial-exp-framing-0004\r\n
113 s> Content-Type: application/mercurial-exp-framing-0005\r\n
114 114 s> Transfer-Encoding: chunked\r\n
115 115 s> \r\n
116 s> 35\r\n
117 s> -\x00\x00\x01\x00\x02\x012
118 s> \xa1A@X(26805aba1e600a82e93661149f2313866a221a7b
116 s> 40\r\n
117 s> 8\x00\x00\x01\x00\x02\x012
118 s> \xa1FstatusBok\xa1A@X(26805aba1e600a82e93661149f2313866a221a7b
119 119 s> \r\n
120 received frame(size=45; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=eos)
120 received frame(size=56; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=eos)
121 121 s> 0\r\n
122 122 s> \r\n
123 123 response: {b'@': b'26805aba1e600a82e93661149f2313866a221a7b'}
@@ -29,8 +29,8 b' lookup for known node works'
29 29 sending lookup command
30 30 s> *\r\n (glob)
31 31 s> Accept-Encoding: identity\r\n
32 s> accept: application/mercurial-exp-framing-0004\r\n
33 s> content-type: application/mercurial-exp-framing-0004\r\n
32 s> accept: application/mercurial-exp-framing-0005\r\n
33 s> content-type: application/mercurial-exp-framing-0005\r\n
34 34 s> content-length: 73\r\n
35 35 s> host: $LOCALIP:$HGPORT\r\n (glob)
36 36 s> user-agent: Mercurial debugwireproto\r\n
@@ -40,14 +40,14 b' lookup for known node works'
40 40 s> HTTP/1.1 200 OK\r\n
41 41 s> Server: testing stub value\r\n
42 42 s> Date: $HTTP_DATE$\r\n
43 s> Content-Type: application/mercurial-exp-framing-0004\r\n
43 s> Content-Type: application/mercurial-exp-framing-0005\r\n
44 44 s> Transfer-Encoding: chunked\r\n
45 45 s> \r\n
46 s> 1d\r\n
47 s> \x15\x00\x00\x01\x00\x02\x012
48 s> TBk\xad\xa5\xc6u\x98\xcae\x03mW\xd9\xe4\xb6K\x0c\x1c\xe7\xa0
46 s> 28\r\n
47 s> \x00\x00\x01\x00\x02\x012
48 s> \xa1FstatusBokTBk\xad\xa5\xc6u\x98\xcae\x03mW\xd9\xe4\xb6K\x0c\x1c\xe7\xa0
49 49 s> \r\n
50 received frame(size=21; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=eos)
50 received frame(size=32; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=eos)
51 51 s> 0\r\n
52 52 s> \r\n
53 53 response: b'Bk\xad\xa5\xc6u\x98\xcae\x03mW\xd9\xe4\xb6K\x0c\x1c\xe7\xa0'
@@ -32,8 +32,8 b' pushkey for a bookmark works'
32 32 sending pushkey command
33 33 s> *\r\n (glob)
34 34 s> Accept-Encoding: identity\r\n
35 s> accept: application/mercurial-exp-framing-0004\r\n
36 s> content-type: application/mercurial-exp-framing-0004\r\n
35 s> accept: application/mercurial-exp-framing-0005\r\n
36 s> content-type: application/mercurial-exp-framing-0005\r\n
37 37 s> content-length: 105\r\n
38 38 s> host: $LOCALIP:$HGPORT\r\n (glob)
39 39 s> user-agent: Mercurial debugwireproto\r\n
@@ -43,14 +43,14 b' pushkey for a bookmark works'
43 43 s> HTTP/1.1 200 OK\r\n
44 44 s> Server: testing stub value\r\n
45 45 s> Date: $HTTP_DATE$\r\n
46 s> Content-Type: application/mercurial-exp-framing-0004\r\n
46 s> Content-Type: application/mercurial-exp-framing-0005\r\n
47 47 s> Transfer-Encoding: chunked\r\n
48 48 s> \r\n
49 s> 9\r\n
50 s> \x01\x00\x00\x01\x00\x02\x012
51 s> \xf5
49 s> 14\r\n
50 s> \x0c\x00\x00\x01\x00\x02\x012
51 s> \xa1FstatusBok\xf5
52 52 s> \r\n
53 received frame(size=1; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=eos)
53 received frame(size=12; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=eos)
54 54 s> 0\r\n
55 55 s> \r\n
56 56 response: True
@@ -63,8 +63,8 b' pushkey for a bookmark works'
63 63 sending listkeys command
64 64 s> POST /api/exp-http-v2-0001/ro/listkeys HTTP/1.1\r\n
65 65 s> Accept-Encoding: identity\r\n
66 s> accept: application/mercurial-exp-framing-0004\r\n
67 s> content-type: application/mercurial-exp-framing-0004\r\n
66 s> accept: application/mercurial-exp-framing-0005\r\n
67 s> content-type: application/mercurial-exp-framing-0005\r\n
68 68 s> content-length: 49\r\n
69 69 s> host: $LOCALIP:$HGPORT\r\n (glob)
70 70 s> user-agent: Mercurial debugwireproto\r\n
@@ -74,14 +74,14 b' pushkey for a bookmark works'
74 74 s> HTTP/1.1 200 OK\r\n
75 75 s> Server: testing stub value\r\n
76 76 s> Date: $HTTP_DATE$\r\n
77 s> Content-Type: application/mercurial-exp-framing-0004\r\n
77 s> Content-Type: application/mercurial-exp-framing-0005\r\n
78 78 s> Transfer-Encoding: chunked\r\n
79 79 s> \r\n
80 s> 35\r\n
81 s> -\x00\x00\x01\x00\x02\x012
82 s> \xa1A@X(426bada5c67598ca65036d57d9e4b64b0c1ce7a0
80 s> 40\r\n
81 s> 8\x00\x00\x01\x00\x02\x012
82 s> \xa1FstatusBok\xa1A@X(426bada5c67598ca65036d57d9e4b64b0c1ce7a0
83 83 s> \r\n
84 received frame(size=45; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=eos)
84 received frame(size=56; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=eos)
85 85 s> 0\r\n
86 86 s> \r\n
87 87 response: {b'@': b'426bada5c67598ca65036d57d9e4b64b0c1ce7a0'}
@@ -12,6 +12,8 b' from mercurial import ('
12 12
13 13 ffs = framing.makeframefromhumanstring
14 14
15 OK = cbor.dumps({b'status': b'ok'})
16
15 17 def makereactor(deferoutput=False):
16 18 return framing.serverreactor(deferoutput=deferoutput)
17 19
@@ -350,7 +352,7 b' class ServerReactorTests(unittest.TestCa'
350 352 result = reactor.oncommandresponseready(outstream, 1, b'response')
351 353 self.assertaction(result, b'sendframes')
352 354 self.assertframesequal(result[1][b'framegen'], [
353 b'1 2 stream-begin command-response eos response',
355 b'1 2 stream-begin command-response eos %sresponse' % OK,
354 356 ])
355 357
356 358 def testmultiframeresponse(self):
@@ -366,7 +368,8 b' class ServerReactorTests(unittest.TestCa'
366 368 result = reactor.oncommandresponseready(outstream, 1, first + second)
367 369 self.assertaction(result, b'sendframes')
368 370 self.assertframesequal(result[1][b'framegen'], [
369 b'1 2 stream-begin command-response continuation %s' % first,
371 b'1 2 stream-begin command-response continuation %s' % OK,
372 b'1 2 0 command-response continuation %s' % first,
370 373 b'1 2 0 command-response eos %s' % second,
371 374 ])
372 375
@@ -397,7 +400,7 b' class ServerReactorTests(unittest.TestCa'
397 400 result = reactor.oninputeof()
398 401 self.assertaction(result, b'sendframes')
399 402 self.assertframesequal(result[1][b'framegen'], [
400 b'1 2 stream-begin command-response eos response',
403 b'1 2 stream-begin command-response eos %sresponse' % OK,
401 404 ])
402 405
403 406 def testmultiplecommanddeferresponse(self):
@@ -414,8 +417,8 b' class ServerReactorTests(unittest.TestCa'
414 417 result = reactor.oninputeof()
415 418 self.assertaction(result, b'sendframes')
416 419 self.assertframesequal(result[1][b'framegen'], [
417 b'1 2 stream-begin command-response eos response1',
418 b'3 2 0 command-response eos response2'
420 b'1 2 stream-begin command-response eos %sresponse1' % OK,
421 b'3 2 0 command-response eos %sresponse2' % OK,
419 422 ])
420 423
421 424 def testrequestidtracking(self):
@@ -434,9 +437,9 b' class ServerReactorTests(unittest.TestCa'
434 437 result = reactor.oninputeof()
435 438 self.assertaction(result, b'sendframes')
436 439 self.assertframesequal(result[1][b'framegen'], [
437 b'3 2 stream-begin command-response eos response3',
438 b'1 2 0 command-response eos response1',
439 b'5 2 0 command-response eos response5',
440 b'3 2 stream-begin command-response eos %sresponse3' % OK,
441 b'1 2 0 command-response eos %sresponse1' % OK,
442 b'5 2 0 command-response eos %sresponse5' % OK,
440 443 ])
441 444
442 445 def testduplicaterequestonactivecommand(self):
@@ -1,5 +1,5 b''
1 1 HTTPV2=exp-http-v2-0001
2 MEDIATYPE=application/mercurial-exp-framing-0004
2 MEDIATYPE=application/mercurial-exp-framing-0005
3 3
4 4 sendhttpraw() {
5 5 hg --verbose debugwireproto --peer raw http://$LOCALIP:$HGPORT/
General Comments 0
You need to be logged in to leave comments. Login now