[File][UpdateRange]Update Range from File URL

This commit is to update range for a specific file directly from existing file. No need to download first then update range for a file.
This commit is contained in:
xiafu 2019-06-26 15:14:47 -07:00 коммит произвёл Xiaoxi Fu
Родитель 266928ada4
Коммит 10c687ba36
8 изменённых файлов: 1329 добавлений и 13 удалений

Просмотреть файл

@ -2,6 +2,9 @@
> See [BreakingChanges](BreakingChanges.md) for a detailed list of API breaks.
## Version XX.XX.XX
- Added update_range_from_file_url API to writes the bytes from one Azure File endpoint into the specified range of another Azure File endpoint.
## Version 2.0.1:
- Updated dependency on azure-storage-common.

Просмотреть файл

@ -8,4 +8,4 @@ __author__ = 'Microsoft Corp. <ptvshelp@microsoft.com>'
__version__ = '2.0.1'
# x-ms-version for storage service.
X_MS_VERSION = '2018-11-09'
X_MS_VERSION = '2019-02-02'

Просмотреть файл

@ -42,7 +42,7 @@ def _get_path(share_name=None, directory_name=None, file_name=None):
def _validate_and_format_range_headers(request, start_range, end_range, start_range_required=True,
end_range_required=True, check_content_md5=False):
end_range_required=True, check_content_md5=False, is_source=False):
# If end range is provided, start range must be provided
if start_range_required or end_range is not None:
_validate_not_none('start_range', start_range)
@ -51,10 +51,11 @@ def _validate_and_format_range_headers(request, start_range, end_range, start_ra
# Format based on whether end_range is present
request.headers = request.headers or {}
header_name = 'x-ms-source-range' if is_source else 'x-ms-range'
if end_range is not None:
request.headers['x-ms-range'] = 'bytes={0}-{1}'.format(start_range, end_range)
request.headers[header_name] = 'bytes={0}-{1}'.format(start_range, end_range)
elif start_range is not None:
request.headers['x-ms-range'] = 'bytes={0}-'.format(start_range)
request.headers[header_name] = 'bytes={0}-'.format(start_range)
# Content MD5 can only be provided for a complete range less than 4MB in size
if check_content_md5:

Просмотреть файл

@ -2582,9 +2582,76 @@ class FileService(StorageClient):
:param int timeout:
The timeout parameter is expressed in seconds.
'''
request = self._get_basic_update_file_http_request(share_name, directory_name, file_name, timeout=timeout)
_validate_not_none('data', data)
_validate_and_format_range_headers(request, start_range, end_range)
request.body = _get_data_bytes_only('data', data)
if validate_content:
computed_md5 = _get_content_md5(request.body)
request.headers['Content-MD5'] = _to_str(computed_md5)
self._perform_request(request)
def update_range_from_file_url(self, share_name, directory_name, file_name, start_range, end_range, source,
source_start_range, timeout=None):
'''
Writes the bytes from one Azure File endpoint into the specified range of another Azure File endpoint.
:param str share_name:
Name of existing share.
:param str directory_name:
The path to the directory.
:param str file_name:
Name of existing file.
:param int start_range:
Start of byte range to use for updating a section of the file.
The range can be up to 4 MB in size.
The start_range and end_range params are inclusive.
Ex: start_range=0, end_range=511 will download first 512 bytes of file.
:param int end_range:
End of byte range to use for updating a section of the file.
The range can be up to 4 MB in size.
The start_range and end_range params are inclusive.
Ex: start_range=0, end_range=511 will download first 512 bytes of file.
:param str source:
A URL of up to 2 KB in length that specifies an Azure file or blob.
The value should be URL-encoded as it would appear in a request URI.
If the source is in another account, the source must either be public
or must be authenticated via a shared access signature. If the source
is public, no authentication is required.
Examples:
https://myaccount.file.core.windows.net/myshare/mydir/myfile
https://otheraccount.file.core.windows.net/myshare/mydir/myfile?sastoken
:param int source_start_range:
Start of byte range to use for updating a section of the file.
The range can be up to 4 MB in size.
The start_range and end_range params are inclusive.
Ex: start_range=0, end_range=511 will download first 512 bytes of file.
:param int timeout:
The timeout parameter is expressed in seconds.
'''
request = self._get_basic_update_file_http_request(share_name, directory_name, file_name, timeout=timeout)
_validate_not_none('source', source)
_validate_and_format_range_headers(request, start_range, end_range)
_validate_and_format_range_headers(request,
source_start_range,
source_start_range+(end_range-start_range),
is_source=True)
request.headers.update({
'x-ms-copy-source': _to_str(source),
'Content-Length': _int_to_str(0)
})
self._perform_request(request)
def _get_basic_update_file_http_request(self, share_name, directory_name, file_name, timeout=None):
_validate_not_none('share_name', share_name)
_validate_not_none('file_name', file_name)
_validate_not_none('data', data)
request = HTTPRequest()
request.method = 'PUT'
request.host_locations = self._get_host_locations()
@ -2596,15 +2663,8 @@ class FileService(StorageClient):
request.headers = {
'x-ms-write': 'update',
}
_validate_and_format_range_headers(
request, start_range, end_range)
request.body = _get_data_bytes_only('data', data)
if validate_content:
computed_md5 = _get_content_md5(request.body)
request.headers['Content-MD5'] = _to_str(computed_md5)
self._perform_request(request)
return request
def clear_range(self, share_name, directory_name, file_name, start_range,
end_range, timeout=None):

Просмотреть файл

@ -435,6 +435,108 @@ class StorageFileTest(StorageTestCase):
# Assert
@record
def test_update_range_from_file_url_when_source_file_does_not_have_enough_bytes(self):
# Arrange
share_name = "sprasa-test"
source_file_name = 'testfile1'
self.fs.create_file(share_name, None, source_file_name, 2048)
data = b'abcdefghijklmnop' * 32
self.fs.update_range(share_name, None, source_file_name, data, 0, 511)
file_name = 'filetoupdate'
self.fs.create_file(share_name, None, file_name, 2048)
# generate SAS for the source file
sas_token_for_source_file = \
self.fs.generate_file_shared_access_signature(share_name,
None,
source_file_name,
FilePermissions.READ,
expiry=datetime.utcnow() + timedelta(hours=1))
source_file_url = self.fs.make_file_url(share_name, None, source_file_name, sas_token=sas_token_for_source_file)
# Act
with self.assertRaises(AzureHttpError):
# when the source file has less bytes than 2050, throw exception
self.fs.update_range_from_file_url(share_name, None, file_name, 0, 2049, source_file_url,
source_start_range=0)
@record
def test_update_range_from_file_url(self):
# Arrange
share_name = "sprasa-test"
source_file_name = 'testfile'
self.fs.create_file(share_name, None, source_file_name, 2048)
data = b'abcdefghijklmnop' * 32
self.fs.update_range(share_name, None, source_file_name, data, 0, 511)
file_name = 'filetoupdate'
self.fs.create_file(share_name, None, file_name, 2048)
# generate SAS for the source file
sas_token_for_source_file = \
self.fs.generate_file_shared_access_signature(share_name,
None,
source_file_name,
FilePermissions.READ,
expiry=datetime.utcnow() + timedelta(hours=1))
source_file_url = self.fs.make_file_url(share_name, None, source_file_name, sas_token=sas_token_for_source_file)
# Act
self.fs.update_range_from_file_url(share_name, None, file_name, 0, 511, source_file_url,
source_start_range=0)
# Assert
# To make sure the range of the file is actually updated
file_ranges = self.fs.list_ranges(share_name, None, file_name)
file = self.fs.get_file_to_bytes(share_name, None, file_name, 0, 511)
self.assertEquals(1, len(file_ranges))
self.assertEquals(0, file_ranges[0].start)
self.assertEquals(511, file_ranges[0].end)
self.assertEquals(data, file.content)
@record
def test_update_big_range_from_file_url(self):
# Arrange
share_name = "sprasa-test"
source_file_name = 'testfile1'
end = 1048575
self.fs.create_file(share_name, None, source_file_name, 1024 * 1024)
data = b'abcdefghijklmnop' * 65536
self.fs.update_range(share_name, None, source_file_name, data, 0, end)
file_name = 'filetoupdate1'
self.fs.create_file(share_name, None, file_name, 1024 * 1024)
# generate SAS for the source file
sas_token_for_source_file = \
self.fs.generate_file_shared_access_signature(share_name,
None,
source_file_name,
FilePermissions.READ,
expiry=datetime.utcnow() + timedelta(hours=1))
source_file_url = self.fs.make_file_url(share_name, None, source_file_name, sas_token=sas_token_for_source_file)
# Act
self.fs.update_range_from_file_url(share_name, None, file_name, 0, end, source_file_url,
source_start_range=0)
# Assert
# To make sure the range of the file is actually updated
file_ranges = self.fs.list_ranges(share_name, None, file_name)
file = self.fs.get_file_to_bytes(share_name, None, file_name, 0, end)
self.assertEquals(1, len(file_ranges))
self.assertEquals(0, file_ranges[0].start)
self.assertEquals(end, file_ranges[0].end)
self.assertEquals(data, file.content)
@record
def test_clear_range(self):
# Arrange

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Просмотреть файл

@ -0,0 +1,687 @@
interactions:
- request:
body: null
headers:
Connection:
- keep-alive
Content-Length:
- '0'
User-Agent:
- Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.3; Windows 10)
x-ms-client-request-id:
- ecdfe910-985e-11e9-8a74-001a7dda7113
x-ms-copy-source:
- https://stagesctewz1.file.core.windows.net/sprasa-test/testfile?se=2019-06-26T23%3A08%3A27Z&sp=r&sv=2019-02-02&sr=f&sig=fClZ3P8Q7pdAZWaeZN0l6bCuxcXnzYGeyW%2BW6OdrCnc%3D
x-ms-date:
- Wed, 26 Jun 2019 22:08:27 GMT
x-ms-range:
- bytes=0-511
x-ms-source-range:
- bytes=0-511
x-ms-version:
- '2019-02-02'
x-ms-write:
- update
method: PUT
uri: https://storagename.file.core.windows.net/sprasa-test/filetoupdate?comp=range
response:
body:
string: ''
headers:
Content-Length:
- '0'
Date:
- Wed, 26 Jun 2019 22:08:28 GMT
ETag:
- '"0x8D6FA82D17BDC3A"'
Last-Modified:
- Wed, 26 Jun 2019 22:08:28 GMT
Server:
- Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0
x-ms-client-request-id:
- ecdfe910-985e-11e9-8a74-001a7dda7113
x-ms-content-crc64:
- EZA9hgZaRrQ=
x-ms-request-id:
- c4d70da6-101a-0025-706b-2c3b47000000
x-ms-request-server-encrypted:
- 'true'
x-ms-version:
- '2019-02-02'
status:
code: 201
message: Created
- request:
body: null
headers:
Connection:
- keep-alive
User-Agent:
- Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.3; Windows 10)
x-ms-client-request-id:
- ed4df7be-985e-11e9-8035-001a7dda7113
x-ms-date:
- Wed, 26 Jun 2019 22:08:28 GMT
x-ms-version:
- '2019-02-02'
method: GET
uri: https://storagename.file.core.windows.net/sprasa-test/filetoupdate?comp=rangelist
response:
body:
string: "\uFEFF<?xml version=\"1.0\" encoding=\"utf-8\"?><Ranges><Range><Start>0</Start><End>511</End></Range></Ranges>"
headers:
Content-Type:
- application/xml
Date:
- Wed, 26 Jun 2019 22:08:28 GMT
ETag:
- '"0x8D6FA82D17BDC3A"'
Last-Modified:
- Wed, 26 Jun 2019 22:08:28 GMT
Server:
- Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0
Transfer-Encoding:
- chunked
x-ms-client-request-id:
- ed4df7be-985e-11e9-8035-001a7dda7113
x-ms-content-length:
- '2048'
x-ms-request-id:
- c4d70dab-101a-0025-746b-2c3b47000000
x-ms-version:
- '2019-02-02'
status:
code: 200
message: OK
- request:
body: null
headers:
Connection:
- keep-alive
Content-Length:
- '0'
User-Agent:
- Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.3; Windows 10)
x-ms-client-request-id:
- 5efbe0be-985f-11e9-b40e-001a7dda7113
x-ms-copy-source:
- https://stagesctewz1.file.core.windows.net/sprasa-test/testfile?se=2019-06-26T23%3A11%3A39Z&sp=r&sv=2019-02-02&sr=f&sig=IZre3XNUJjeSlgCwj4kWXRlTBaqfaJPYmthl34cjmTs%3D
x-ms-date:
- Wed, 26 Jun 2019 22:11:39 GMT
x-ms-range:
- bytes=0-511
x-ms-source-range:
- bytes=0-511
x-ms-version:
- '2019-02-02'
x-ms-write:
- update
method: PUT
uri: https://storagename.file.core.windows.net/sprasa-test/filetoupdate?comp=range
response:
body:
string: ''
headers:
Content-Length:
- '0'
Date:
- Wed, 26 Jun 2019 22:11:39 GMT
ETag:
- '"0x8D6FA83437AF81B"'
Last-Modified:
- Wed, 26 Jun 2019 22:11:39 GMT
Server:
- Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0
x-ms-client-request-id:
- 5efbe0be-985f-11e9-b40e-001a7dda7113
x-ms-content-crc64:
- EZA9hgZaRrQ=
x-ms-request-id:
- ed14036e-f01a-002d-2e6c-2c2148000000
x-ms-request-server-encrypted:
- 'true'
x-ms-version:
- '2019-02-02'
status:
code: 201
message: Created
- request:
body: null
headers:
Connection:
- keep-alive
User-Agent:
- Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.3; Windows 10)
x-ms-client-request-id:
- 5f4dc3ec-985f-11e9-8aa6-001a7dda7113
x-ms-date:
- Wed, 26 Jun 2019 22:11:39 GMT
x-ms-version:
- '2019-02-02'
method: GET
uri: https://storagename.file.core.windows.net/sprasa-test/filetoupdate?comp=rangelist
response:
body:
string: "\uFEFF<?xml version=\"1.0\" encoding=\"utf-8\"?><Ranges><Range><Start>0</Start><End>511</End></Range></Ranges>"
headers:
Content-Type:
- application/xml
Date:
- Wed, 26 Jun 2019 22:11:39 GMT
ETag:
- '"0x8D6FA83437AF81B"'
Last-Modified:
- Wed, 26 Jun 2019 22:11:39 GMT
Server:
- Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0
Transfer-Encoding:
- chunked
x-ms-client-request-id:
- 5f4dc3ec-985f-11e9-8aa6-001a7dda7113
x-ms-content-length:
- '2048'
x-ms-request-id:
- ed140374-f01a-002d-316c-2c2148000000
x-ms-version:
- '2019-02-02'
status:
code: 200
message: OK
- request:
body: null
headers:
Connection:
- keep-alive
Content-Length:
- '0'
User-Agent:
- Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.3; Windows 10)
x-ms-client-request-id:
- 146fcf12-a06c-11e9-8107-001a7dda7113
x-ms-content-length:
- '2048'
x-ms-date:
- Sun, 07 Jul 2019 04:02:47 GMT
x-ms-type:
- file
x-ms-version:
- '2018-11-09'
method: PUT
uri: https://storagename.file.core.windows.net/sprasa-test/testfile
response:
body:
string: ''
headers:
Content-Length:
- '0'
Date:
- Sun, 07 Jul 2019 04:02:46 GMT
ETag:
- '"0x8D7028FF8D469CE"'
Last-Modified:
- Sun, 07 Jul 2019 04:02:47 GMT
Server:
- Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0
x-ms-request-id:
- b547648f-c01a-0026-4378-34da23000000
x-ms-request-server-encrypted:
- 'true'
x-ms-version:
- '2018-11-09'
status:
code: 201
message: Created
- request:
body: abcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnop
headers:
Connection:
- keep-alive
Content-Length:
- '512'
User-Agent:
- Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.3; Windows 10)
x-ms-client-request-id:
- 14a7f902-a06c-11e9-b992-001a7dda7113
x-ms-date:
- Sun, 07 Jul 2019 04:02:47 GMT
x-ms-range:
- bytes=0-511
x-ms-version:
- '2018-11-09'
x-ms-write:
- update
method: PUT
uri: https://storagename.file.core.windows.net/sprasa-test/testfile?comp=range
response:
body:
string: ''
headers:
Content-Length:
- '0'
Content-MD5:
- pTsTLZHyQ+et6NksJ1OHxg==
Date:
- Sun, 07 Jul 2019 04:02:47 GMT
ETag:
- '"0x8D7028FF8E2C1AD"'
Last-Modified:
- Sun, 07 Jul 2019 04:02:47 GMT
Server:
- Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0
x-ms-request-id:
- b5476499-c01a-0026-4d78-34da23000000
x-ms-request-server-encrypted:
- 'true'
x-ms-version:
- '2018-11-09'
status:
code: 201
message: Created
- request:
body: null
headers:
Connection:
- keep-alive
Content-Length:
- '0'
User-Agent:
- Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.3; Windows 10)
x-ms-client-request-id:
- 14b6950c-a06c-11e9-8a91-001a7dda7113
x-ms-content-length:
- '2048'
x-ms-date:
- Sun, 07 Jul 2019 04:02:47 GMT
x-ms-type:
- file
x-ms-version:
- '2018-11-09'
method: PUT
uri: https://storagename.file.core.windows.net/sprasa-test/filetoupdate
response:
body:
string: ''
headers:
Content-Length:
- '0'
Date:
- Sun, 07 Jul 2019 04:02:47 GMT
ETag:
- '"0x8D7028FF8F167A8"'
Last-Modified:
- Sun, 07 Jul 2019 04:02:47 GMT
Server:
- Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0
x-ms-request-id:
- b547649e-c01a-0026-5278-34da23000000
x-ms-request-server-encrypted:
- 'true'
x-ms-version:
- '2018-11-09'
status:
code: 201
message: Created
- request:
body: null
headers:
Connection:
- keep-alive
Content-Length:
- '0'
User-Agent:
- Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.3; Windows 10)
x-ms-client-request-id:
- a93e46be-a06d-11e9-b046-001a7dda7113
x-ms-content-length:
- '2048'
x-ms-date:
- Sun, 07 Jul 2019 04:14:06 GMT
x-ms-type:
- file
x-ms-version:
- '2018-11-09'
method: PUT
uri: https://storagename.file.core.windows.net/sprasa-test/testfile
response:
body:
string: ''
headers:
Content-Length:
- '0'
Date:
- Sun, 07 Jul 2019 04:14:05 GMT
ETag:
- '"0x8D702918DA37510"'
Last-Modified:
- Sun, 07 Jul 2019 04:14:06 GMT
Server:
- Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0
x-ms-request-id:
- 8e463378-b01a-002c-1e7a-347e94000000
x-ms-request-server-encrypted:
- 'true'
x-ms-version:
- '2018-11-09'
status:
code: 201
message: Created
- request:
body: abcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnop
headers:
Connection:
- keep-alive
Content-Length:
- '512'
User-Agent:
- Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.3; Windows 10)
x-ms-client-request-id:
- a977875e-a06d-11e9-a6bc-001a7dda7113
x-ms-date:
- Sun, 07 Jul 2019 04:14:06 GMT
x-ms-range:
- bytes=0-511
x-ms-version:
- '2018-11-09'
x-ms-write:
- update
method: PUT
uri: https://storagename.file.core.windows.net/sprasa-test/testfile?comp=range
response:
body:
string: ''
headers:
Content-Length:
- '0'
Content-MD5:
- pTsTLZHyQ+et6NksJ1OHxg==
Date:
- Sun, 07 Jul 2019 04:14:05 GMT
ETag:
- '"0x8D702918DB1CD0A"'
Last-Modified:
- Sun, 07 Jul 2019 04:14:06 GMT
Server:
- Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0
x-ms-request-id:
- 8e463379-b01a-002c-1f7a-347e94000000
x-ms-request-server-encrypted:
- 'true'
x-ms-version:
- '2018-11-09'
status:
code: 201
message: Created
- request:
body: null
headers:
Connection:
- keep-alive
Content-Length:
- '0'
User-Agent:
- Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.3; Windows 10)
x-ms-client-request-id:
- a9862eee-a06d-11e9-a66f-001a7dda7113
x-ms-content-length:
- '2048'
x-ms-date:
- Sun, 07 Jul 2019 04:14:06 GMT
x-ms-type:
- file
x-ms-version:
- '2018-11-09'
method: PUT
uri: https://storagename.file.core.windows.net/sprasa-test/filetoupdate
response:
body:
string: ''
headers:
Content-Length:
- '0'
Date:
- Sun, 07 Jul 2019 04:14:06 GMT
ETag:
- '"0x8D702918DC30B1A"'
Last-Modified:
- Sun, 07 Jul 2019 04:14:06 GMT
Server:
- Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0
x-ms-request-id:
- 8e46337b-b01a-002c-217a-347e94000000
x-ms-request-server-encrypted:
- 'true'
x-ms-version:
- '2018-11-09'
status:
code: 201
message: Created
- request:
body: null
headers:
Connection:
- keep-alive
Content-Length:
- '0'
User-Agent:
- Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.3; Windows 10)
x-ms-client-request-id:
- c314fad4-a06d-11e9-b72b-001a7dda7113
x-ms-content-length:
- '2048'
x-ms-date:
- Sun, 07 Jul 2019 04:14:49 GMT
x-ms-type:
- file
x-ms-version:
- '2018-11-09'
method: PUT
uri: https://storagename.file.core.windows.net/sprasa-test/testfile
response:
body:
string: ''
headers:
Content-Length:
- '0'
Date:
- Sun, 07 Jul 2019 04:14:49 GMT
ETag:
- '"0x8D70291A77C5360"'
Last-Modified:
- Sun, 07 Jul 2019 04:14:49 GMT
Server:
- Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0
x-ms-request-id:
- 587e715f-d01a-0015-597a-348588000000
x-ms-request-server-encrypted:
- 'true'
x-ms-version:
- '2018-11-09'
status:
code: 201
message: Created
- request:
body: abcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnop
headers:
Connection:
- keep-alive
Content-Length:
- '512'
User-Agent:
- Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.3; Windows 10)
x-ms-client-request-id:
- c350a780-a06d-11e9-a1f9-001a7dda7113
x-ms-date:
- Sun, 07 Jul 2019 04:14:50 GMT
x-ms-range:
- bytes=0-511
x-ms-version:
- '2018-11-09'
x-ms-write:
- update
method: PUT
uri: https://storagename.file.core.windows.net/sprasa-test/testfile?comp=range
response:
body:
string: ''
headers:
Content-Length:
- '0'
Content-MD5:
- pTsTLZHyQ+et6NksJ1OHxg==
Date:
- Sun, 07 Jul 2019 04:14:49 GMT
ETag:
- '"0x8D70291A78D916E"'
Last-Modified:
- Sun, 07 Jul 2019 04:14:50 GMT
Server:
- Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0
x-ms-request-id:
- 587e7167-d01a-0015-607a-348588000000
x-ms-request-server-encrypted:
- 'true'
x-ms-version:
- '2018-11-09'
status:
code: 201
message: Created
- request:
body: null
headers:
Connection:
- keep-alive
Content-Length:
- '0'
User-Agent:
- Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.3; Windows 10)
x-ms-client-request-id:
- c361e8de-a06d-11e9-b3ef-001a7dda7113
x-ms-content-length:
- '2048'
x-ms-date:
- Sun, 07 Jul 2019 04:14:50 GMT
x-ms-type:
- file
x-ms-version:
- '2018-11-09'
method: PUT
uri: https://storagename.file.core.windows.net/sprasa-test/filetoupdate
response:
body:
string: ''
headers:
Content-Length:
- '0'
Date:
- Sun, 07 Jul 2019 04:14:49 GMT
ETag:
- '"0x8D70291A79D9712"'
Last-Modified:
- Sun, 07 Jul 2019 04:14:50 GMT
Server:
- Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0
x-ms-request-id:
- 587e716d-d01a-0015-667a-348588000000
x-ms-request-server-encrypted:
- 'true'
x-ms-version:
- '2018-11-09'
status:
code: 201
message: Created
- request:
body: null
headers:
Connection:
- keep-alive
Content-Length:
- '0'
User-Agent:
- Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.3; Windows 10)
x-ms-client-request-id:
- c371d654-a06d-11e9-b30d-001a7dda7113
x-ms-copy-source:
- https://stagesctewz1.file.core.windows.net/sprasa-test/testfile?se=2019-07-07T05%3A14%3A50Z&sp=r&sv=2018-11-09&sr=f&sig=IKIgpcWB7oDjPUZH7xbBWUcKuXAzW6HIa9Q3/sfiqnc%3D
x-ms-date:
- Sun, 07 Jul 2019 04:14:50 GMT
x-ms-range:
- bytes=0-511
x-ms-source-range:
- bytes=0-511
x-ms-version:
- '2018-11-09'
x-ms-write:
- update
method: PUT
uri: https://storagename.file.core.windows.net/sprasa-test/filetoupdate?comp=range
response:
body:
string: "\uFEFF<?xml version=\"1.0\" encoding=\"utf-8\"?><Error><Code>InvalidHeaderValue</Code><Message>The
value for one of the HTTP headers is not in the correct format.\nRequestId:587e7172-d01a-0015-6b7a-348588000000\nTime:2019-07-07T04:14:50.2763250Z</Message><HeaderName>Content-Length</HeaderName><HeaderValue>0</HeaderValue></Error>"
headers:
Content-Length:
- '321'
Content-Type:
- application/xml
Date:
- Sun, 07 Jul 2019 04:14:49 GMT
Server:
- Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0
x-ms-error-code:
- InvalidHeaderValue
x-ms-request-id:
- 587e7172-d01a-0015-6b7a-348588000000
x-ms-version:
- '2018-11-09'
status:
code: 400
message: The value for one of the HTTP headers is not in the correct format.
- request:
body: null
headers:
Connection:
- keep-alive
User-Agent:
- Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.3; Windows 10)
x-ms-client-request-id:
- 3deb694c-a072-11e9-87a5-001a7dda7113
x-ms-date:
- Sun, 07 Jul 2019 04:46:53 GMT
x-ms-range:
- bytes=0-511
x-ms-version:
- '2018-11-09'
method: GET
uri: https://storagename.file.core.windows.net/sprasa-test/filetoupdate
response:
body:
string: abcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnop
headers:
Accept-Ranges:
- bytes
Content-Length:
- '512'
Content-Range:
- bytes 0-511/2048
Content-Type:
- application/octet-stream
Date:
- Sun, 07 Jul 2019 04:46:53 GMT
ETag:
- '"0x8D702959D130857"'
Last-Modified:
- Sun, 07 Jul 2019 04:43:10 GMT
Server:
- Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0
x-ms-request-id:
- 588014f6-d01a-0015-247e-348588000000
x-ms-server-encrypted:
- 'true'
x-ms-type:
- File
x-ms-version:
- '2018-11-09'
status:
code: 206
message: Partial Content
version: 1

Просмотреть файл

@ -0,0 +1,187 @@
interactions:
- request:
body: null
headers:
Connection:
- keep-alive
Content-Length:
- '0'
User-Agent:
- Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.3; Windows 10)
x-ms-client-request-id:
- 690ea92e-a3ab-11e9-b37e-001a7dda7113
x-ms-content-length:
- '2048'
x-ms-date:
- Thu, 11 Jul 2019 07:13:40 GMT
x-ms-type:
- file
x-ms-version:
- '2018-11-09'
method: PUT
uri: https://storagename.file.core.windows.net/sprasa-test/testfile1
response:
body:
string: ''
headers:
Content-Length:
- '0'
Date:
- Thu, 11 Jul 2019 07:13:40 GMT
ETag:
- '"0x8D705CF4D8AA2FA"'
Last-Modified:
- Thu, 11 Jul 2019 07:13:41 GMT
Server:
- Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0
x-ms-request-id:
- ec63a3f7-401a-0007-78b8-37fe58000000
x-ms-request-server-encrypted:
- 'true'
x-ms-version:
- '2018-11-09'
status:
code: 201
message: Created
- request:
body: abcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnop
headers:
Connection:
- keep-alive
Content-Length:
- '512'
User-Agent:
- Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.3; Windows 10)
x-ms-client-request-id:
- 69649e0c-a3ab-11e9-b46e-001a7dda7113
x-ms-date:
- Thu, 11 Jul 2019 07:13:41 GMT
x-ms-range:
- bytes=0-511
x-ms-version:
- '2018-11-09'
x-ms-write:
- update
method: PUT
uri: https://storagename.file.core.windows.net/sprasa-test/testfile1?comp=range
response:
body:
string: ''
headers:
Content-Length:
- '0'
Content-MD5:
- pTsTLZHyQ+et6NksJ1OHxg==
Date:
- Thu, 11 Jul 2019 07:13:40 GMT
ETag:
- '"0x8D705CF4DA0E9F2"'
Last-Modified:
- Thu, 11 Jul 2019 07:13:41 GMT
Server:
- Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0
x-ms-request-id:
- ec63a3fb-401a-0007-7bb8-37fe58000000
x-ms-request-server-encrypted:
- 'true'
x-ms-version:
- '2018-11-09'
status:
code: 201
message: Created
- request:
body: null
headers:
Connection:
- keep-alive
Content-Length:
- '0'
User-Agent:
- Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.3; Windows 10)
x-ms-client-request-id:
- 6973eab6-a3ab-11e9-8a65-001a7dda7113
x-ms-content-length:
- '2048'
x-ms-date:
- Thu, 11 Jul 2019 07:13:41 GMT
x-ms-type:
- file
x-ms-version:
- '2018-11-09'
method: PUT
uri: https://storagename.file.core.windows.net/sprasa-test/filetoupdate
response:
body:
string: ''
headers:
Content-Length:
- '0'
Date:
- Thu, 11 Jul 2019 07:13:40 GMT
ETag:
- '"0x8D705CF4DAF6AD6"'
Last-Modified:
- Thu, 11 Jul 2019 07:13:41 GMT
Server:
- Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0
x-ms-request-id:
- ec63a3fd-401a-0007-7cb8-37fe58000000
x-ms-request-server-encrypted:
- 'true'
x-ms-version:
- '2018-11-09'
status:
code: 201
message: Created
- request:
body: null
headers:
Connection:
- keep-alive
Content-Length:
- '0'
User-Agent:
- Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.3; Windows 10)
x-ms-client-request-id:
- 9c6b5f00-a3ab-11e9-995c-001a7dda7113
x-ms-copy-source:
- https://stagesctewz1.file.core.windows.net/sprasa-test/testfile1?se=2019-07-11T08%3A15%3A07Z&sp=r&sv=2019-02-02&sr=f&sig=U1DmE8l71K%2BfbpNOLw8qcepkgjDVhCBp5EwE3lKfdcU%3D
x-ms-date:
- Thu, 11 Jul 2019 07:15:07 GMT
x-ms-range:
- bytes=0-2049
x-ms-source-range:
- bytes=0-2049
x-ms-version:
- '2019-02-02'
x-ms-write:
- update
method: PUT
uri: https://storagename.file.core.windows.net/sprasa-test/filetoupdate?comp=range
response:
body:
string: "\uFEFF<?xml version=\"1.0\" encoding=\"utf-8\"?><Error><Code>CannotVerifyCopySource</Code><Message>The
source request body for copy source does not match requested length to write
on target.\nRequestId:ff77f469-401a-0028-2ab8-37f393000000\nTime:2019-07-11T07:15:07.8504939Z</Message></Error>"
headers:
Content-Length:
- '282'
Content-Type:
- application/xml
Date:
- Thu, 11 Jul 2019 07:15:06 GMT
Server:
- Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0
x-ms-client-request-id:
- 9c6b5f00-a3ab-11e9-995c-001a7dda7113
x-ms-error-code:
- CannotVerifyCopySource
x-ms-request-id:
- ff77f469-401a-0028-2ab8-37f393000000
x-ms-version:
- '2019-02-02'
status:
code: 409
message: The source request body for copy source does not match requested length
to write on target.
version: 1