wireproto: define permissions-based routing of HTTPv2 wire protocol

Authored by indygreg on Mar 12 2018, 10:16 PM.



Now that we have a scaffolding for serving version 2 of the HTTP
protocol, let's start implementing it.

A good place to start is URL routing and basic request processing
semantics. We can focus on content types, capabilities detect, etc

Version 2 of the HTTP wire protocol encodes the needed permissions
of the request in the URL path. The reasons for this are documented
in the added documentation. In short, a) it makes it really easy and
fail proof for server administrators to implement path-based
authentication and b) it will enable clients to realize very early in
a server exchange that authentication will be required to complete
the operation. This latter point avoids all kinds of complexity and
problems, like dealing with Expect: 100-continue and clients finding
out later during hg push that they need to provide authentication.
This will avoid the current badness where clients send a full bundle,
get an HTTP 403, provide authentication, then retransmit the bundle.

In order to implement command checking, we needed to implement a
protocol handler for the new wire protocol. Our handler is just
small enough to run the code we've implemented.

Tests for the defined functionality have been added.

I very much want to refactor the permissions checking code and define
a better response format. But this can be done later. Nothing is
covered by backwards compatibility at this point.

Diff Detail

rHG Mercurial
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.
indygreg created this revision.Mar 12 2018, 10:16 PM
indygreg updated this revision to Diff 6999.Mar 13 2018, 3:11 PM
indygreg updated this revision to Diff 7010.Mar 13 2018, 9:16 PM
indygreg updated this revision to Diff 7014.Mar 13 2018, 10:49 PM
indygreg planned changes to this revision.Mar 19 2018, 7:38 PM

I'm going to refactor tests for this to deal with an issue I had testing things on my MBP.

indygreg updated this revision to Diff 7135.Mar 19 2018, 7:59 PM
durin42 accepted this revision.Mar 21 2018, 3:18 PM
This revision is now accepted and ready to land.Mar 21 2018, 3:18 PM
indygreg updated this revision to Diff 7195.Mar 21 2018, 6:19 PM
durin42 accepted this revision.Mar 21 2018, 6:21 PM
This revision was automatically updated to reflect the committed changes.
yuja added a subscriber: yuja.Mar 23 2018, 11:35 AM
yuja added inline comments.

Just a nit: No _() is needed because we don't know client language nor character encoding.