aws-sdk-s3 1.8.0 → 1.8.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/aws-sdk-s3/client.rb +1 -1
- data/lib/aws-sdk-s3/encryption/decrypt_handler.rb +2 -1
- data/lib/aws-sdk-s3/encryption/kms_cipher_provider.rb +2 -0
- data/lib/aws-sdk-s3/file_downloader.rb +20 -50
- data/lib/aws-sdk-s3/plugins/accelerate.rb +1 -1
- data/lib/aws-sdk-s3/plugins/dualstack.rb +1 -1
- data/lib/aws-sdk-s3/presigner.rb +1 -1
- data/lib/aws-sdk-s3.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d7148cc33c898dd318c42d6c85703593aa147bee
|
4
|
+
data.tar.gz: a047d88bc816ca70f830778d228b0bcc9cf20145
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 99396fcd7b62b692c23dbb0ba3662a241fa87e654de6ddc80e344d1f42b2e8c5f99b354d7a619656def60ca7255dc69a503b46b98d076d84e64a5c67470fc214
|
7
|
+
data.tar.gz: 01d123f13e3b527c55f460fc43d2c7ce0f5d7c31ae8c9ef7caad5c619f2330c492563c029e8bf4021af05cc2289667eef0982cd016222c550727f858b4f82451
|
data/lib/aws-sdk-s3/client.rb
CHANGED
@@ -25,6 +25,7 @@ module Aws
|
|
25
25
|
POSSIBLE_ENCRYPTION_FORMATS = %w(
|
26
26
|
AES/GCM/NoPadding
|
27
27
|
AES/CBC/PKCS5Padding
|
28
|
+
AES/CBC/PKCS7Padding
|
28
29
|
)
|
29
30
|
|
30
31
|
def call(context)
|
@@ -162,7 +163,7 @@ module Aws
|
|
162
163
|
# The encrypted object contains both the cipher text
|
163
164
|
# plus a trailing auth tag. This decrypter will the body
|
164
165
|
# expect for the trailing auth tag.
|
165
|
-
|
166
|
+
IOAuthDecrypter.new(
|
166
167
|
io: http_resp.body,
|
167
168
|
encrypted_content_length: content_length - auth_tag_length,
|
168
169
|
cipher: cipher)
|
@@ -89,39 +89,13 @@ module Aws
|
|
89
89
|
if @chunk_size && @chunk_size > file_size
|
90
90
|
raise ArgumentError, ":chunk_size shouldn't exceed total file size."
|
91
91
|
else
|
92
|
-
|
92
|
+
@chunk_size || [(file_size.to_f / MAX_PARTS).ceil, MIN_CHUNK_SIZE].max.to_i
|
93
93
|
end
|
94
94
|
end
|
95
95
|
|
96
|
-
def
|
97
|
-
# sort file by start range count or part number
|
98
|
-
files.sort do |a, b|
|
99
|
-
a[/([^\=]+)$/].split('-')[0].to_i <=> b[/([^\=]+)$/].split('-')[0].to_i
|
100
|
-
end
|
101
|
-
end
|
102
|
-
|
103
|
-
def concatenate_parts(fileparts)
|
104
|
-
File.open(@path, 'wb')do |output_path|
|
105
|
-
sort_files(fileparts).each {|part| IO.copy_stream(part, output_path)}
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
109
|
-
def file_batches(chunks, dir, mode)
|
110
|
-
batches = []
|
96
|
+
def batches(chunks, mode)
|
111
97
|
chunks = (1..chunks) if mode.eql? 'part_number'
|
112
|
-
chunks.each_slice(@thread_count)
|
113
|
-
batches << map_files(slice, dir, mode)
|
114
|
-
end
|
115
|
-
batches
|
116
|
-
end
|
117
|
-
|
118
|
-
def map_files(slice, dir, mode)
|
119
|
-
case mode
|
120
|
-
when 'range'
|
121
|
-
slice.inject({}) {|h, chunk| h[chunk] = File.join(dir, chunk); h}
|
122
|
-
when 'part_number'
|
123
|
-
slice.inject({}) {|h, part| h[part] = File.join(dir, "part_number=#{part}"); h}
|
124
|
-
end
|
98
|
+
chunks.each_slice(@thread_count).to_a
|
125
99
|
end
|
126
100
|
|
127
101
|
def multithreaded_get_by_ranges(chunks)
|
@@ -133,32 +107,28 @@ module Aws
|
|
133
107
|
end
|
134
108
|
|
135
109
|
def thread_batches(chunks, param)
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
:bucket => @bucket,
|
147
|
-
:key => @key,
|
148
|
-
param.to_sym => chunk,
|
149
|
-
:response_target => file
|
150
|
-
)
|
151
|
-
end
|
110
|
+
batches(chunks, param).each do |batch|
|
111
|
+
threads = []
|
112
|
+
batch.each do |chunk|
|
113
|
+
threads << Thread.new do
|
114
|
+
resp = @client.get_object(
|
115
|
+
:bucket => @bucket,
|
116
|
+
:key => @key,
|
117
|
+
param.to_sym => chunk
|
118
|
+
)
|
119
|
+
write(resp)
|
152
120
|
end
|
153
|
-
threads.each(&:join)
|
154
121
|
end
|
155
|
-
|
156
|
-
ensure
|
157
|
-
# clean up tmp dir
|
158
|
-
FileUtils.remove_entry(dir)
|
122
|
+
threads.each(&:join)
|
159
123
|
end
|
160
124
|
end
|
161
125
|
|
126
|
+
def write(resp)
|
127
|
+
range, _ = resp.content_range.split(" ").last.split("/")
|
128
|
+
head, _ = range.split("-").map {|s| s.to_i}
|
129
|
+
IO.write(@path, resp.body.read, head)
|
130
|
+
end
|
131
|
+
|
162
132
|
def single_request
|
163
133
|
@client.get_object(
|
164
134
|
bucket: @bucket, key: @key, response_target: @path
|
@@ -73,7 +73,7 @@ each bucket. [Go here for more information](http://docs.aws.amazon.com/AmazonS3
|
|
73
73
|
end
|
74
74
|
|
75
75
|
def validate_bucket_name!(bucket_name)
|
76
|
-
unless BucketDns.dns_compatible?(bucket_name,
|
76
|
+
unless BucketDns.dns_compatible?(bucket_name, _ssl = true)
|
77
77
|
msg = "unable to use `accelerate: true` on buckets with "
|
78
78
|
msg << "non-DNS compatible names"
|
79
79
|
raise ArgumentError, msg
|
@@ -38,7 +38,7 @@ for all operations.
|
|
38
38
|
def apply_dualstack_endpoint(context)
|
39
39
|
bucket_name = context.params[:bucket]
|
40
40
|
region = context.config.region
|
41
|
-
|
41
|
+
context.config.force_path_style
|
42
42
|
dns_suffix = Aws::Partitions::EndpointProvider.dns_suffix_for(region)
|
43
43
|
|
44
44
|
if use_bucket_dns?(bucket_name, context)
|
data/lib/aws-sdk-s3/presigner.rb
CHANGED
data/lib/aws-sdk-s3.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aws-sdk-s3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.8.
|
4
|
+
version: 1.8.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Amazon Web Services
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-02-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-kms
|