Skip to content

Commit

Permalink
dont re-allocate sigv4a signer each request
Browse files Browse the repository at this point in the history
  • Loading branch information
sbiscigl committed Sep 23, 2024
1 parent d91b82e commit eba05ff
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ namespace Aws
mutable Utils::Threading::ReaderWriterLock m_partialSignatureLock;
PayloadSigningPolicy m_payloadSigningPolicy;
bool m_urlEscapePath;
mutable Aws::Crt::Auth::Sigv4HttpRequestSigner m_crtSigner{};
};
} // namespace Client
} // namespace Aws
Expand Down
4 changes: 1 addition & 3 deletions src/aws-cpp-sdk-core/source/auth/signer/AWSAuthV4Signer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,8 @@ bool AWSAuthV4Signer::SignRequestWithSigV4a(Aws::Http::HttpRequest& request, con
awsSigningConfig.SetCredentials(crtCredentials);

std::shared_ptr<Aws::Crt::Http::HttpRequest> crtHttpRequest = request.ToCrtHttpRequest();

auto sigv4HttpRequestSigner = Aws::MakeShared<Aws::Crt::Auth::Sigv4HttpRequestSigner>(v4AsymmetricLogTag);
bool success = true;
sigv4HttpRequestSigner->SignRequest(crtHttpRequest, awsSigningConfig,
m_crtSigner.SignRequest(crtHttpRequest, awsSigningConfig,
[&request, &success, signatureType](const std::shared_ptr<Aws::Crt::Http::HttpRequest>& signedCrtHttpRequest, int errorCode) {
success = (errorCode == AWS_ERROR_SUCCESS);
if (success)
Expand Down

0 comments on commit eba05ff

Please sign in to comment.