Azure / azure-storage-cpp

Microsoft Azure Storage Client Library for C++
http://azure.github.io/azure-storage-cpp
Apache License 2.0
132 stars 147 forks source link

Question: how to obtain checksum for partial content downloaded via download_range APIs? #286

Open yxiang92128 opened 5 years ago

yxiang92128 commented 5 years ago

Is there a way (via API itself or via http header) from the blob backend/Azure SDK to supply a MD5 checksum if we download a range of bytes stream from an object? ie, on receiving end, if we compute the checksum and check against the checksum from the backend, we can match or dismiss the content partially downloaded?

Thanks,

Yang

EmmaZhu commented 5 years ago

Hi Yang,

download_range_to_stream can validate range's content md5 if :

For a request to download a range, Azure Storage Server returns content-md5 from the response. In client side, we calculate the downloaded data's MD5 and compare it to the value returned from Azure Storage Server.

Is this behavior OK for your scenario?

Thanks Emma

yxiang92128 commented 5 years ago

@EmmaZhu Actually we are hoping the MD5 value to be returned to us and we can calculate the md5 in the receiving buffer and compare ourselves. Is it possible?

Jinming-Hu commented 5 years ago

Maybe related to #271 .

Also, you may want to disable checksum validation inside SDK by using blob_request_options::set_disable_content_md5_validation(true)

Jinming-Hu commented 4 years ago

We're going to close this issue because of inactivity, feel free to reopen it if you have any further questions.