D2851: wireproto: define and implement protocol for issuing requests
yuja added inline comments. INLINE COMMENTS > wireprotocol.txt:486 > ++---+ > +| Flags (4) | > ++===+===| Nit: The order of Type and Flags seems a bit confusing. I read it as `flags << 4 | type` since this is a little-endian (so naturally LSB-first) protocol. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2851 To: indygreg, #hg-reviewers, durin42 Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2851: wireproto: define and implement protocol for issuing requests
This revision was automatically updated to reflect the committed changes. Closed by commit rHG40206e227412: wireproto: define and implement protocol for issuing requests (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2851?vs=7199&id=7227 REVISION DETAIL https://phab.mercurial-scm.org/D2851 AFFECTED FILES mercurial/debugcommands.py mercurial/help/internals/wireprotocol.txt mercurial/wireprotoframing.py mercurial/wireprotoserver.py tests/test-http-api-httpv2.t CHANGE DETAILS diff --git a/tests/test-http-api-httpv2.t b/tests/test-http-api-httpv2.t --- a/tests/test-http-api-httpv2.t +++ b/tests/test-http-api-httpv2.t @@ -1,5 +1,5 @@ $ HTTPV2=exp-http-v2-0001 - $ MEDIATYPE=application/mercurial-tbd + $ MEDIATYPE=application/mercurial-exp-framing-0001 $ send() { > hg --verbose debugwireproto --peer raw http://$LOCALIP:$HGPORT/ @@ -120,9 +120,9 @@ s> Server: testing stub value\r\n s> Date: $HTTP_DATE$\r\n s> Content-Type: text/plain\r\n - s> Content-Length: 72\r\n + s> Content-Length: 85\r\n s> \r\n - s> client MUST specify Accept header with value: application/mercurial-tbd\n + s> client MUST specify Accept header with value: application/mercurial-exp-framing-0001\n Bad Accept header results in 406 @@ -143,9 +143,9 @@ s> Server: testing stub value\r\n s> Date: $HTTP_DATE$\r\n s> Content-Type: text/plain\r\n - s> Content-Length: 72\r\n + s> Content-Length: 85\r\n s> \r\n - s> client MUST specify Accept header with value: application/mercurial-tbd\n + s> client MUST specify Accept header with value: application/mercurial-exp-framing-0001\n Bad Content-Type header results in 415 @@ -158,7 +158,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-tbd\r\n + s> accept: application/mercurial-exp-framing-0001\r\n s> content-type: badmedia\r\n s> user-agent: test\r\n s> host: $LOCALIP:$HGPORT\r\n (glob) @@ -168,26 +168,29 @@ s> Server: testing stub value\r\n s> Date: $HTTP_DATE$\r\n s> Content-Type: text/plain\r\n - s> Content-Length: 75\r\n + s> Content-Length: 88\r\n s> \r\n - s> client MUST send Content-Type header with value: application/mercurial-tbd\n + s> client MUST send Content-Type header with value: application/mercurial-exp-framing-0001\n Request to read-only command works out of the box $ send << EOF > httprequest POST api/$HTTPV2/ro/customreadonly > accept: $MEDIATYPE > content-type: $MEDIATYPE > user-agent: test + > frame command-name eos customreadonly > EOF 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-tbd\r\n - s> content-type: application/mercurial-tbd\r\n + s> accept: application/mercurial-exp-framing-0001\r\n + s> content-type: application/mercurial-exp-framing-0001\r\n s> user-agent: test\r\n + s> content-length: 18\r\n s> host: $LOCALIP:$HGPORT\r\n (glob) s> \r\n + s> \x0e\x00\x00\x11customreadonly s> makefile('rb', None) s> HTTP/1.1 200 OK\r\n s> Server: testing stub value\r\n @@ -283,15 +286,18 @@ > user-agent: test > accept: $MEDIATYPE > content-type: $MEDIATYPE + > frame command-name eos customreadonly > EOF 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-tbd\r\n - s> content-type: application/mercurial-tbd\r\n + s> accept: application/mercurial-exp-framing-0001\r\n + s> content-type: application/mercurial-exp-framing-0001\r\n s> user-agent: test\r\n + s> content-length: 18\r\n s> host: $LOCALIP:$HGPORT\r\n (glob) s> \r\n + s> \x0e\x00\x00\x11customreadonly s> makefile('rb', None) s> HTTP/1.1 200 OK\r\n s> Server: testing stub value\r\n @@ -311,7 +317,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-tbd\r\n + s> accept: application/mercurial-exp-framing-0001\r\n s> user-agent: test\r\n s> host: $LOCALIP:$HGPORT\r\n (glob) s> \r\n diff --git a/mercurial/wireprotoserver.py b/mercurial/wireprotoserver.py --- a/mercurial/wireprotoserver.py +++ b/mercurial/wireprotoserver.py @@ -32,7 +32,7 @@ HGTYPE = 'application/mercurial-0.1' HGTYPE2 = 'application/mercurial-0.2' HGERRTYPE = 'application/hg-error' -HTTPV2TYPE = 'application/mercurial-tbd' +FRAMINGTYPE = b'applicat
D2851: wireproto: define and implement protocol for issuing requests
indygreg updated this revision to Diff 7199. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2851?vs=7139&id=7199 REVISION DETAIL https://phab.mercurial-scm.org/D2851 AFFECTED FILES mercurial/debugcommands.py mercurial/help/internals/wireprotocol.txt mercurial/wireprotoframing.py mercurial/wireprotoserver.py tests/test-http-api-httpv2.t CHANGE DETAILS diff --git a/tests/test-http-api-httpv2.t b/tests/test-http-api-httpv2.t --- a/tests/test-http-api-httpv2.t +++ b/tests/test-http-api-httpv2.t @@ -1,5 +1,5 @@ $ HTTPV2=exp-http-v2-0001 - $ MEDIATYPE=application/mercurial-tbd + $ MEDIATYPE=application/mercurial-exp-framing-0001 $ send() { > hg --verbose debugwireproto --peer raw http://$LOCALIP:$HGPORT/ @@ -120,9 +120,9 @@ s> Server: testing stub value\r\n s> Date: $HTTP_DATE$\r\n s> Content-Type: text/plain\r\n - s> Content-Length: 72\r\n + s> Content-Length: 85\r\n s> \r\n - s> client MUST specify Accept header with value: application/mercurial-tbd\n + s> client MUST specify Accept header with value: application/mercurial-exp-framing-0001\n Bad Accept header results in 406 @@ -143,9 +143,9 @@ s> Server: testing stub value\r\n s> Date: $HTTP_DATE$\r\n s> Content-Type: text/plain\r\n - s> Content-Length: 72\r\n + s> Content-Length: 85\r\n s> \r\n - s> client MUST specify Accept header with value: application/mercurial-tbd\n + s> client MUST specify Accept header with value: application/mercurial-exp-framing-0001\n Bad Content-Type header results in 415 @@ -158,7 +158,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-tbd\r\n + s> accept: application/mercurial-exp-framing-0001\r\n s> content-type: badmedia\r\n s> user-agent: test\r\n s> host: $LOCALIP:$HGPORT\r\n (glob) @@ -168,26 +168,29 @@ s> Server: testing stub value\r\n s> Date: $HTTP_DATE$\r\n s> Content-Type: text/plain\r\n - s> Content-Length: 75\r\n + s> Content-Length: 88\r\n s> \r\n - s> client MUST send Content-Type header with value: application/mercurial-tbd\n + s> client MUST send Content-Type header with value: application/mercurial-exp-framing-0001\n Request to read-only command works out of the box $ send << EOF > httprequest POST api/$HTTPV2/ro/customreadonly > accept: $MEDIATYPE > content-type: $MEDIATYPE > user-agent: test + > frame command-name eos customreadonly > EOF 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-tbd\r\n - s> content-type: application/mercurial-tbd\r\n + s> accept: application/mercurial-exp-framing-0001\r\n + s> content-type: application/mercurial-exp-framing-0001\r\n s> user-agent: test\r\n + s> content-length: 18\r\n s> host: $LOCALIP:$HGPORT\r\n (glob) s> \r\n + s> \x0e\x00\x00\x11customreadonly s> makefile('rb', None) s> HTTP/1.1 200 OK\r\n s> Server: testing stub value\r\n @@ -283,15 +286,18 @@ > user-agent: test > accept: $MEDIATYPE > content-type: $MEDIATYPE + > frame command-name eos customreadonly > EOF 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-tbd\r\n - s> content-type: application/mercurial-tbd\r\n + s> accept: application/mercurial-exp-framing-0001\r\n + s> content-type: application/mercurial-exp-framing-0001\r\n s> user-agent: test\r\n + s> content-length: 18\r\n s> host: $LOCALIP:$HGPORT\r\n (glob) s> \r\n + s> \x0e\x00\x00\x11customreadonly s> makefile('rb', None) s> HTTP/1.1 200 OK\r\n s> Server: testing stub value\r\n @@ -311,7 +317,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-tbd\r\n + s> accept: application/mercurial-exp-framing-0001\r\n s> user-agent: test\r\n s> host: $LOCALIP:$HGPORT\r\n (glob) s> \r\n diff --git a/mercurial/wireprotoserver.py b/mercurial/wireprotoserver.py --- a/mercurial/wireprotoserver.py +++ b/mercurial/wireprotoserver.py @@ -32,7 +32,7 @@ HGTYPE = 'application/mercurial-0.1' HGTYPE2 = 'application/mercurial-0.2' HGERRTYPE = 'application/hg-error' -HTTPV2TYPE = 'application/mercurial-tbd' +FRAMINGTYPE = b'application/mercurial-exp-framing-0001' HTTPV2 = wireprototypes.HTTPV2 SSHV1 = wireprototypes.SSHV1 @@ -336,21 +336,21 @@ res.setbodybytes(_('invalid wire proto
D2851: wireproto: define and implement protocol for issuing requests
indygreg updated this revision to Diff 7139. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2851?vs=7047&id=7139 REVISION DETAIL https://phab.mercurial-scm.org/D2851 AFFECTED FILES mercurial/debugcommands.py mercurial/help/internals/wireprotocol.txt mercurial/wireprotoframing.py mercurial/wireprotoserver.py tests/test-http-api-httpv2.t CHANGE DETAILS diff --git a/tests/test-http-api-httpv2.t b/tests/test-http-api-httpv2.t --- a/tests/test-http-api-httpv2.t +++ b/tests/test-http-api-httpv2.t @@ -1,5 +1,5 @@ $ HTTPV2=exp-http-v2-0001 - $ MEDIATYPE=application/mercurial-tbd + $ MEDIATYPE=application/mercurial-exp-framing-0001 $ send() { > hg --verbose debugwireproto --peer raw http://$LOCALIP:$HGPORT/ @@ -120,9 +120,9 @@ s> Server: testing stub value\r\n s> Date: $HTTP_DATE$\r\n s> Content-Type: text/plain\r\n - s> Content-Length: 72\r\n + s> Content-Length: 85\r\n s> \r\n - s> client MUST specify Accept header with value: application/mercurial-tbd\n + s> client MUST specify Accept header with value: application/mercurial-exp-framing-0001\n Bad Accept header results in 406 @@ -143,9 +143,9 @@ s> Server: testing stub value\r\n s> Date: $HTTP_DATE$\r\n s> Content-Type: text/plain\r\n - s> Content-Length: 72\r\n + s> Content-Length: 85\r\n s> \r\n - s> client MUST specify Accept header with value: application/mercurial-tbd\n + s> client MUST specify Accept header with value: application/mercurial-exp-framing-0001\n Bad Content-Type header results in 415 @@ -158,7 +158,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-tbd\r\n + s> accept: application/mercurial-exp-framing-0001\r\n s> content-type: badmedia\r\n s> user-agent: test\r\n s> host: $LOCALIP:$HGPORT\r\n (glob) @@ -168,26 +168,29 @@ s> Server: testing stub value\r\n s> Date: $HTTP_DATE$\r\n s> Content-Type: text/plain\r\n - s> Content-Length: 75\r\n + s> Content-Length: 88\r\n s> \r\n - s> client MUST send Content-Type header with value: application/mercurial-tbd\n + s> client MUST send Content-Type header with value: application/mercurial-exp-framing-0001\n Request to read-only command works out of the box $ send << EOF > httprequest POST api/$HTTPV2/ro/customreadonly > accept: $MEDIATYPE > content-type: $MEDIATYPE > user-agent: test + > frame command-name eos customreadonly > EOF 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-tbd\r\n - s> content-type: application/mercurial-tbd\r\n + s> accept: application/mercurial-exp-framing-0001\r\n + s> content-type: application/mercurial-exp-framing-0001\r\n s> user-agent: test\r\n + s> content-length: 18\r\n s> host: $LOCALIP:$HGPORT\r\n (glob) s> \r\n + s> \x0e\x00\x00\x11customreadonly s> makefile('rb', None) s> HTTP/1.1 200 OK\r\n s> Server: testing stub value\r\n @@ -283,15 +286,18 @@ > user-agent: test > accept: $MEDIATYPE > content-type: $MEDIATYPE + > frame command-name eos customreadonly > EOF 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-tbd\r\n - s> content-type: application/mercurial-tbd\r\n + s> accept: application/mercurial-exp-framing-0001\r\n + s> content-type: application/mercurial-exp-framing-0001\r\n s> user-agent: test\r\n + s> content-length: 18\r\n s> host: $LOCALIP:$HGPORT\r\n (glob) s> \r\n + s> \x0e\x00\x00\x11customreadonly s> makefile('rb', None) s> HTTP/1.1 200 OK\r\n s> Server: testing stub value\r\n @@ -311,7 +317,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-tbd\r\n + s> accept: application/mercurial-exp-framing-0001\r\n s> user-agent: test\r\n s> host: $LOCALIP:$HGPORT\r\n (glob) s> \r\n diff --git a/mercurial/wireprotoserver.py b/mercurial/wireprotoserver.py --- a/mercurial/wireprotoserver.py +++ b/mercurial/wireprotoserver.py @@ -32,7 +32,7 @@ HGTYPE = 'application/mercurial-0.1' HGTYPE2 = 'application/mercurial-0.2' HGERRTYPE = 'application/hg-error' -HTTPV2TYPE = 'application/mercurial-tbd' +FRAMINGTYPE = b'application/mercurial-exp-framing-0001' HTTPV2 = wireprototypes.HTTPV2 SSHV1 = wireprototypes.SSHV1 @@ -336,21 +336,21 @@ res.setbodybytes(_('invalid wire proto
D2851: wireproto: define and implement protocol for issuing requests
indygreg updated this revision to Diff 7047. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2851?vs=7017&id=7047 REVISION DETAIL https://phab.mercurial-scm.org/D2851 AFFECTED FILES mercurial/debugcommands.py mercurial/help/internals/wireprotocol.txt mercurial/wireprotoframing.py mercurial/wireprotoserver.py tests/test-http-api-httpv2.t CHANGE DETAILS diff --git a/tests/test-http-api-httpv2.t b/tests/test-http-api-httpv2.t --- a/tests/test-http-api-httpv2.t +++ b/tests/test-http-api-httpv2.t @@ -1,5 +1,5 @@ $ HTTPV2=exp-http-v2-0001 - $ MEDIATYPE=application/mercurial-tbd + $ MEDIATYPE=application/mercurial-exp-framing-0001 $ send() { > hg --verbose debugwireproto --peer raw http://$LOCALIP:$HGPORT/ @@ -105,9 +105,9 @@ s> Server: testing stub value\r\n s> Date: $HTTP_DATE$\r\n s> Content-Type: text/plain\r\n - s> Content-Length: 72\r\n + s> Content-Length: 85\r\n s> \r\n - s> client MUST specify Accept header with value: application/mercurial-tbd\n + s> client MUST specify Accept header with value: application/mercurial-exp-framing-0001\n Bad Accept header results in 406 @@ -128,9 +128,9 @@ s> Server: testing stub value\r\n s> Date: $HTTP_DATE$\r\n s> Content-Type: text/plain\r\n - s> Content-Length: 72\r\n + s> Content-Length: 85\r\n s> \r\n - s> client MUST specify Accept header with value: application/mercurial-tbd\n + s> client MUST specify Accept header with value: application/mercurial-exp-framing-0001\n Bad Content-Type header results in 415 @@ -143,7 +143,7 @@ using raw connection to peer s> POST /api/exp-http-v2-0001/ro/capabilities HTTP/1.1\r\n s> Accept-Encoding: identity\r\n - s> accept: application/mercurial-tbd\r\n + s> accept: application/mercurial-exp-framing-0001\r\n s> content-type: badmedia\r\n s> user-agent: test\r\n s> host: $LOCALIP:$HGPORT\r\n (glob) @@ -153,26 +153,29 @@ s> Server: testing stub value\r\n s> Date: $HTTP_DATE$\r\n s> Content-Type: text/plain\r\n - s> Content-Length: 75\r\n + s> Content-Length: 88\r\n s> \r\n - s> client MUST send Content-Type header with value: application/mercurial-tbd\n + s> client MUST send Content-Type header with value: application/mercurial-exp-framing-0001\n Request to read-only command works out of the box $ send << EOF > httprequest POST api/$HTTPV2/ro/capabilities > accept: $MEDIATYPE > content-type: $MEDIATYPE > user-agent: test + > frame command-name eos capabilities > EOF using raw connection to peer s> POST /api/exp-http-v2-0001/ro/capabilities HTTP/1.1\r\n s> Accept-Encoding: identity\r\n - s> accept: application/mercurial-tbd\r\n - s> content-type: application/mercurial-tbd\r\n + s> accept: application/mercurial-exp-framing-0001\r\n + s> content-type: application/mercurial-exp-framing-0001\r\n s> user-agent: test\r\n + s> content-length: 16\r\n s> host: $LOCALIP:$HGPORT\r\n (glob) s> \r\n + s> \x0c\x00\x00\x11capabilities s> makefile('rb', None) s> HTTP/1.1 200 OK\r\n s> Server: testing stub value\r\n @@ -268,15 +271,18 @@ > user-agent: test > accept: $MEDIATYPE > content-type: $MEDIATYPE + > frame command-name eos capabilities > EOF using raw connection to peer s> POST /api/exp-http-v2-0001/rw/capabilities HTTP/1.1\r\n s> Accept-Encoding: identity\r\n - s> accept: application/mercurial-tbd\r\n - s> content-type: application/mercurial-tbd\r\n + s> accept: application/mercurial-exp-framing-0001\r\n + s> content-type: application/mercurial-exp-framing-0001\r\n s> user-agent: test\r\n + s> content-length: 16\r\n s> host: $LOCALIP:$HGPORT\r\n (glob) s> \r\n + s> \x0c\x00\x00\x11capabilities s> makefile('rb', None) s> HTTP/1.1 200 OK\r\n s> Server: testing stub value\r\n @@ -296,7 +302,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-tbd\r\n + s> accept: application/mercurial-exp-framing-0001\r\n s> user-agent: test\r\n s> host: $LOCALIP:$HGPORT\r\n (glob) s> \r\n diff --git a/mercurial/wireprotoserver.py b/mercurial/wireprotoserver.py --- a/mercurial/wireprotoserver.py +++ b/mercurial/wireprotoserver.py @@ -32,7 +32,7 @@ HGTYPE = 'application/mercurial-0.1' HGTYPE2 = 'application/mercurial-0.2' HGERRTYPE = 'application/hg-error' -HTTPV2TYPE = 'application/mercurial-tbd' +FRAMINGTYPE = b'application/mercurial-exp-framing-0001' HTTPV2 = wireprototypes.HTTPV2 SSHV1 = wireprototypes.SSHV1 @@ -336,21 +336,21 @@ res.setbodybytes(_('invalid wire protocol command: %s'
D2851: wireproto: define and implement protocol for issuing requests
indygreg planned changes to this revision. indygreg added inline comments. INLINE COMMENTS > wireprotoframing.py:99-100 > +offset = 0 > +ARGUMENT_FRAME_HEADER.pack_into(payload, offset, len(k), len(v)) > +payload[offset:offset + len(k)] = k > +offset += len(k) We don't increment offset here. I have a fix for this locally. Will upload once I know someone starts looking at these commits, as I don't want to cause too much spam via resends. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2851 To: indygreg, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2851: wireproto: define and implement protocol for issuing requests
indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY The existing HTTP and SSH wire protocols suffer from a host of flaws and shortcomings. I've been wanting to rewrite the protocol for a while now. Supporting partial clone - which will require new wire protocol commands and capabilities - and other advanced server functionality will be much easier if we start from a clean slate and don't have to be constrained by limitations of the existing wire protocol. This commit starts to introduce a new data exchange format for use over the wire protocol. The new protocol is built on top of "frames," which are atomic units of metadata + data. Frames will make it easier to implement proxies and other mechanisms that want to inspect data without having to maintain state. The existing frame metadata is very minimal and it will evolve heavily. (We will eventually support things like concurrent requests, out-of-order responses, compression, side-channels for status updates, etc. Some of these will require additions to the frame header.) Another benefit of frames is that all reads are of a fixed size. A reader works by consuming a frame header, extracting the payload length, then reading that many bytes. No lookahead, buffering, or memory reallocations are needed. The new protocol attempts to be transport agnostic. I want all that's required to use the new protocol to be a pair of unidirectional, half-duplex pipes. (Yes, we will eventually make use of full-duplex pipes, but that's for another commit.) Notably, when the SSH transport switches to this new protocol, stderr will be unused. This is by design: the lack of stderr on HTTP harms protocol behavior there. By shoehorning everything into a pair of pipes, we can have more consistent behavior across transports. We currently only define the client side parts of the new protocol, specifically the bits for requesting that a command run. This keeps the new code and feature small and somewhat easy to review. We add support to `hg debugwireproto` for writing frames into HTTP request bodies. Our tests that issue commands to the new HTTP endpoint have been updated to transmit frames. The server bits haven't been touched to consume the frames yet. This will occur in the next commit... Astute readers may notice that the command name is transmitted in both the HTTP request URL and the command request frame. This is partially a kludge from me initially implementing the frame-based protocol for SSH first. But it is also a feature: I intend to eventually support issuing multiple commands per HTTP request. This will allow us to replace the abomination that is the "batch" wire protocol command with a protocol-level mechanism for performing multi-dispatch. Because I want the frame-based protocol to be as similar as possible across transports, I'd rather we (redundantly) include the command name in the frame than differ behavior between transports that have out-of-band routing information (like HTTP) readily available. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2851 AFFECTED FILES mercurial/debugcommands.py mercurial/help/internals/wireprotocol.txt mercurial/wireprotoframing.py mercurial/wireprotoserver.py tests/test-http-api-httpv2.t CHANGE DETAILS diff --git a/tests/test-http-api-httpv2.t b/tests/test-http-api-httpv2.t --- a/tests/test-http-api-httpv2.t +++ b/tests/test-http-api-httpv2.t @@ -1,5 +1,5 @@ $ HTTPV2=exp-http-v2-0001 - $ MEDIATYPE=application/mercurial-tbd + $ MEDIATYPE=application/mercurial-exp-framing-0001 $ send() { > hg --verbose debugwireproto --peer raw http://$LOCALIP:$HGPORT/ @@ -105,9 +105,9 @@ s> Server: testing stub value\r\n s> Date: $HTTP_DATE$\r\n s> Content-Type: text/plain\r\n - s> Content-Length: 72\r\n + s> Content-Length: 85\r\n s> \r\n - s> client MUST specify Accept header with value: application/mercurial-tbd\n + s> client MUST specify Accept header with value: application/mercurial-exp-framing-0001\n Bad Accept header results in 406 @@ -128,9 +128,9 @@ s> Server: testing stub value\r\n s> Date: $HTTP_DATE$\r\n s> Content-Type: text/plain\r\n - s> Content-Length: 72\r\n + s> Content-Length: 85\r\n s> \r\n - s> client MUST specify Accept header with value: application/mercurial-tbd\n + s> client MUST specify Accept header with value: application/mercurial-exp-framing-0001\n Bad Content-Type header results in 415 @@ -143,7 +143,7 @@ using raw connection to peer s> POST /api/exp-http-v2-0001/ro/capabilities HTTP/1.1\r\n s> Accept-Encoding: identity\r\n - s> accept: application/mercurial-tbd\r\n + s> accept: application/mercurial-exp-framing-0001\r\n s> conte