Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: m_context.set_sending_requst([&md5_header] what does it do? #271

Open
yxiang92128 opened this issue Jul 19, 2019 · 4 comments
Open
Assignees
Labels

Comments

@yxiang92128
Copy link

Hi,

I see many blob test/examples (tests/cloud_blob_test.cpp) for instance includes the following code snippet and I couldn't figure out what it intend to do. Can somebody please explain?
utility::string_t md5_header;
m_context.set_sending_request([&md5_header] (web::http::http_request& request, azure::storage::operation_context)
{
if (!request.headers().match(web::http::header_names::content_md5, md5_header))
{
md5_header.clear();
}
});

Thanks,

Yang

@katmsft katmsft self-assigned this Jul 24, 2019
@katmsft
Copy link
Member

katmsft commented Jul 24, 2019

This is to extract the md5 header calculated on the run and evaluate it later, somewhere below the code you mentioned there is this line:

CHECK_UTF8_EQUAL(expect_md5_header ? md5 : utility::string_t(), md5_header);

This is checking that the md5_header is correctly calculated.

@yxiang92128
Copy link
Author

Thanks for the reply but I have a follow up question concerning the "ms_header_range_get_content_md5" flag in the request header when get_blob is called in
src/blob_request_factory.cpp.

I don't think the conent md5 for the range is returned anywhere in APIs specified in was/blob.h.
How do I check for that Range MD5? Is there a sample code for doing so?

thanks,

Yang

@Jinming-Hu
Copy link
Member

The range MD5 is used to validate data integrity internally and isn't exposed to user directly. If you want to check it, you can provide an operation_context parameter and check HTTP response header after the request is finished.

Take a look at
class operation_context
class operation_context::_get_impl()
class _operation_context::request_results()
class request_result::content_md5()

@Jinming-Hu
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants