Mercurial > public > mercurial-scm > hg-stable
diff mercurial/help/internals/wireprotocol.txt @ 37053:37d7a1d18b97
wireproto: define content negotiation for HTTPv2
HTTP messages communicate their media types and what media types
they can understand via the Content-Type and Accept header,
respectively.
While I don't want the wire protocol to lean too heavily on HTTP
because I'm aiming for the wire protocol to be as transport
agnostic as possible, it is nice to play by the spec if possible.
This commit defines our media negotiation mechanism for version
2 of the HTTP protocol. Essentially, we mandate the use of a
new media type and how clients and servers should react to
various headers or lack thereof.
The name of the media type is a placeholder. We purposefully don't
yet define the format of the new media type because that's a lot
of work.
I feel pretty strongly that we should use Content-Type. I feel
less strongly about Accept. I think it is reasonable for servers
to return the media type that was submitted to them. So we may
strike this header before the protocol is finished...
Differential Revision: https://phab.mercurial-scm.org/D2850
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Tue, 13 Mar 2018 19:44:59 -0700 |
parents | fc5e261915b9 |
children | 40206e227412 |
line wrap: on
line diff
--- a/mercurial/help/internals/wireprotocol.txt Tue Mar 13 14:15:10 2018 -0700 +++ b/mercurial/help/internals/wireprotocol.txt Tue Mar 13 19:44:59 2018 -0700 @@ -187,6 +187,19 @@ Requests to unknown commands or URLS result in an HTTP 404. TODO formally define response type, how error is communicated, etc. +HTTP request and response bodies use the *TBD Protocol* for media exchange. + +Clients and servers MUST advertise the ``TBD`` media type via the +``Content-Type`` request and response headers. In addition, clients MUST +advertise this media type value in their ``Accept`` request header in all +requests. + +Servers receiving requests without an ``Accept`` header SHOULD respond with +an HTTP 406. + +Servers receiving requests with an invalid ``Content-Type`` header SHOULD +respond with an HTTP 415. + SSH Protocol ============