Show More
@@ -26,6 +26,9 b' HTTP_OK = hgwebcommon.HTTP_OK' | |||||
26 | HTTP_CREATED = hgwebcommon.HTTP_CREATED |
|
26 | HTTP_CREATED = hgwebcommon.HTTP_CREATED | |
27 | HTTP_BAD_REQUEST = hgwebcommon.HTTP_BAD_REQUEST |
|
27 | HTTP_BAD_REQUEST = hgwebcommon.HTTP_BAD_REQUEST | |
28 | HTTP_NOT_FOUND = hgwebcommon.HTTP_NOT_FOUND |
|
28 | HTTP_NOT_FOUND = hgwebcommon.HTTP_NOT_FOUND | |
|
29 | HTTP_METHOD_NOT_ALLOWED = hgwebcommon.HTTP_METHOD_NOT_ALLOWED | |||
|
30 | HTTP_NOT_ACCEPTABLE = hgwebcommon.HTTP_NOT_ACCEPTABLE | |||
|
31 | HTTP_UNSUPPORTED_MEDIA_TYPE = hgwebcommon.HTTP_UNSUPPORTED_MEDIA_TYPE | |||
29 |
|
32 | |||
30 | def handlewsgirequest(orig, rctx, req, res, checkperm): |
|
33 | def handlewsgirequest(orig, rctx, req, res, checkperm): | |
31 | """Wrap wireprotoserver.handlewsgirequest() to possibly process an LFS |
|
34 | """Wrap wireprotoserver.handlewsgirequest() to possibly process an LFS | |
@@ -105,12 +108,16 b' def _processbatchrequest(repo, req, res)' | |||||
105 | # "operation": "upload" |
|
108 | # "operation": "upload" | |
106 | # } |
|
109 | # } | |
107 |
|
110 | |||
108 |
if |
|
111 | if req.method != b'POST': | |
109 | or req.headers[b'Content-Type'] != b'application/vnd.git-lfs+json' |
|
112 | _sethttperror(res, HTTP_METHOD_NOT_ALLOWED) | |
110 | or req.headers[b'Accept'] != b'application/vnd.git-lfs+json'): |
|
113 | return True | |
111 | # TODO: figure out what the proper handling for a bad request to the |
|
114 | ||
112 | # Batch API is. |
|
115 | if req.headers[b'Content-Type'] != b'application/vnd.git-lfs+json': | |
113 | _sethttperror(res, HTTP_BAD_REQUEST, b'Invalid Batch API request') |
|
116 | _sethttperror(res, HTTP_UNSUPPORTED_MEDIA_TYPE) | |
|
117 | return True | |||
|
118 | ||||
|
119 | if req.headers[b'Accept'] != b'application/vnd.git-lfs+json': | |||
|
120 | _sethttperror(res, HTTP_NOT_ACCEPTABLE) | |||
114 | return True |
|
121 | return True | |
115 |
|
122 | |||
116 | # XXX: specify an encoding? |
|
123 | # XXX: specify an encoding? | |
@@ -315,6 +322,6 b' def _processbasictransfer(repo, req, res' | |||||
315 |
|
322 | |||
316 | return True |
|
323 | return True | |
317 | else: |
|
324 | else: | |
318 |
_sethttperror(res, HTTP_ |
|
325 | _sethttperror(res, HTTP_METHOD_NOT_ALLOWED, | |
319 | message=b'Unsupported LFS transfer method: %s' % method) |
|
326 | message=b'Unsupported LFS transfer method: %s' % method) | |
320 | return True |
|
327 | return True |
@@ -30,6 +30,8 b' HTTP_UNAUTHORIZED = 401' | |||||
30 | HTTP_FORBIDDEN = 403 |
|
30 | HTTP_FORBIDDEN = 403 | |
31 | HTTP_NOT_FOUND = 404 |
|
31 | HTTP_NOT_FOUND = 404 | |
32 | HTTP_METHOD_NOT_ALLOWED = 405 |
|
32 | HTTP_METHOD_NOT_ALLOWED = 405 | |
|
33 | HTTP_NOT_ACCEPTABLE = 406 | |||
|
34 | HTTP_UNSUPPORTED_MEDIA_TYPE = 415 | |||
33 | HTTP_SERVER_ERROR = 500 |
|
35 | HTTP_SERVER_ERROR = 500 | |
34 |
|
36 | |||
35 |
|
37 |
General Comments 0
You need to be logged in to leave comments.
Login now