diff options
author | venkata edara <redara@redhat.com> | 2017-04-04 15:52:53 +0530 |
---|---|---|
committer | Prashanth Pai <ppai@redhat.com> | 2017-04-04 09:27:23 -0400 |
commit | e9c2c5eb55e1012ccce0ce51ac48bed0c0f1d4b7 (patch) | |
tree | 24bb2feb0c3aa81751625e84163f75586cdcbafb /gluster | |
parent | c1c39697d8866cc7437da8fdfd2b08fd8cb54690 (diff) |
Add support for S3 Multipart Upload API
Obj server checks if +segments is there and creates directory to support multi-part upload
Updated s3.md to show usage of multi-part upload.
Change-Id: I1e8a0dd850f51b2cc5dd2147607e46978dc2f936
Signed-off-by: venkata edara <redara@redhat.com>
Reviewed-on: https://review.gluster.org/16983
Reviewed-by: Prashanth Pai <ppai@redhat.com>
Tested-by: Prashanth Pai <ppai@redhat.com>
Diffstat (limited to 'gluster')
-rw-r--r-- | gluster/swift/obj/server.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/gluster/swift/obj/server.py b/gluster/swift/obj/server.py index 3e27cc3..ae225b2 100644 --- a/gluster/swift/obj/server.py +++ b/gluster/swift/obj/server.py @@ -19,7 +19,8 @@ import os from swift.common.swob import HTTPConflict, HTTPNotImplemented from swift.common.utils import public, timing_stats, replication, mkdirs -from swift.common.request_helpers import split_and_validate_path +from swift.common.request_helpers import split_and_validate_path, \ + get_name_and_placement from swift.obj import server from gluster.swift.obj.diskfile import DiskFileManager @@ -135,6 +136,14 @@ class ObjectController(server.ObjectController): @timing_stats() def PUT(self, request): try: + # hack for supporting multi-part. create dir during initialization + content_length = int(request.headers.get('Content-Length', -1)) + authorization = request.headers.get('Authorization', '') + if content_length == 0 and 'AWS' in authorization: + device, partition, account, container, obj, policy = \ + get_name_and_placement(request, 5, 5, True) + if container.endswith("+segments"): + request.headers["Content-Type"] = 'application/directory' # now call swift's PUT method return server.ObjectController.PUT(self, request) except (AlreadyExistsAsFile, AlreadyExistsAsDir): |