diff --git a/samples/java/S3Sample.java b/samples/java/S3Sample.java index ca6a639..01ecc86 100644 --- a/samples/java/S3Sample.java +++ b/samples/java/S3Sample.java @@ -99,9 +99,10 @@ public static void main(String[] args) throws IOException { S3ClientOptions clientOptions = new S3ClientOptions(); clientOptions.setPathStyleAccess(true); + clientOptions.disableChunkedEncoding(); AmazonS3 s3 = new AmazonS3Client(customProvider); - s3.setEndpoint("https://zeppelin-gateway-host"); + s3.setEndpoint("http://zeppelin-gateway-host"); s3.setS3ClientOptions(clientOptions); String bucketName = "my-first-s3-bucket-" + UUID.randomUUID(); diff --git a/samples/php/S3Sample.php b/samples/php/S3Sample.php index ab3fa87..9422b71 100644 --- a/samples/php/S3Sample.php +++ b/samples/php/S3Sample.php @@ -9,7 +9,7 @@ 'version' => '2006-03-01', 'signature_version' => 'v4', 'use_path_style_endpoint' => true, - 'endpoint' => 'https://zeppelin-gateway-host', + 'endpoint' => 'http://zeppelin-gateway-host', 'credentials' => [ 'key' => 'XXXXXXXXXXXXXXXXXXXX', 'secret' => 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' diff --git a/samples/python/S3Sample.py b/samples/python/S3Sample.py index 8761f95..8ef6f5a 100644 --- a/samples/python/S3Sample.py +++ b/samples/python/S3Sample.py @@ -2,9 +2,9 @@ from botocore.client import Config s3_cli = boto3.client('s3', 'sh-bt-1', - config=Config(signature_version='s3v4'), use_ssl=True, - verify='/path-to/cacert.pem, or delete me and set use_ssl=False', - endpoint_url='https://zeppelin-gateway-host', + config=Config(signature_version='s3v4'), use_ssl=False, + # verify='/path-to/cacert.pem, or delete me and set use_ssl=False', + endpoint_url='http://zeppelin-gateway-host', aws_secret_access_key='XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', aws_access_key_id='XXXXXXXXXXXXXXXXXXXX') diff --git a/src/s3_cmds/zgw_s3_command.cc b/src/s3_cmds/zgw_s3_command.cc index fbf854f..a4993af 100644 --- a/src/s3_cmds/zgw_s3_command.cc +++ b/src/s3_cmds/zgw_s3_command.cc @@ -113,18 +113,17 @@ void DestroyCmdTable(S3CmdTable* cmd_table) { } bool S3Cmd::TryAuth() { - if (!bucket_name_.empty()) { + if ((flags() & kFlagsRead) && !bucket_name_.empty()) { zgwstore::Bucket bkt; std::string unuseful_name; bool anonymous = true; Status s = store_->GetBucket(unuseful_name, bucket_name_, &bkt, anonymous); if (!s.ok()) { + http_ret_code_ = 403; GenerateErrorXml(kInvalidAccessKeyId); return false; } - if (bkt.acl == "FULL_CONTROL" || - (bkt.acl == "READ" && flags() & kFlagsRead) || - (bkt.acl == "WRITE" && flags() & kFlagsWrite)) { + if (bkt.acl == "FULL_CONTROL" || bkt.acl == "READ") { user_name_.assign(bkt.owner); return true; }