[PATCH 3 of 6] lfs: add basic routing for the server side wire protocol processing

Yuya Nishihara yuya at tcha.org
Thu Mar 29 08:13:57 EDT 2018


On Mon, 19 Mar 2018 00:08:26 -0400, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison at yahoo.com>
> # Date 1521264181 14400
> #      Sat Mar 17 01:23:01 2018 -0400
> # Node ID b3d23eed96ea829a4b201f6857cb3195fc308aca
> # Parent  acc9042d2a8b4c7a397a14cd9d1003fcf00c29f3
> lfs: add basic routing for the server side wire protocol processing

> +    if method == b'PUT':
> +        checkperm('upload')
> +    elif method == b'GET':
> +        checkperm('pull')

"else:" is added by later patch. Good.

> diff --git a/mercurial/hgweb/common.py b/mercurial/hgweb/common.py
> --- a/mercurial/hgweb/common.py
> +++ b/mercurial/hgweb/common.py
> @@ -61,8 +61,13 @@ def checkauthz(hgweb, req, op):
>      elif op == 'pull' or op is None: # op is None for interface requests
>          return
>  
> +    # Allow LFS uploading via PUT requests
> +    if op == 'upload':
> +        if req.method != 'PUT':
> +            msg = 'upload requires PUT request'
> +            raise ErrorResponse(HTTP_METHOD_NOT_ALLOWED, msg)
>      # enforce that you can only push using POST requests
> -    if req.method != 'POST':
> +    elif req.method != 'POST':

Can you add basic tests for this, as a followup?


More information about the Mercurial-devel mailing list