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

SetContentMD5 not being set for PUT requests #2818

Closed
grantlouisherman opened this issue Jan 19, 2024 · 8 comments
Closed

SetContentMD5 not being set for PUT requests #2818

grantlouisherman opened this issue Jan 19, 2024 · 8 comments
Assignees
Labels
bug This issue is a bug. p2 This is a standard priority issue

Comments

@grantlouisherman
Copy link

grantlouisherman commented Jan 19, 2024

Describe the bug

When I try to SetContentMD5 using the S3 api for c++, the value never gets set. I have used the client directly and I am able to set the md5 content, so it must be a bug in the c++ implementation. There is a discussion open here: #2433 that describes the same issue, but it seems like this hasnt gotten any attention for a bit. There are a few issues open on Stackoverflow, https://stackoverflow.com/questions/75985503/why-s3-setcontentmd5-is-no-use-in-my-program, where the same issue is brought up.

This is a super critical API for my team so it would be great if we could get some movement on this issue.

Expected Behavior

I am able to SetContentMD5 in a PUT request

Current Behavior

The value in SetContentMD5 is ignored

Reproduction Steps

// Per the StackOverflow example listed above because I cant share company code

void put_object_buf(Aws::String& bucketName, Aws::String& objectName, S3::S3Client& s3_client)
{
    Aws::S3::Model::PutObjectRequest putObjectRequest;
    putObjectRequest.SetBucket(bucketName);

    std::shared_ptr<Aws::IOStream> bigStream = Create5MbStreamForUploadPart("La");

    putObjectRequest.SetBody(bigStream);
    putObjectRequest.SetContentLength(static_cast<long>(putObjectRequest.GetBody()->tellp()));
//    putObjectRequest.SetContentMD5(Aws::Utils::HashingUtils::Base64Encode(Aws::Utils::HashingUtils::CalculateMD5(*putObjectRequest.GetBody())));
    putObjectRequest.SetContentMD5("123");  // still put success
    putObjectRequest.SetKey(objectName);

    Aws::S3::Model::PutObjectOutcome outcome = s3_client.PutObject(putObjectRequest);

    if (!outcome.IsSuccess()) {
        std::cerr << "Error: PutObjectBuffer: " <<
                  outcome.GetError().GetMessage() << std::endl;
    }
    else {
        std::cout << "Success: Object '" << objectName << "' uploaded to bucket '" << bucketName << "'." << std::endl;
        std::cout << "outcome crc32: " << outcome.GetResult().GetChecksumCRC32() << std::endl;
        std::cout << "outcome etag: " << outcome.GetResult().GetETag() << std::endl;
    }
}

Possible Solution

No response

Additional Information/Context

No response

AWS CPP SDK version used

current

Compiler and Version used

n/a

Operating System and version

mac

@grantlouisherman grantlouisherman added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jan 19, 2024
@jmklix
Copy link
Member

jmklix commented Jan 22, 2024

Can you specify the exact version of the sdk that you are using? You said current but there have been some changes recently regarding SetContentMD5.

@jmklix jmklix added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 10 days. p2 This is a standard priority issue and removed needs-triage This issue or PR still needs to be triaged. labels Jan 22, 2024
@jmklix jmklix self-assigned this Jan 22, 2024
Copy link

Greetings! It looks like this issue hasn’t been active in longer than a week. We encourage you to check if this is still an issue in the latest release. Because it has been longer than a week since the last update on this, and in the absence of more information, we will be closing this issue soon. If you find that this is still a problem, please feel free to provide a comment or add an upvote to prevent automatic closure, or if the issue is already closed, please feel free to open a new one.

@github-actions github-actions bot added the closing-soon This issue will automatically close in 4 days unless further comments are made. label Jan 25, 2024
@grantlouisherman
Copy link
Author

@jmklix we are using C++17.

@jmklix
Copy link
Member

jmklix commented Jan 25, 2024

Can you specify the version of the sdk, not the version of C++ that you are using?

@github-actions github-actions bot removed closing-soon This issue will automatically close in 4 days unless further comments are made. response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 10 days. labels Jan 26, 2024
@grantlouisherman
Copy link
Author

Can you specify the version of the sdk, not the version of C++ that you are using?

1.33.7 AFAIK

@sbiscigl
Copy link
Contributor

sbiscigl commented Jan 26, 2024

1.33.7 AFAIK

thats not a version of the C++ SDK where are you getting that number from?

Also the fix is out in PR

@sbiscigl
Copy link
Contributor

was released today with tag 1.11.253. resolving

Copy link

This issue is now closed. Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. p2 This is a standard priority issue
Projects
None yet
Development

No branches or pull requests

3 participants