changeset 37722:89a16704114c

wireprotov2: define response data as CBOR Previously, response data was defined as a stream of bytes. We had the option to declare it as CBOR using a frame flag. We've converged all wire protocol commands exposed on version 2 to CBOR. I think consistency is important. The overhead to encoding things with CBOR is minimal. Even a very large bytestring can be efficiently encoded using an indefinite length bytestring. Now, there are limitations with consumers not being able to efficiently stream large CBOR values. But these feel like solvable problems. This commit removes the "is CBOR" frame flag from command response frames and defines the frame as always consisting of a stream of CBOR values. The framing protocol media type has been bumped to reflect this BC change. Differential Revision: https://phab.mercurial-scm.org/D3382
author Gregory Szorc <gregory.szorc@gmail.com>
date Sat, 14 Apr 2018 12:07:31 -0700
parents f7673845b167
children e8fba6d578f0
files mercurial/debugcommands.py mercurial/help/internals/wireprotocol.txt mercurial/wireprotoframing.py mercurial/wireprotov2peer.py mercurial/wireprotov2server.py tests/test-http-api-httpv2.t tests/test-http-protocol.t tests/test-wireproto-command-branchmap.t tests/test-wireproto-command-capabilities.t tests/test-wireproto-command-heads.t tests/test-wireproto-command-known.t tests/test-wireproto-command-listkeys.t tests/test-wireproto-command-lookup.t tests/test-wireproto-command-pushkey.t tests/wireprotohelpers.sh
diffstat 15 files changed, 132 insertions(+), 149 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/debugcommands.py	Sat Apr 14 11:49:06 2018 -0700
+++ b/mercurial/debugcommands.py	Sat Apr 14 12:07:31 2018 -0700
@@ -3014,11 +3014,7 @@
                     res = e.callcommand(command, args).result()
 
                 if isinstance(res, wireprotov2peer.commandresponse):
-                    if res.cbor:
-                        val = list(res.cborobjects())
-                    else:
-                        val = [res.b.getvalue()]
-
+                    val = list(res.cborobjects())
                     ui.status(_('response: %s\n') % stringutil.pprint(val))
 
                 else:
--- a/mercurial/help/internals/wireprotocol.txt	Sat Apr 14 11:49:06 2018 -0700
+++ b/mercurial/help/internals/wireprotocol.txt	Sat Apr 14 12:07:31 2018 -0700
@@ -671,7 +671,11 @@
 Response Data (``0x04``)
 ------------------------
 
-This frame contains raw response data to an issued command.
+This frame contains response data to an issued command.
+
+Response data ALWAYS consists of a series of 0 or more CBOR encoded
+values. A CBOR value may be using indefinite length encoding. And the
+bytes constituting the value may span several frames.
 
 The following flag values are defined for this type:
 
@@ -681,8 +685,6 @@
 0x02
    End of data. When set, the response data has been fully sent and
    no additional frames for this response will be sent.
-0x04
-   CBOR data. When set, the frame payload consists of CBOR data.
 
 The ``0x01`` flag is mutually exclusive with the ``0x02`` flag.
 
--- a/mercurial/wireprotoframing.py	Sat Apr 14 11:49:06 2018 -0700
+++ b/mercurial/wireprotoframing.py	Sat Apr 14 12:07:31 2018 -0700
@@ -81,12 +81,10 @@
 
 FLAG_BYTES_RESPONSE_CONTINUATION = 0x01
 FLAG_BYTES_RESPONSE_EOS = 0x02
-FLAG_BYTES_RESPONSE_CBOR = 0x04
 
 FLAGS_BYTES_RESPONSE = {
     b'continuation': FLAG_BYTES_RESPONSE_CONTINUATION,
     b'eos': FLAG_BYTES_RESPONSE_EOS,
-    b'cbor': FLAG_BYTES_RESPONSE_CBOR,
 }
 
 FLAG_ERROR_RESPONSE_PROTOCOL = 0x01
@@ -350,7 +348,7 @@
             if done:
                 break
 
-def createbytesresponseframesfrombytes(stream, requestid, data, iscbor=False,
+def createbytesresponseframesfrombytes(stream, requestid, data,
                                        maxframesize=DEFAULT_MAX_FRAME_SIZE):
     """Create a raw frame to send a bytes response from static bytes input.
 
@@ -360,9 +358,6 @@
     # Simple case of a single frame.
     if len(data) <= maxframesize:
         flags = FLAG_BYTES_RESPONSE_EOS
-        if iscbor:
-            flags |= FLAG_BYTES_RESPONSE_CBOR
-
         yield stream.makeframe(requestid=requestid,
                                typeid=FRAME_TYPE_BYTES_RESPONSE,
                                flags=flags,
@@ -380,9 +375,6 @@
         else:
             flags = FLAG_BYTES_RESPONSE_CONTINUATION
 
-        if iscbor:
-            flags |= FLAG_BYTES_RESPONSE_CBOR
-
         yield stream.makeframe(requestid=requestid,
                                typeid=FRAME_TYPE_BYTES_RESPONSE,
                                flags=flags,
@@ -616,7 +608,7 @@
 
         return meth(frame)
 
-    def onbytesresponseready(self, stream, requestid, data, iscbor=False):
+    def onbytesresponseready(self, stream, requestid, data):
         """Signal that a bytes response is ready to be sent to the client.
 
         The raw bytes response is passed as an argument.
@@ -625,8 +617,7 @@
 
         def sendframes():
             for frame in createbytesresponseframesfrombytes(stream, requestid,
-                                                            data,
-                                                            iscbor=iscbor):
+                                                            data):
                 yield frame
 
             self._activecommands.remove(requestid)
@@ -1067,6 +1058,5 @@
             'request': request,
             'expectmore': frame.flags & FLAG_BYTES_RESPONSE_CONTINUATION,
             'eos': frame.flags & FLAG_BYTES_RESPONSE_EOS,
-            'cbor': frame.flags & FLAG_BYTES_RESPONSE_CBOR,
             'data': frame.payload,
         }
--- a/mercurial/wireprotov2peer.py	Sat Apr 14 11:49:06 2018 -0700
+++ b/mercurial/wireprotov2peer.py	Sat Apr 14 12:07:31 2018 -0700
@@ -25,7 +25,6 @@
         self.requestid = requestid
         self.command = command
 
-        self.cbor = False
         self.b = util.bytesio()
 
     def cborobjects(self):
@@ -124,9 +123,6 @@
         if action == 'responsedata':
             response.b.write(meta['data'])
 
-            if meta['cbor']:
-                response.cbor = True
-
             if meta['eos']:
                 # If the command has a decoder, resolve the future to the
                 # decoded value. Otherwise resolve to the rich response object.
--- a/mercurial/wireprotov2server.py	Sat Apr 14 11:49:06 2018 -0700
+++ b/mercurial/wireprotov2server.py	Sat Apr 14 12:07:31 2018 -0700
@@ -26,7 +26,7 @@
     wireprototypes,
 )
 
-FRAMINGTYPE = b'application/mercurial-exp-framing-0003'
+FRAMINGTYPE = b'application/mercurial-exp-framing-0004'
 
 HTTP_WIREPROTO_V2 = wireprototypes.HTTP_WIREPROTO_V2
 
@@ -309,8 +309,7 @@
         encoded = cbor.dumps(rsp.value, canonical=True)
         action, meta = reactor.onbytesresponseready(outstream,
                                                     command['requestid'],
-                                                    encoded,
-                                                    iscbor=True)
+                                                    encoded)
     else:
         action, meta = reactor.onapplicationerror(
             _('unhandled response type from wire proto command'))
--- a/tests/test-http-api-httpv2.t	Sat Apr 14 11:49:06 2018 -0700
+++ b/tests/test-http-api-httpv2.t	Sat Apr 14 12:07:31 2018 -0700
@@ -98,7 +98,7 @@
   s>     Content-Type: text/plain\r\n
   s>     Content-Length: 85\r\n
   s>     \r\n
-  s>     client MUST specify Accept header with value: application/mercurial-exp-framing-0003\n
+  s>     client MUST specify Accept header with value: application/mercurial-exp-framing-0004\n
 
 Bad Accept header results in 406
 
@@ -121,7 +121,7 @@
   s>     Content-Type: text/plain\r\n
   s>     Content-Length: 85\r\n
   s>     \r\n
-  s>     client MUST specify Accept header with value: application/mercurial-exp-framing-0003\n
+  s>     client MUST specify Accept header with value: application/mercurial-exp-framing-0004\n
 
 Bad Content-Type header results in 415
 
@@ -134,7 +134,7 @@
   using raw connection to peer
   s>     POST /api/exp-http-v2-0001/ro/customreadonly HTTP/1.1\r\n
   s>     Accept-Encoding: identity\r\n
-  s>     accept: application/mercurial-exp-framing-0003\r\n
+  s>     accept: application/mercurial-exp-framing-0004\r\n
   s>     content-type: badmedia\r\n
   s>     user-agent: test\r\n
   s>     host: $LOCALIP:$HGPORT\r\n (glob)
@@ -146,7 +146,7 @@
   s>     Content-Type: text/plain\r\n
   s>     Content-Length: 88\r\n
   s>     \r\n
-  s>     client MUST send Content-Type header with value: application/mercurial-exp-framing-0003\n
+  s>     client MUST send Content-Type header with value: application/mercurial-exp-framing-0004\n
 
 Request to read-only command works out of the box
 
@@ -161,7 +161,7 @@
   s>     POST /api/exp-http-v2-0001/ro/customreadonly HTTP/1.1\r\n
   s>     Accept-Encoding: identity\r\n
   s>     *\r\n (glob)
-  s>     content-type: application/mercurial-exp-framing-0003\r\n
+  s>     content-type: application/mercurial-exp-framing-0004\r\n
   s>     user-agent: test\r\n
   s>     content-length: 29\r\n
   s>     host: $LOCALIP:$HGPORT\r\n (glob)
@@ -171,11 +171,11 @@
   s>     HTTP/1.1 200 OK\r\n
   s>     Server: testing stub value\r\n
   s>     Date: $HTTP_DATE$\r\n
-  s>     Content-Type: application/mercurial-exp-framing-0003\r\n
+  s>     Content-Type: application/mercurial-exp-framing-0004\r\n
   s>     Transfer-Encoding: chunked\r\n
   s>     \r\n
-  s>     25\r\n
-  s>     \x1d\x00\x00\x01\x00\x02\x01Bcustomreadonly bytes response
+  s>     27\r\n
+  s>     \x1f\x00\x00\x01\x00\x02\x01BX\x1dcustomreadonly bytes response
   s>     \r\n
   s>     0\r\n
   s>     \r\n
@@ -187,8 +187,8 @@
   sending customreadonly command
   s>     POST /api/exp-http-v2-0001/ro/customreadonly HTTP/1.1\r\n
   s>     Accept-Encoding: identity\r\n
-  s>     accept: application/mercurial-exp-framing-0003\r\n
-  s>     content-type: application/mercurial-exp-framing-0003\r\n
+  s>     accept: application/mercurial-exp-framing-0004\r\n
+  s>     content-type: application/mercurial-exp-framing-0004\r\n
   s>     content-length: 29\r\n
   s>     host: $LOCALIP:$HGPORT\r\n (glob)
   s>     user-agent: Mercurial debugwireproto\r\n
@@ -198,14 +198,14 @@
   s>     HTTP/1.1 200 OK\r\n
   s>     Server: testing stub value\r\n
   s>     Date: $HTTP_DATE$\r\n
-  s>     Content-Type: application/mercurial-exp-framing-0003\r\n
+  s>     Content-Type: application/mercurial-exp-framing-0004\r\n
   s>     Transfer-Encoding: chunked\r\n
   s>     \r\n
-  s>     25\r\n
-  s>     \x1d\x00\x00\x01\x00\x02\x01B
-  s>     customreadonly bytes response
+  s>     27\r\n
+  s>     \x1f\x00\x00\x01\x00\x02\x01B
+  s>     X\x1dcustomreadonly bytes response
   s>     \r\n
-  received frame(size=29; request=1; stream=2; streamflags=stream-begin; type=bytes-response; flags=eos)
+  received frame(size=31; request=1; stream=2; streamflags=stream-begin; type=bytes-response; flags=eos)
   s>     0\r\n
   s>     \r\n
   response: [b'customreadonly bytes response']
@@ -301,8 +301,8 @@
   using raw connection to peer
   s>     POST /api/exp-http-v2-0001/rw/customreadonly HTTP/1.1\r\n
   s>     Accept-Encoding: identity\r\n
-  s>     accept: application/mercurial-exp-framing-0003\r\n
-  s>     content-type: application/mercurial-exp-framing-0003\r\n
+  s>     accept: application/mercurial-exp-framing-0004\r\n
+  s>     content-type: application/mercurial-exp-framing-0004\r\n
   s>     user-agent: test\r\n
   s>     content-length: 29\r\n
   s>     host: $LOCALIP:$HGPORT\r\n (glob)
@@ -312,11 +312,11 @@
   s>     HTTP/1.1 200 OK\r\n
   s>     Server: testing stub value\r\n
   s>     Date: $HTTP_DATE$\r\n
-  s>     Content-Type: application/mercurial-exp-framing-0003\r\n
+  s>     Content-Type: application/mercurial-exp-framing-0004\r\n
   s>     Transfer-Encoding: chunked\r\n
   s>     \r\n
-  s>     25\r\n
-  s>     \x1d\x00\x00\x01\x00\x02\x01Bcustomreadonly bytes response
+  s>     27\r\n
+  s>     \x1f\x00\x00\x01\x00\x02\x01BX\x1dcustomreadonly bytes response
   s>     \r\n
   s>     0\r\n
   s>     \r\n
@@ -331,7 +331,7 @@
   using raw connection to peer
   s>     POST /api/exp-http-v2-0001/rw/badcommand HTTP/1.1\r\n
   s>     Accept-Encoding: identity\r\n
-  s>     accept: application/mercurial-exp-framing-0003\r\n
+  s>     accept: application/mercurial-exp-framing-0004\r\n
   s>     user-agent: test\r\n
   s>     host: $LOCALIP:$HGPORT\r\n (glob)
   s>     \r\n
@@ -393,8 +393,8 @@
   using raw connection to peer
   s>     POST /api/exp-http-v2-0001/ro/debugreflect HTTP/1.1\r\n
   s>     Accept-Encoding: identity\r\n
-  s>     accept: application/mercurial-exp-framing-0003\r\n
-  s>     content-type: application/mercurial-exp-framing-0003\r\n
+  s>     accept: application/mercurial-exp-framing-0004\r\n
+  s>     content-type: application/mercurial-exp-framing-0004\r\n
   s>     user-agent: test\r\n
   s>     content-length: 47\r\n
   s>     host: $LOCALIP:$HGPORT\r\n (glob)
@@ -424,8 +424,8 @@
   using raw connection to peer
   s>     POST /api/exp-http-v2-0001/ro/customreadonly HTTP/1.1\r\n
   s>     Accept-Encoding: identity\r\n
-  s>     accept: application/mercurial-exp-framing-0003\r\n
-  s>     content-type: application/mercurial-exp-framing-0003\r\n
+  s>     accept: application/mercurial-exp-framing-0004\r\n
+  s>     content-type: application/mercurial-exp-framing-0004\r\n
   s>     user-agent: test\r\n
   s>     content-length: 29\r\n
   s>     host: $LOCALIP:$HGPORT\r\n (glob)
@@ -435,11 +435,11 @@
   s>     HTTP/1.1 200 OK\r\n
   s>     Server: testing stub value\r\n
   s>     Date: $HTTP_DATE$\r\n
-  s>     Content-Type: application/mercurial-exp-framing-0003\r\n
+  s>     Content-Type: application/mercurial-exp-framing-0004\r\n
   s>     Transfer-Encoding: chunked\r\n
   s>     \r\n
-  s>     25\r\n
-  s>     \x1d\x00\x00\x01\x00\x02\x01Bcustomreadonly bytes response
+  s>     27\r\n
+  s>     \x1f\x00\x00\x01\x00\x02\x01BX\x1dcustomreadonly bytes response
   s>     \r\n
   s>     0\r\n
   s>     \r\n
@@ -468,14 +468,14 @@
   s>     HTTP/1.1 200 OK\r\n
   s>     Server: testing stub value\r\n
   s>     Date: $HTTP_DATE$\r\n
-  s>     Content-Type: application/mercurial-exp-framing-0003\r\n
+  s>     Content-Type: application/mercurial-exp-framing-0004\r\n
   s>     Transfer-Encoding: chunked\r\n
   s>     \r\n
-  s>     25\r\n
-  s>     \x1d\x00\x00\x01\x00\x02\x01Bcustomreadonly bytes response
+  s>     27\r\n
+  s>     \x1f\x00\x00\x01\x00\x02\x01BX\x1dcustomreadonly bytes response
   s>     \r\n
-  s>     25\r\n
-  s>     \x1d\x00\x00\x03\x00\x02\x00Bcustomreadonly bytes response
+  s>     27\r\n
+  s>     \x1f\x00\x00\x03\x00\x02\x00BX\x1dcustomreadonly bytes response
   s>     \r\n
   s>     0\r\n
   s>     \r\n
@@ -495,8 +495,8 @@
   using raw connection to peer
   s>     POST /api/exp-http-v2-0001/ro/multirequest HTTP/1.1\r\n
   s>     Accept-Encoding: identity\r\n
-  s>     accept: application/mercurial-exp-framing-0003\r\n
-  s>     content-type: application/mercurial-exp-framing-0003\r\n
+  s>     accept: application/mercurial-exp-framing-0004\r\n
+  s>     content-type: application/mercurial-exp-framing-0004\r\n
   s>     user-agent: test\r\n
   s>     content-length: 115\r\n
   s>     host: $LOCALIP:$HGPORT\r\n (glob)
@@ -506,14 +506,14 @@
   s>     HTTP/1.1 200 OK\r\n
   s>     Server: testing stub value\r\n
   s>     Date: $HTTP_DATE$\r\n
-  s>     Content-Type: application/mercurial-exp-framing-0003\r\n
+  s>     Content-Type: application/mercurial-exp-framing-0004\r\n
   s>     Transfer-Encoding: chunked\r\n
   s>     \r\n
   s>     28\r\n
-  s>      \x00\x00\x03\x00\x02\x01F\xa3Fphases@Ibookmarks@Jnamespaces@
+  s>      \x00\x00\x03\x00\x02\x01B\xa3Fphases@Ibookmarks@Jnamespaces@
   s>     \r\n
   s>     9\r\n
-  s>     \x01\x00\x00\x01\x00\x02\x00F\xa0
+  s>     \x01\x00\x00\x01\x00\x02\x00B\xa0
   s>     \r\n
   s>     0\r\n
   s>     \r\n
@@ -545,8 +545,8 @@
   using raw connection to peer
   s>     POST /api/exp-http-v2-0001/ro/multirequest HTTP/1.1\r\n
   s>     Accept-Encoding: identity\r\n
-  s>     accept: application/mercurial-exp-framing-0003\r\n
-  s>     content-type: application/mercurial-exp-framing-0003\r\n
+  s>     accept: application/mercurial-exp-framing-0004\r\n
+  s>     content-type: application/mercurial-exp-framing-0004\r\n
   s>     user-agent: test\r\n
   s>     content-length: 22\r\n
   s>     host: $LOCALIP:$HGPORT\r\n (glob)
--- a/tests/test-http-protocol.t	Sat Apr 14 11:49:06 2018 -0700
+++ b/tests/test-http-protocol.t	Sat Apr 14 12:07:31 2018 -0700
@@ -305,12 +305,12 @@
   s>     Content-Type: application/mercurial-cbor\r\n
   s>     Content-Length: *\r\n (glob)
   s>     \r\n
-  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-0003GapibaseDapi/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
+  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
   sending heads command
   s>     POST /api/exp-http-v2-0001/ro/heads HTTP/1.1\r\n
   s>     Accept-Encoding: identity\r\n
-  s>     accept: application/mercurial-exp-framing-0003\r\n
-  s>     content-type: application/mercurial-exp-framing-0003\r\n
+  s>     accept: application/mercurial-exp-framing-0004\r\n
+  s>     content-type: application/mercurial-exp-framing-0004\r\n
   s>     content-length: 20\r\n
   s>     host: $LOCALIP:$HGPORT\r\n (glob)
   s>     user-agent: Mercurial debugwireproto\r\n
@@ -320,16 +320,16 @@
   s>     HTTP/1.1 200 OK\r\n
   s>     Server: testing stub value\r\n
   s>     Date: $HTTP_DATE$\r\n
-  s>     Content-Type: application/mercurial-exp-framing-0003\r\n
+  s>     Content-Type: application/mercurial-exp-framing-0004\r\n
   s>     Transfer-Encoding: chunked\r\n
   s>     \r\n
   s>     1e\r\n
-  s>     \x16\x00\x00\x01\x00\x02\x01F
+  s>     \x16\x00\x00\x01\x00\x02\x01B
   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=stream-begin; type=bytes-response; flags=eos|cbor)
+  received frame(size=22; request=1; stream=2; streamflags=stream-begin; type=bytes-response; flags=eos)
   s>     0\r\n
   s>     \r\n
-  response: [[b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00']]
+  response: [b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00']
 
   $ killdaemons.py
--- a/tests/test-wireproto-command-branchmap.t	Sat Apr 14 11:49:06 2018 -0700
+++ b/tests/test-wireproto-command-branchmap.t	Sat Apr 14 12:07:31 2018 -0700
@@ -45,8 +45,8 @@
   sending branchmap command
   s>     POST /api/exp-http-v2-0001/ro/branchmap HTTP/1.1\r\n
   s>     Accept-Encoding: identity\r\n
-  s>     accept: application/mercurial-exp-framing-0003\r\n
-  s>     content-type: application/mercurial-exp-framing-0003\r\n
+  s>     accept: application/mercurial-exp-framing-0004\r\n
+  s>     content-type: application/mercurial-exp-framing-0004\r\n
   s>     content-length: 24\r\n
   s>     host: $LOCALIP:$HGPORT\r\n (glob)
   s>     user-agent: Mercurial debugwireproto\r\n
@@ -56,15 +56,15 @@
   s>     HTTP/1.1 200 OK\r\n
   s>     Server: testing stub value\r\n
   s>     Date: $HTTP_DATE$\r\n
-  s>     Content-Type: application/mercurial-exp-framing-0003\r\n
+  s>     Content-Type: application/mercurial-exp-framing-0004\r\n
   s>     Transfer-Encoding: chunked\r\n
   s>     \r\n
   s>     78\r\n
-  s>     p\x00\x00\x01\x00\x02\x01F
+  s>     p\x00\x00\x01\x00\x02\x01B
   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
   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
   s>     \r\n
-  received frame(size=112; request=1; stream=2; streamflags=stream-begin; type=bytes-response; flags=eos|cbor)
+  received frame(size=112; request=1; stream=2; streamflags=stream-begin; type=bytes-response; flags=eos)
   s>     0\r\n
   s>     \r\n
   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']}
--- a/tests/test-wireproto-command-capabilities.t	Sat Apr 14 11:49:06 2018 -0700
+++ b/tests/test-wireproto-command-capabilities.t	Sat Apr 14 12:07:31 2018 -0700
@@ -192,8 +192,8 @@
   s>     Content-Type: application/mercurial-cbor\r\n
   s>     Content-Length: *\r\n (glob)
   s>     \r\n
-  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-0003GapibaseDapi/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
-  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-0003'], 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'}
+  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
+  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'}
 
 capabilities command returns expected info
 
@@ -217,12 +217,12 @@
   s>     Content-Type: application/mercurial-cbor\r\n
   s>     Content-Length: *\r\n (glob)
   s>     \r\n
-  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-0003GapibaseDapi/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
+  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
   sending capabilities command
   s>     POST /api/exp-http-v2-0001/ro/capabilities HTTP/1.1\r\n
   s>     Accept-Encoding: identity\r\n
-  s>     accept: application/mercurial-exp-framing-0003\r\n
-  s>     content-type: application/mercurial-exp-framing-0003\r\n
+  s>     *\r\n (glob)
+  s>     content-type: application/mercurial-exp-framing-0004\r\n
   s>     content-length: 27\r\n
   s>     host: $LOCALIP:$HGPORT\r\n (glob)
   s>     user-agent: Mercurial debugwireproto\r\n
@@ -232,16 +232,16 @@
   s>     HTTP/1.1 200 OK\r\n
   s>     Server: testing stub value\r\n
   s>     Date: $HTTP_DATE$\r\n
-  s>     Content-Type: application/mercurial-exp-framing-0003\r\n
+  s>     Content-Type: application/mercurial-exp-framing-0004\r\n
   s>     Transfer-Encoding: chunked\r\n
   s>     \r\n
-  s>     *\r\n (glob)
-  s>     *\x00\x01\x00\x02\x01F (glob)
-  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-0003
+  s>     1d7\r\n
+  s>     \xcf\x01\x00\x01\x00\x02\x01B
+  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
   s>     \r\n
-  received frame(size=*; request=1; stream=2; streamflags=stream-begin; type=bytes-response; flags=eos|cbor) (glob)
+  received frame(size=463; request=1; stream=2; streamflags=stream-begin; type=bytes-response; flags=eos)
   s>     0\r\n
   s>     \r\n
-  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-0003'], b'rawrepoformats': [b'generaldelta', b'revlogv1']}]
+  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']}]
 
   $ cat error.log
--- a/tests/test-wireproto-command-heads.t	Sat Apr 14 11:49:06 2018 -0700
+++ b/tests/test-wireproto-command-heads.t	Sat Apr 14 12:07:31 2018 -0700
@@ -37,8 +37,8 @@
   sending heads command
   s>     POST /api/exp-http-v2-0001/ro/heads HTTP/1.1\r\n
   s>     Accept-Encoding: identity\r\n
-  s>     accept: application/mercurial-exp-framing-0003\r\n
-  s>     content-type: application/mercurial-exp-framing-0003\r\n
+  s>     accept: application/mercurial-exp-framing-0004\r\n
+  s>     content-type: application/mercurial-exp-framing-0004\r\n
   s>     content-length: 20\r\n
   s>     host: $LOCALIP:$HGPORT\r\n (glob)
   s>     user-agent: Mercurial debugwireproto\r\n
@@ -48,14 +48,14 @@
   s>     HTTP/1.1 200 OK\r\n
   s>     Server: testing stub value\r\n
   s>     Date: $HTTP_DATE$\r\n
-  s>     Content-Type: application/mercurial-exp-framing-0003\r\n
+  s>     Content-Type: application/mercurial-exp-framing-0004\r\n
   s>     Transfer-Encoding: chunked\r\n
   s>     \r\n
   s>     48\r\n
-  s>     @\x00\x00\x01\x00\x02\x01F
+  s>     @\x00\x00\x01\x00\x02\x01B
   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
   s>     \r\n
-  received frame(size=64; request=1; stream=2; streamflags=stream-begin; type=bytes-response; flags=eos|cbor)
+  received frame(size=64; request=1; stream=2; streamflags=stream-begin; type=bytes-response; flags=eos)
   s>     0\r\n
   s>     \r\n
   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 @@
   sending heads command
   s>     POST /api/exp-http-v2-0001/ro/heads HTTP/1.1\r\n
   s>     Accept-Encoding: identity\r\n
-  s>     accept: application/mercurial-exp-framing-0003\r\n
-  s>     content-type: application/mercurial-exp-framing-0003\r\n
+  s>     accept: application/mercurial-exp-framing-0004\r\n
+  s>     content-type: application/mercurial-exp-framing-0004\r\n
   s>     content-length: 39\r\n
   s>     host: $LOCALIP:$HGPORT\r\n (glob)
   s>     user-agent: Mercurial debugwireproto\r\n
@@ -81,14 +81,14 @@
   s>     HTTP/1.1 200 OK\r\n
   s>     Server: testing stub value\r\n
   s>     Date: $HTTP_DATE$\r\n
-  s>     Content-Type: application/mercurial-exp-framing-0003\r\n
+  s>     Content-Type: application/mercurial-exp-framing-0004\r\n
   s>     Transfer-Encoding: chunked\r\n
   s>     \r\n
   s>     1e\r\n
-  s>     \x16\x00\x00\x01\x00\x02\x01F
+  s>     \x16\x00\x00\x01\x00\x02\x01B
   s>     \x81Tx\xd2\xdc\xa46\xb2\xf5\xb1\x88\xac&~)\xb8\x1e\x07&m8\xfc
   s>     \r\n
-  received frame(size=22; request=1; stream=2; streamflags=stream-begin; type=bytes-response; flags=eos|cbor)
+  received frame(size=22; request=1; stream=2; streamflags=stream-begin; type=bytes-response; flags=eos)
   s>     0\r\n
   s>     \r\n
   response: [b'x\xd2\xdc\xa46\xb2\xf5\xb1\x88\xac&~)\xb8\x1e\x07&m8\xfc']
--- a/tests/test-wireproto-command-known.t	Sat Apr 14 11:49:06 2018 -0700
+++ b/tests/test-wireproto-command-known.t	Sat Apr 14 12:07:31 2018 -0700
@@ -29,8 +29,8 @@
   sending known command
   s>     POST /api/exp-http-v2-0001/ro/known HTTP/1.1\r\n
   s>     Accept-Encoding: identity\r\n
-  s>     accept: application/mercurial-exp-framing-0003\r\n
-  s>     content-type: application/mercurial-exp-framing-0003\r\n
+  s>     accept: application/mercurial-exp-framing-0004\r\n
+  s>     content-type: application/mercurial-exp-framing-0004\r\n
   s>     content-length: 20\r\n
   s>     host: $LOCALIP:$HGPORT\r\n (glob)
   s>     user-agent: Mercurial debugwireproto\r\n
@@ -40,14 +40,14 @@
   s>     HTTP/1.1 200 OK\r\n
   s>     Server: testing stub value\r\n
   s>     Date: $HTTP_DATE$\r\n
-  s>     Content-Type: application/mercurial-exp-framing-0003\r\n
+  s>     Content-Type: application/mercurial-exp-framing-0004\r\n
   s>     Transfer-Encoding: chunked\r\n
   s>     \r\n
   s>     9\r\n
-  s>     \x01\x00\x00\x01\x00\x02\x01F
+  s>     \x01\x00\x00\x01\x00\x02\x01B
   s>     @
   s>     \r\n
-  received frame(size=1; request=1; stream=2; streamflags=stream-begin; type=bytes-response; flags=eos|cbor)
+  received frame(size=1; request=1; stream=2; streamflags=stream-begin; type=bytes-response; flags=eos)
   s>     0\r\n
   s>     \r\n
   response: []
@@ -62,8 +62,8 @@
   sending known command
   s>     POST /api/exp-http-v2-0001/ro/known HTTP/1.1\r\n
   s>     Accept-Encoding: identity\r\n
-  s>     accept: application/mercurial-exp-framing-0003\r\n
-  s>     content-type: application/mercurial-exp-framing-0003\r\n
+  s>     accept: application/mercurial-exp-framing-0004\r\n
+  s>     content-type: application/mercurial-exp-framing-0004\r\n
   s>     content-length: 54\r\n
   s>     host: $LOCALIP:$HGPORT\r\n (glob)
   s>     user-agent: Mercurial debugwireproto\r\n
@@ -73,14 +73,14 @@
   s>     HTTP/1.1 200 OK\r\n
   s>     Server: testing stub value\r\n
   s>     Date: $HTTP_DATE$\r\n
-  s>     Content-Type: application/mercurial-exp-framing-0003\r\n
+  s>     Content-Type: application/mercurial-exp-framing-0004\r\n
   s>     Transfer-Encoding: chunked\r\n
   s>     \r\n
   s>     a\r\n
-  s>     \x02\x00\x00\x01\x00\x02\x01F
+  s>     \x02\x00\x00\x01\x00\x02\x01B
   s>     A1
   s>     \r\n
-  received frame(size=2; request=1; stream=2; streamflags=stream-begin; type=bytes-response; flags=eos|cbor)
+  received frame(size=2; request=1; stream=2; streamflags=stream-begin; type=bytes-response; flags=eos)
   s>     0\r\n
   s>     \r\n
   response: [True]
@@ -95,8 +95,8 @@
   sending known command
   s>     POST /api/exp-http-v2-0001/ro/known HTTP/1.1\r\n
   s>     Accept-Encoding: identity\r\n
-  s>     accept: application/mercurial-exp-framing-0003\r\n
-  s>     content-type: application/mercurial-exp-framing-0003\r\n
+  s>     accept: application/mercurial-exp-framing-0004\r\n
+  s>     content-type: application/mercurial-exp-framing-0004\r\n
   s>     content-length: 96\r\n
   s>     host: $LOCALIP:$HGPORT\r\n (glob)
   s>     user-agent: Mercurial debugwireproto\r\n
@@ -106,14 +106,14 @@
   s>     HTTP/1.1 200 OK\r\n
   s>     Server: testing stub value\r\n
   s>     Date: $HTTP_DATE$\r\n
-  s>     Content-Type: application/mercurial-exp-framing-0003\r\n
+  s>     Content-Type: application/mercurial-exp-framing-0004\r\n
   s>     Transfer-Encoding: chunked\r\n
   s>     \r\n
   s>     c\r\n
-  s>     \x04\x00\x00\x01\x00\x02\x01F
+  s>     \x04\x00\x00\x01\x00\x02\x01B
   s>     C101
   s>     \r\n
-  received frame(size=4; request=1; stream=2; streamflags=stream-begin; type=bytes-response; flags=eos|cbor)
+  received frame(size=4; request=1; stream=2; streamflags=stream-begin; type=bytes-response; flags=eos)
   s>     0\r\n
   s>     \r\n
   response: [True, False, True]
--- a/tests/test-wireproto-command-listkeys.t	Sat Apr 14 11:49:06 2018 -0700
+++ b/tests/test-wireproto-command-listkeys.t	Sat Apr 14 12:07:31 2018 -0700
@@ -33,8 +33,8 @@
   sending listkeys command
   s>     POST /api/exp-http-v2-0001/ro/listkeys HTTP/1.1\r\n
   s>     Accept-Encoding: identity\r\n
-  s>     accept: application/mercurial-exp-framing-0003\r\n
-  s>     content-type: application/mercurial-exp-framing-0003\r\n
+  s>     accept: application/mercurial-exp-framing-0004\r\n
+  s>     content-type: application/mercurial-exp-framing-0004\r\n
   s>     content-length: 50\r\n
   s>     host: $LOCALIP:$HGPORT\r\n (glob)
   s>     user-agent: Mercurial debugwireproto\r\n
@@ -44,14 +44,14 @@
   s>     HTTP/1.1 200 OK\r\n
   s>     Server: testing stub value\r\n
   s>     Date: $HTTP_DATE$\r\n
-  s>     Content-Type: application/mercurial-exp-framing-0003\r\n
+  s>     Content-Type: application/mercurial-exp-framing-0004\r\n
   s>     Transfer-Encoding: chunked\r\n
   s>     \r\n
   s>     28\r\n
-  s>      \x00\x00\x01\x00\x02\x01F
+  s>      \x00\x00\x01\x00\x02\x01B
   s>     \xa3Fphases@Ibookmarks@Jnamespaces@
   s>     \r\n
-  received frame(size=32; request=1; stream=2; streamflags=stream-begin; type=bytes-response; flags=eos|cbor)
+  received frame(size=32; request=1; stream=2; streamflags=stream-begin; type=bytes-response; flags=eos)
   s>     0\r\n
   s>     \r\n
   response: {b'bookmarks': b'', b'namespaces': b'', b'phases': b''}
@@ -66,8 +66,8 @@
   sending listkeys command
   s>     POST /api/exp-http-v2-0001/ro/listkeys HTTP/1.1\r\n
   s>     Accept-Encoding: identity\r\n
-  s>     accept: application/mercurial-exp-framing-0003\r\n
-  s>     content-type: application/mercurial-exp-framing-0003\r\n
+  s>     accept: application/mercurial-exp-framing-0004\r\n
+  s>     content-type: application/mercurial-exp-framing-0004\r\n
   s>     content-length: 46\r\n
   s>     host: $LOCALIP:$HGPORT\r\n (glob)
   s>     user-agent: Mercurial debugwireproto\r\n
@@ -77,14 +77,14 @@
   s>     HTTP/1.1 200 OK\r\n
   s>     Server: testing stub value\r\n
   s>     Date: $HTTP_DATE$\r\n
-  s>     Content-Type: application/mercurial-exp-framing-0003\r\n
+  s>     Content-Type: application/mercurial-exp-framing-0004\r\n
   s>     Transfer-Encoding: chunked\r\n
   s>     \r\n
   s>     45\r\n
-  s>     =\x00\x00\x01\x00\x02\x01F
+  s>     =\x00\x00\x01\x00\x02\x01B
   s>     \xa2JpublishingDTrueX(be0ef73c17ade3fc89dc41701eb9fc3a91b58282A1
   s>     \r\n
-  received frame(size=61; request=1; stream=2; streamflags=stream-begin; type=bytes-response; flags=eos|cbor)
+  received frame(size=61; request=1; stream=2; streamflags=stream-begin; type=bytes-response; flags=eos)
   s>     0\r\n
   s>     \r\n
   response: {b'be0ef73c17ade3fc89dc41701eb9fc3a91b58282': b'1', b'publishing': b'True'}
@@ -99,8 +99,8 @@
   sending listkeys command
   s>     POST /api/exp-http-v2-0001/ro/listkeys HTTP/1.1\r\n
   s>     Accept-Encoding: identity\r\n
-  s>     accept: application/mercurial-exp-framing-0003\r\n
-  s>     content-type: application/mercurial-exp-framing-0003\r\n
+  s>     accept: application/mercurial-exp-framing-0004\r\n
+  s>     content-type: application/mercurial-exp-framing-0004\r\n
   s>     content-length: 49\r\n
   s>     host: $LOCALIP:$HGPORT\r\n (glob)
   s>     user-agent: Mercurial debugwireproto\r\n
@@ -110,14 +110,14 @@
   s>     HTTP/1.1 200 OK\r\n
   s>     Server: testing stub value\r\n
   s>     Date: $HTTP_DATE$\r\n
-  s>     Content-Type: application/mercurial-exp-framing-0003\r\n
+  s>     Content-Type: application/mercurial-exp-framing-0004\r\n
   s>     Transfer-Encoding: chunked\r\n
   s>     \r\n
   s>     35\r\n
-  s>     -\x00\x00\x01\x00\x02\x01F
+  s>     -\x00\x00\x01\x00\x02\x01B
   s>     \xa1A@X(26805aba1e600a82e93661149f2313866a221a7b
   s>     \r\n
-  received frame(size=45; request=1; stream=2; streamflags=stream-begin; type=bytes-response; flags=eos|cbor)
+  received frame(size=45; request=1; stream=2; streamflags=stream-begin; type=bytes-response; flags=eos)
   s>     0\r\n
   s>     \r\n
   response: {b'@': b'26805aba1e600a82e93661149f2313866a221a7b'}
--- a/tests/test-wireproto-command-lookup.t	Sat Apr 14 11:49:06 2018 -0700
+++ b/tests/test-wireproto-command-lookup.t	Sat Apr 14 12:07:31 2018 -0700
@@ -29,8 +29,8 @@
   sending lookup command
   s>     *\r\n (glob)
   s>     Accept-Encoding: identity\r\n
-  s>     accept: application/mercurial-exp-framing-0003\r\n
-  s>     content-type: application/mercurial-exp-framing-0003\r\n
+  s>     accept: application/mercurial-exp-framing-0004\r\n
+  s>     content-type: application/mercurial-exp-framing-0004\r\n
   s>     content-length: 73\r\n
   s>     host: $LOCALIP:$HGPORT\r\n (glob)
   s>     user-agent: Mercurial debugwireproto\r\n
@@ -40,14 +40,14 @@
   s>     HTTP/1.1 200 OK\r\n
   s>     Server: testing stub value\r\n
   s>     Date: $HTTP_DATE$\r\n
-  s>     Content-Type: application/mercurial-exp-framing-0003\r\n
+  s>     Content-Type: application/mercurial-exp-framing-0004\r\n
   s>     Transfer-Encoding: chunked\r\n
   s>     \r\n
   s>     1d\r\n
-  s>     *\x00\x01\x00\x02\x01F (glob)
+  s>     \x15\x00\x00\x01\x00\x02\x01B
   s>     TBk\xad\xa5\xc6u\x98\xcae\x03mW\xd9\xe4\xb6K\x0c\x1c\xe7\xa0
   s>     \r\n
-  received frame(size=*; request=1; stream=2; streamflags=stream-begin; type=bytes-response; flags=eos|cbor) (glob)
+  received frame(size=21; request=1; stream=2; streamflags=stream-begin; type=bytes-response; flags=eos)
   s>     0\r\n
   s>     \r\n
   response: b'Bk\xad\xa5\xc6u\x98\xcae\x03mW\xd9\xe4\xb6K\x0c\x1c\xe7\xa0'
--- a/tests/test-wireproto-command-pushkey.t	Sat Apr 14 11:49:06 2018 -0700
+++ b/tests/test-wireproto-command-pushkey.t	Sat Apr 14 12:07:31 2018 -0700
@@ -32,8 +32,8 @@
   sending pushkey command
   s>     *\r\n (glob)
   s>     Accept-Encoding: identity\r\n
-  s>     accept: application/mercurial-exp-framing-0003\r\n
-  s>     content-type: application/mercurial-exp-framing-0003\r\n
+  s>     accept: application/mercurial-exp-framing-0004\r\n
+  s>     content-type: application/mercurial-exp-framing-0004\r\n
   s>     content-length: 105\r\n
   s>     host: $LOCALIP:$HGPORT\r\n (glob)
   s>     user-agent: Mercurial debugwireproto\r\n
@@ -43,14 +43,14 @@
   s>     HTTP/1.1 200 OK\r\n
   s>     Server: testing stub value\r\n
   s>     Date: $HTTP_DATE$\r\n
-  s>     Content-Type: application/mercurial-exp-framing-0003\r\n
+  s>     Content-Type: application/mercurial-exp-framing-0004\r\n
   s>     Transfer-Encoding: chunked\r\n
   s>     \r\n
   s>     9\r\n
-  s>     *\x00\x01\x00\x02\x01F (glob)
+  s>     \x01\x00\x00\x01\x00\x02\x01B
   s>     \xf5
   s>     \r\n
-  received frame(size=*; request=1; stream=2; streamflags=stream-begin; type=bytes-response; flags=eos|cbor) (glob)
+  received frame(size=1; request=1; stream=2; streamflags=stream-begin; type=bytes-response; flags=eos)
   s>     0\r\n
   s>     \r\n
   response: True
@@ -63,8 +63,8 @@
   sending listkeys command
   s>     POST /api/exp-http-v2-0001/ro/listkeys HTTP/1.1\r\n
   s>     Accept-Encoding: identity\r\n
-  s>     accept: application/mercurial-exp-framing-0003\r\n
-  s>     content-type: application/mercurial-exp-framing-0003\r\n
+  s>     accept: application/mercurial-exp-framing-0004\r\n
+  s>     content-type: application/mercurial-exp-framing-0004\r\n
   s>     content-length: 49\r\n
   s>     host: $LOCALIP:$HGPORT\r\n (glob)
   s>     user-agent: Mercurial debugwireproto\r\n
@@ -74,14 +74,14 @@
   s>     HTTP/1.1 200 OK\r\n
   s>     Server: testing stub value\r\n
   s>     Date: $HTTP_DATE$\r\n
-  s>     Content-Type: application/mercurial-exp-framing-0003\r\n
+  s>     Content-Type: application/mercurial-exp-framing-0004\r\n
   s>     Transfer-Encoding: chunked\r\n
   s>     \r\n
   s>     35\r\n
-  s>     -\x00\x00\x01\x00\x02\x01F
+  s>     -\x00\x00\x01\x00\x02\x01B
   s>     \xa1A@X(426bada5c67598ca65036d57d9e4b64b0c1ce7a0
   s>     \r\n
-  received frame(size=45; request=1; stream=2; streamflags=stream-begin; type=bytes-response; flags=eos|cbor)
+  received frame(size=45; request=1; stream=2; streamflags=stream-begin; type=bytes-response; flags=eos)
   s>     0\r\n
   s>     \r\n
   response: {b'@': b'426bada5c67598ca65036d57d9e4b64b0c1ce7a0'}
--- a/tests/wireprotohelpers.sh	Sat Apr 14 11:49:06 2018 -0700
+++ b/tests/wireprotohelpers.sh	Sat Apr 14 12:07:31 2018 -0700
@@ -1,5 +1,5 @@
 HTTPV2=exp-http-v2-0001
-MEDIATYPE=application/mercurial-exp-framing-0003
+MEDIATYPE=application/mercurial-exp-framing-0004
 
 sendhttpraw() {
   hg --verbose debugwireproto --peer raw http://$LOCALIP:$HGPORT/
@@ -26,7 +26,7 @@
 @wireproto.wireprotocommand('customreadonly', permission='pull',
                             transportpolicy=wireproto.POLICY_V2_ONLY)
 def customreadonlyv2(repo, proto):
-    return wireprototypes.bytesresponse(b'customreadonly bytes response')
+    return wireprototypes.cborresponse(b'customreadonly bytes response')
 
 @wireproto.wireprotocommand('customreadwrite', permission='push')
 def customreadwrite(repo, proto):
@@ -35,7 +35,7 @@
 @wireproto.wireprotocommand('customreadwrite', permission='push',
                             transportpolicy=wireproto.POLICY_V2_ONLY)
 def customreadwritev2(repo, proto):
-    return wireprototypes.bytesresponse(b'customreadwrite bytes response')
+    return wireprototypes.cborresponse(b'customreadwrite bytes response')
 EOF
 
 cat >> $HGRCPATH << EOF