@@ -390,17 +390,6 @@ HttpResponseOutcome AWSClient::AttemptExhaustively(const Aws::Http::URI& uri,
390
390
{
391
391
newUri.SetAuthority (newEndpoint);
392
392
}
393
-
394
- // Save checksum information from the original request if we haven't already - safe to assume that the checksum has been finalized, since we have sent and received a response
395
- RetryContext context = request.GetRetryContext ();
396
- if (context.m_requestHash == nullptr ) {
397
- auto originalRequestHash = httpRequest->GetRequestHash ();
398
- if (originalRequestHash.second != nullptr ) {
399
- context.m_requestHash = Aws::MakeShared<std::pair<Aws::String, std::shared_ptr<Aws::Utils::Crypto::Hash>>>(AWS_CLIENT_LOG_TAG, originalRequestHash);
400
- request.SetRetryContext (context);
401
- }
402
- }
403
-
404
393
httpRequest = CreateHttpRequest (newUri, method, request.GetResponseStreamFactory ());
405
394
406
395
httpRequest->SetHeaderValue (Http::SDK_INVOCATION_ID_HEADER, invocationId);
@@ -577,12 +566,6 @@ HttpResponseOutcome AWSClient::AttemptOneRequest(const std::shared_ptr<Aws::Http
577
566
}
578
567
}
579
568
580
- // Track credential provider usage for User-Agent features
581
- auto credentialsProvider = GetCredentialsProvider ();
582
- if (credentialsProvider) {
583
- credentialsProvider->GetAWSCredentials (const_cast <Aws::AmazonWebServiceRequest&>(request));
584
- }
585
-
586
569
auto signer = GetSignerByName (signerName);
587
570
auto signedRequest = TracingUtils::MakeCallWithTiming<bool >([&]() -> bool {
588
571
return signer->SignRequest (*httpRequest, signerRegionOverride, signerServiceNameOverride, true );
@@ -596,6 +579,12 @@ HttpResponseOutcome AWSClient::AttemptOneRequest(const std::shared_ptr<Aws::Http
596
579
return HttpResponseOutcome (AWSError<CoreErrors>(CoreErrors::CLIENT_SIGNING_FAILURE, " " , " SDK failed to sign the request" , false /* retryable*/ ));
597
580
}
598
581
582
+ // Track credential provider usage for User-Agent features
583
+ auto credentialsProvider = GetCredentialsProvider ();
584
+ if (credentialsProvider) {
585
+ credentialsProvider->GetAWSCredentials (const_cast <Aws::AmazonWebServiceRequest&>(request));
586
+ }
587
+
599
588
if (request.GetRequestSignedHandler ())
600
589
{
601
590
request.GetRequestSignedHandler ()(*httpRequest);
@@ -938,13 +927,6 @@ void AWSClient::BuildHttpRequest(const Aws::AmazonWebServiceRequest& request, co
938
927
httpRequest->SetContinueRequestHandle (request.GetContinueRequestHandler ());
939
928
httpRequest->SetServiceSpecificParameters (request.GetServiceSpecificParameters ());
940
929
request.AddQueryStringParameters (httpRequest->GetUri ());
941
-
942
- // check for retry context, if present use it
943
- RetryContext context = request.GetRetryContext ();
944
- if (context.m_requestHash != nullptr ) {
945
- const auto hash = Aws::MakeShared<Aws::Utils::Crypto::PrecalculatedHash>(smithy::client::AWS_SMITHY_CLIENT_CHECKSUM, HashingUtils::Base64Encode (context.m_requestHash ->second ->GetHash ().GetResult ()));
946
- httpRequest->SetRequestHash (context.m_requestHash ->first , hash);
947
- }
948
930
}
949
931
950
932
Aws::String AWSClient::GeneratePresignedUrl (const Aws::Http::URI& uri, Aws::Http::HttpMethod method, long long expirationInSeconds, const std::shared_ptr<Aws::Http::ServiceSpecificParameters> serviceSpecificParameter)
@@ -1035,37 +1017,38 @@ std::shared_ptr<Aws::Http::HttpResponse> AWSClient::MakeHttpRequest(std::shared_
1035
1017
return m_httpClient->MakeRequest (request, m_readRateLimiter.get (), m_writeRateLimiter.get ());
1036
1018
}
1037
1019
1038
- void AWSClient::AppendRecursionDetectionHeader (std::shared_ptr<Aws::Http::HttpRequest> ioRequest) {
1039
- if (!ioRequest || ioRequest->HasHeader (Aws::Http::X_AMZN_TRACE_ID_HEADER)) {
1040
- return ;
1041
- }
1042
- Aws::String awsLambdaFunctionName = Aws::Environment::GetEnv (AWS_LAMBDA_FUNCTION_NAME);
1043
- if (awsLambdaFunctionName.empty ()) {
1044
- return ;
1045
- }
1046
- Aws::String xAmznTraceIdVal = Aws::Environment::GetEnv (X_AMZN_TRACE_ID);
1047
- if (xAmznTraceIdVal.empty ()) {
1048
- return ;
1049
- }
1050
-
1051
- // Escape all non-printable ASCII characters by percent encoding
1052
- Aws::OStringStream xAmznTraceIdValEncodedStr;
1053
- for (const char ch : xAmznTraceIdVal)
1054
- {
1055
- if (ch >= 0x20 && ch <= 0x7e ) // ascii chars [32-126] or [' ' to '~'] are not escaped
1056
- {
1057
- xAmznTraceIdValEncodedStr << ch;
1020
+ void AWSClient::AppendRecursionDetectionHeader (std::shared_ptr<Aws::Http::HttpRequest> ioRequest)
1021
+ {
1022
+ if (!ioRequest || ioRequest->HasHeader (Aws::Http::X_AMZN_TRACE_ID_HEADER)) {
1023
+ return ;
1058
1024
}
1059
- else
1025
+ Aws::String awsLambdaFunctionName = Aws::Environment::GetEnv (AWS_LAMBDA_FUNCTION_NAME);
1026
+ if (awsLambdaFunctionName.empty ()) {
1027
+ return ;
1028
+ }
1029
+ Aws::String xAmznTraceIdVal = Aws::Environment::GetEnv (X_AMZN_TRACE_ID);
1030
+ if (xAmznTraceIdVal.empty ()) {
1031
+ return ;
1032
+ }
1033
+
1034
+ // Escape all non-printable ASCII characters by percent encoding
1035
+ Aws::OStringStream xAmznTraceIdValEncodedStr;
1036
+ for (const char ch : xAmznTraceIdVal)
1060
1037
{
1061
- // A percent-encoded octet is encoded as a character triplet
1062
- xAmznTraceIdValEncodedStr << ' %' // consisting of the percent character "%"
1063
- << std::hex << std::setfill (' 0' ) << std::setw (2 ) << std::uppercase
1064
- << (size_t ) ch // followed by the two hexadecimal digits representing that octet's numeric value
1065
- << std::dec << std::setfill (' ' ) << std::setw (0 ) << std::nouppercase;
1038
+ if (ch >= 0x20 && ch <= 0x7e ) // ascii chars [32-126] or [' ' to '~'] are not escaped
1039
+ {
1040
+ xAmznTraceIdValEncodedStr << ch;
1041
+ }
1042
+ else
1043
+ {
1044
+ // A percent-encoded octet is encoded as a character triplet
1045
+ xAmznTraceIdValEncodedStr << ' %' // consisting of the percent character "%"
1046
+ << std::hex << std::setfill (' 0' ) << std::setw (2 ) << std::uppercase
1047
+ << (size_t ) ch // followed by the two hexadecimal digits representing that octet's numeric value
1048
+ << std::dec << std::setfill (' ' ) << std::setw (0 ) << std::nouppercase;
1049
+ }
1066
1050
}
1067
- }
1068
- xAmznTraceIdVal = xAmznTraceIdValEncodedStr.str ();
1051
+ xAmznTraceIdVal = xAmznTraceIdValEncodedStr.str ();
1069
1052
1070
- ioRequest->SetHeaderValue (Aws::Http::X_AMZN_TRACE_ID_HEADER, xAmznTraceIdVal);
1053
+ ioRequest->SetHeaderValue (Aws::Http::X_AMZN_TRACE_ID_HEADER, xAmznTraceIdVal);
1071
1054
}
0 commit comments