azure-storage 0.11.1.preview → 0.11.2.preview
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 92ecd94693e7588079b928351edc1b8f8f9befc9
|
4
|
+
data.tar.gz: 504fedfb82e16dee909bba757984f8e788faa7b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a9c473917d6af7d6055b7b7ebb0d2f8339dd3cf99cd5e4a205cbc43edc18325c5e3697d6b452622eb60b993066ccc48b4f5d1c501ebb2dd18cc7f0a22ee71f19
|
7
|
+
data.tar.gz: 098c8642665754bbf630e83f5fcaf0132a90d15017575e3e3cb305b4e6ab1c2575d5a6c4e2a1c9dc5faa9305a9756f63bf332c6109870176e29cef8c81f4d130
|
@@ -34,6 +34,7 @@ module Azure::Storage
|
|
34
34
|
|
35
35
|
module Blob
|
36
36
|
class BlobService < StorageService
|
37
|
+
include Azure::Storage::Core::Utility
|
37
38
|
include Azure::Storage::Blob
|
38
39
|
include Azure::Storage::Blob::Container
|
39
40
|
|
@@ -43,24 +44,25 @@ module Azure::Storage
|
|
43
44
|
super(signer, client_config.storage_account_name, options)
|
44
45
|
@host = client.storage_blob_host
|
45
46
|
end
|
46
|
-
|
47
|
+
|
47
48
|
def call(method, uri, body=nil, headers={}, options={})
|
48
49
|
# Force the request.body to the content encoding of specified in the header
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
Service::StorageService.with_header headers, 'Content-Encoding', body.encoding.to_s
|
50
|
+
if headers && !body.nil? && !(body.encoding.to_s <=> 'ASCII_8BIT')
|
51
|
+
if headers['x-ms-blob-content-type'].nil?
|
52
|
+
Service::StorageService.with_header headers, 'x-ms-blob-content-type', "text/plain; charset=#{body.encoding.to_s}"
|
53
53
|
else
|
54
|
-
|
54
|
+
charset = parse_charset_from_content_type(headers['x-ms-blob-content-type'])
|
55
|
+
body.force_encoding(charset)
|
55
56
|
end
|
56
57
|
end
|
57
58
|
|
58
59
|
response = super
|
59
60
|
|
60
|
-
# Force the response.body to the content
|
61
|
-
#
|
62
|
-
if !response.nil? && !response.body.nil? && response.headers['
|
63
|
-
|
61
|
+
# Force the response.body to the content charset of specified in the header.
|
62
|
+
# Content-Type is echo'd back for the blob and is used to store the encoding of the octet stream
|
63
|
+
if !response.nil? && !response.body.nil? && response.headers['Content-Type']
|
64
|
+
charset = parse_charset_from_content_type(response.headers['Content-Type'])
|
65
|
+
response.body.force_encoding(charset) if charset && charset.length > 0
|
64
66
|
end
|
65
67
|
|
66
68
|
response
|
@@ -99,12 +101,12 @@ module Azure::Storage
|
|
99
101
|
# * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
|
100
102
|
# in the analytics logs when storage analytics logging is enabled.
|
101
103
|
#
|
104
|
+
# See: https://msdn.microsoft.com/en-us/library/azure/dd179352.aspx
|
105
|
+
#
|
102
106
|
# NOTE: Metadata requested with the :metadata parameter must have been stored in
|
103
107
|
# accordance with the naming restrictions imposed by the 2009-09-19 version of the Blob
|
104
108
|
# service. Beginning with that version, all metadata names must adhere to the naming
|
105
|
-
# conventions for C# identifiers.
|
106
|
-
#
|
107
|
-
# See: http://msdn.microsoft.com/en-us/library/aa664670(VS.71).aspx
|
109
|
+
# conventions for C# identifiers. See: https://msdn.microsoft.com/en-us/library/aa664670(VS.71).aspx
|
108
110
|
#
|
109
111
|
# Any metadata with invalid names which were previously stored, will be returned with the
|
110
112
|
# key "x-ms-invalid-name" in the metadata hash. This may contain multiple values and be an
|
@@ -115,11 +115,12 @@ module Azure::Storage::Core::Filter
|
|
115
115
|
# incrementing counter, timestamp, etc). The retry_data object
|
116
116
|
# will be the same instance throughout the lifetime of the request.
|
117
117
|
def should_retry_on_error?(response, retry_data)
|
118
|
+
response = response || retry_data[:error].http_response if retry_data[:error] && retry_data[:error].respond_to?('http_response')
|
118
119
|
unless response
|
119
120
|
retry_data[:retryable] = false unless retry_data[:error]
|
120
121
|
return retry_data[:retryable]
|
121
122
|
end
|
122
|
-
|
123
|
+
|
123
124
|
# If a request sent to the secondary location fails with 404 (Not Found), it is possible
|
124
125
|
# that the resource replication is not finished yet. So, in case of 404 only in the secondary
|
125
126
|
# location, the failure should still be retryable.
|
@@ -133,7 +134,7 @@ module Azure::Storage::Core::Filter
|
|
133
134
|
else
|
134
135
|
retry_data[:status_code] = nil
|
135
136
|
end
|
136
|
-
end
|
137
|
+
end
|
137
138
|
|
138
139
|
# Non-timeout Cases
|
139
140
|
if (retry_data[:status_code] >= 300 && retry_data[:status_code] != 408)
|
@@ -142,26 +143,26 @@ module Azure::Storage::Core::Filter
|
|
142
143
|
retry_data[:retryable] = false;
|
143
144
|
return false;
|
144
145
|
end
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
146
|
+
|
147
|
+
# When absorb_conditional_errors_on_retry is set (for append blob)
|
148
|
+
if (retry_data[:request_options] && retry_data[:request_options][:absorb_conditional_errors_on_retry])
|
149
|
+
if (retry_data[:status_code] == 412)
|
150
|
+
# When appending block with precondition failure and their was a server error before, we ignore the error.
|
151
|
+
if (retry_data[:last_server_error])
|
152
|
+
retry_data[:error] = nil;
|
153
|
+
retry_data[:retryable] = true;
|
154
|
+
else
|
155
|
+
retry_data[:retryable] = false;
|
156
|
+
end
|
157
|
+
elsif (retry_data[:retryable] && retry_data[:status_code] >= 500 && retry_data[:status_code] < 600)
|
158
|
+
# Retry on the server error
|
153
159
|
retry_data[:retryable] = true;
|
154
|
-
|
155
|
-
retry_data[:retryable] = false;
|
160
|
+
retry_data[:last_server_error] = true;
|
156
161
|
end
|
157
|
-
elsif (retry_data[:
|
158
|
-
#
|
159
|
-
retry_data[:retryable] =
|
160
|
-
retry_data[:last_server_error] = true;
|
162
|
+
elsif (retry_data[:status_code] < 500)
|
163
|
+
# No retry on the client error
|
164
|
+
retry_data[:retryable] = false;
|
161
165
|
end
|
162
|
-
elsif (retry_data[:status_code] < 500)
|
163
|
-
# No retry on the client error
|
164
|
-
retry_data[:retryable] = false;
|
165
166
|
end
|
166
167
|
end
|
167
168
|
|
@@ -107,6 +107,13 @@ module Azure::Storage
|
|
107
107
|
def initialize_external_logger(logger)
|
108
108
|
Loggerx.initialize_external_logger(logger)
|
109
109
|
end
|
110
|
+
|
111
|
+
def parse_charset_from_content_type(content_type)
|
112
|
+
if (content_type && content_type.length > 0)
|
113
|
+
charset = content_type.split(';').delete_if { |attribute| !attribute.lstrip.start_with?('charset=') }.map { |x| x.lstrip }[0]
|
114
|
+
charset['charset='.length...charset.length] if charset
|
115
|
+
end
|
116
|
+
end
|
110
117
|
end
|
111
118
|
|
112
119
|
# Logger
|
@@ -28,7 +28,7 @@ module Azure
|
|
28
28
|
# Fields represent the parts defined in http://semver.org/
|
29
29
|
MAJOR = 0 unless defined? MAJOR
|
30
30
|
MINOR = 11 unless defined? MINOR
|
31
|
-
UPDATE =
|
31
|
+
UPDATE = 2 unless defined? UPDATE
|
32
32
|
PRE = 'preview' unless defined? PRE
|
33
33
|
|
34
34
|
class << self
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: azure-storage
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.11.
|
4
|
+
version: 0.11.2.preview
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Microsoft Corporation
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-10-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|