mercurial/hgweb/common.py
changeset 37147 a2566597acb5
parent 36877 02bea04b4c54
child 37149 cc0a6ea95d98
--- a/mercurial/hgweb/common.py	Wed Mar 14 23:34:08 2018 -0400
+++ b/mercurial/hgweb/common.py	Sat Mar 17 01:23:01 2018 -0400
@@ -61,8 +61,13 @@
     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':
         msg = 'push requires POST request'
         raise ErrorResponse(HTTP_METHOD_NOT_ALLOWED, msg)
 
@@ -81,7 +86,7 @@
 
 # Hooks for hgweb permission checks; extensions can add hooks here.
 # Each hook is invoked like this: hook(hgweb, request, operation),
-# where operation is either read, pull or push. Hooks should either
+# where operation is either read, pull, push or upload. Hooks should either
 # raise an ErrorResponse exception, or just return.
 #
 # It is possible to do both authentication and authorization through