lib/azure/blob/blob_service.rb in azure-0.7.0 vs lib/azure/blob/blob_service.rb in azure-0.7.1

- old
+ new

@@ -243,11 +243,11 @@ # ==== Options # # Accepted key/value pairs in options parameter are: # * +:signed_identifiers+ - Array. A list of Azure::Entity::SignedIdentifier instances (optional) # * +:timeout+ - Integer. A timeout in seconds. - # + # # See http://msdn.microsoft.com/en-us/library/azure/dd179391.aspx # # Returns a tuple of (container, signed_identifiers) # * +container+ - A Azure::Entity::Blob::Container instance # * +signed_identifiers+ - A list of Azure::Entity::SignedIdentifier instances @@ -470,11 +470,11 @@ # * +:if_modified_since+ - A DateTime value. Specify this conditional header to write the page only if the blob has been modified since the specified date/time. If the blob has not been modified, the Blob service returns status code 412 (Precondition Failed). # * +:if_unmodified_since+ - A DateTime value. Specify this conditional header to write the page only if the blob has not been modified since the specified date/time. If the blob has been modified, the Blob service returns status code 412 (Precondition Failed). # * +:if_match+ - An ETag value. Specify an ETag value for this conditional header to write the page only if the blob's ETag value matches the value specified. If the values do not match, the Blob service returns status code 412 (Precondition Failed). # * +:if_none_match+ - An ETag value. Specify an ETag value for this conditional header to write the page only if the blob's ETag value does not match the value specified. If the values are identical, the Blob service returns status code 412 (Precondition Failed). # * +:timeout+ - Integer. A timeout in seconds. - # + # # See http://msdn.microsoft.com/en-us/library/azure/ee691975.aspx # # Returns Blob def create_blob_pages(container, blob, start_range, end_range, content, options={}) query = { 'comp' => 'page'} @@ -685,11 +685,11 @@ # * +:blob_content_md5+ - String. Content MD5 for the blob. Will be saved with blob. # * +:blob_cache_control+ - String. Cache control for the blob. Will be saved with blob. # * +:metadata+ - Hash. Custom metadata values to store with the blob. # * +:timeout+ - Integer. A timeout in seconds. # - # See http://msdn.microsoft.com/en-us/library/azure/dd179467.aspx + # See http://msdn.microsoft.com/en-us/library/azure/dd179467.aspx # # Returns nil on success def commit_blob_blocks(container, blob, block_list, options={}) query = { 'comp' => 'blocklist'} query['timeout'] = options[:timeout].to_s if options[:timeout] @@ -717,12 +717,12 @@ # Public: Retrieves the list of blocks that have been uploaded as part of a block blob. # # There are two block lists maintained for a blob: # 1) Committed Block List: The list of blocks that have been successfully # committed to a given blob with commitBlobBlocks. - # 2) Uncommitted Block List: The list of blocks that have been uploaded for a - # blob using Put Block (REST API), but that have not yet been committed. + # 2) Uncommitted Block List: The list of blocks that have been uploaded for a + # blob using Put Block (REST API), but that have not yet been committed. # These blocks are stored in Microsoft Azure in association with a blob, but do # not yet form part of the blob. # # ==== Attributes # @@ -1365,17 +1365,22 @@ response = call(:put, uri, nil, headers) response.headers['x-ms-lease-time'].to_i end def call(method, uri, body=nil, headers=nil) - # Force the request.body to the content encoding of specified in the header - # (content encoding probably shouldn't be used this way) + # Synchronize body and header encoding; header['Content-Encoding'] takes precedence. if headers && !body.nil? if headers['Content-Encoding'].nil? - headers['Content-Encoding'] = body.encoding.to_s + headers['Content-Encoding'] = body.encoding.to_s if body.respond_to? :encoding # String + headers['Content-Encoding'] = body.external_encoding.to_s if body.respond_to? :external_encoding # IO else - body.force_encoding(headers['Content-Encoding']) + body.force_encoding(headers['Content-Encoding']) if body.respond_to? :force_encoding # String + body.set_encoding(headers['Content-Encoding']) if body.respond_to? :set_encoding # IO end + + # Azure Storage Service expects content-encoding to be lowercase. + # Authentication will fail otherwise. + headers['Content-Encoding'].downcase! end response = super # Force the response.body to the content encoding of specified in the header. \ No newline at end of file