aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source
diff options
context:
space:
mode:
authororivej <orivej@yandex-team.ru>2022-02-10 16:45:01 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:01 +0300
commit2d37894b1b037cf24231090eda8589bbb44fb6fc (patch)
treebe835aa92c6248212e705f25388ebafcf84bc7a1 /contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source
parent718c552901d703c502ccbefdfc3c9028d608b947 (diff)
downloadydb-2d37894b1b037cf24231090eda8589bbb44fb6fc.tar.gz
Restoring authorship annotation for <orivej@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source')
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/AmazonSerializableWebServiceRequest.cpp8
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/AmazonStreamingWebServiceRequest.cpp8
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/AmazonWebServiceRequest.cpp16
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/Aws.cpp28
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/Globals.cpp8
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/Region.cpp72
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/Version.cpp8
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/auth/AWSAuthSigner.cpp80
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/auth/AWSAuthSignerProvider.cpp42
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/auth/AWSCredentialsProvider.cpp240
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/auth/AWSCredentialsProviderChain.cpp20
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/auth/STSCredentialsProvider.cpp326
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/client/AWSClient.cpp718
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/client/AWSErrorMarshaller.cpp116
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/client/AsyncCallerContext.cpp8
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/client/ClientConfiguration.cpp242
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/client/CoreErrors.cpp48
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/client/DefaultRetryStrategy.cpp8
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/client/RetryStrategy.cpp204
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/client/SpecifiedRetryableErrorsRetryStrategy.cpp56
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/config/AWSProfileConfigLoader.cpp430
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/external/cjson/cJSON.cpp108
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/external/tinyxml2/tinyxml2.cpp34
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/http/HttpClient.cpp8
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/http/HttpClientFactory.cpp46
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/http/HttpRequest.cpp52
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/http/HttpTypes.cpp8
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/http/Scheme.cpp8
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/http/URI.cpp72
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/http/curl/CurlHandleContainer.cpp108
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/http/curl/CurlHttpClient.cpp508
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/http/standard/StandardHttpRequest.cpp12
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/http/standard/StandardHttpResponse.cpp8
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/internal/AWSHttpResourceClient.cpp916
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/monitoring/DefaultMonitoring.cpp160
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/monitoring/HttpClientMetrics.cpp22
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/monitoring/MonitoringManager.cpp16
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/net/linux-shared/Net.cpp8
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/net/linux-shared/SimpleUDP.cpp250
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/platform/linux-shared/Environment.cpp8
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/platform/linux-shared/FileSystem.cpp48
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/platform/linux-shared/OSVersionInfo.cpp8
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/platform/linux-shared/Security.cpp8
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/platform/linux-shared/Time.cpp8
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/ARN.cpp92
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/Array.cpp8
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/DNS.cpp8
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/DateTimeCommon.cpp870
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/Directory.cpp8
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/EnumParseOverflowContainer.cpp8
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/FileSystemUtils.cpp6
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/GetTheLights.cpp8
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/HashingUtils.cpp8
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/StringUtils.cpp98
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/TempFile.cpp8
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/UUID.cpp8
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/base64/Base64.cpp8
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/Cipher.cpp24
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/ContentCryptoMaterial.cpp8
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/ContentCryptoScheme.cpp8
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/CryptoBuf.cpp34
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/CryptoStream.cpp10
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/EncryptionMaterials.cpp8
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/KeyWrapAlgorithm.cpp38
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/MD5.cpp8
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/Sha256.cpp8
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/Sha256HMAC.cpp8
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/factory/Factories.cpp368
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/openssl/CryptoImpl.cpp344
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventDecoderStream.cpp44
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventEncoderStream.cpp56
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventHeader.cpp6
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventMessage.cpp122
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventStreamBuf.cpp10
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventStreamDecoder.cpp14
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventStreamEncoder.cpp36
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventStreamErrors.cpp6
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/json/JsonSerializer.cpp94
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/logging/AWSLogging.cpp8
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/logging/ConsoleLogSystem.cpp18
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/logging/DefaultLogSystem.cpp24
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/logging/FormattedLogSystem.cpp12
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/logging/LogLevel.cpp8
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/memory/AWSMemory.cpp72
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/memory/stl/SimpleStringStream.cpp16
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/stream/ConcurrentStreamBuf.cpp36
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/stream/PreallocatedStreamBuf.cpp14
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/stream/ResponseStream.cpp8
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/stream/SimpleStreamBuf.cpp8
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/threading/Executor.cpp8
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/threading/ReaderWriterLock.cpp8
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/threading/Semaphore.cpp6
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/threading/ThreadTask.cpp8
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/xml/XmlSerializer.cpp188
94 files changed, 3972 insertions, 3972 deletions
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/AmazonSerializableWebServiceRequest.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/AmazonSerializableWebServiceRequest.cpp
index 92dc1c849bc..0c401b01b20 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/AmazonSerializableWebServiceRequest.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/AmazonSerializableWebServiceRequest.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/AmazonSerializableWebServiceRequest.h>
#include <aws/core/utils/memory/stl/AWSStringStream.h>
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/AmazonStreamingWebServiceRequest.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/AmazonStreamingWebServiceRequest.cpp
index 8826268b92c..92e61c7ad41 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/AmazonStreamingWebServiceRequest.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/AmazonStreamingWebServiceRequest.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/AmazonStreamingWebServiceRequest.h>
#include <aws/core/utils/memory/stl/AWSStringStream.h>
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/AmazonWebServiceRequest.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/AmazonWebServiceRequest.cpp
index db77a1daed3..a6b0406683c 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/AmazonWebServiceRequest.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/AmazonWebServiceRequest.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/AmazonWebServiceRequest.h>
#include <aws/core/utils/memory/stl/AWSStringStream.h>
@@ -11,10 +11,10 @@ using namespace Aws;
AmazonWebServiceRequest::AmazonWebServiceRequest() :
m_responseStreamFactory(Aws::Utils::Stream::DefaultResponseStreamFactoryMethod),
m_onDataReceived(nullptr),
- m_onDataSent(nullptr),
- m_continueRequest(nullptr),
- m_onRequestSigned(nullptr),
- m_requestRetryHandler(nullptr)
+ m_onDataSent(nullptr),
+ m_continueRequest(nullptr),
+ m_onRequestSigned(nullptr),
+ m_requestRetryHandler(nullptr)
{
}
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/Aws.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/Aws.cpp
index 4baea9fae72..1eaa477fca6 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/Aws.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/Aws.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/Version.h>
#include <aws/core/utils/logging/LogMacros.h>
#include <aws/core/Aws.h>
@@ -12,8 +12,8 @@
#include <aws/core/external/cjson/cJSON.h>
#include <aws/core/monitoring/MonitoringManager.h>
#include <aws/core/net/Net.h>
-#include <aws/core/config/AWSProfileConfigLoader.h>
-#include <aws/core/internal/AWSHttpResourceClient.h>
+#include <aws/core/config/AWSProfileConfigLoader.h>
+#include <aws/core/internal/AWSHttpResourceClient.h>
namespace Aws
{
@@ -43,9 +43,9 @@ namespace Aws
AWS_LOGSTREAM_INFO(ALLOCATION_TAG, "Initiate AWS SDK for C++ with Version:" << Aws::String(Aws::Version::GetVersionString()));
}
- Aws::Config::InitConfigAndCredentialsCacheManager();
-
- if (options.cryptoOptions.aes_CBCFactory_create_fn)
+ Aws::Config::InitConfigAndCredentialsCacheManager();
+
+ if (options.cryptoOptions.aes_CBCFactory_create_fn)
{
Aws::Utils::Crypto::SetAES_CBCFactory(options.cryptoOptions.aes_CBCFactory_create_fn());
}
@@ -102,26 +102,26 @@ namespace Aws
hooks.free_fn = Aws::Free;
cJSON_InitHooks(&hooks);
Aws::Net::InitNetwork();
- Aws::Internal::InitEC2MetadataClient();
+ Aws::Internal::InitEC2MetadataClient();
Aws::Monitoring::InitMonitoring(options.monitoringOptions.customizedMonitoringFactory_create_fn);
}
void ShutdownAPI(const SDKOptions& options)
{
Aws::Monitoring::CleanupMonitoring();
- Aws::Internal::CleanupEC2MetadataClient();
+ Aws::Internal::CleanupEC2MetadataClient();
Aws::Net::CleanupNetwork();
Aws::CleanupEnumOverflowContainer();
Aws::Http::CleanupHttp();
Aws::Utils::Crypto::CleanupCrypto();
- Aws::Config::CleanupConfigAndCredentialsCacheManager();
-
+ Aws::Config::CleanupConfigAndCredentialsCacheManager();
+
if(options.loggingOptions.logLevel != Aws::Utils::Logging::LogLevel::Off)
{
Aws::Utils::Logging::ShutdownAWSLogging();
}
-
+
Aws::Client::CoreErrorsMapper::CleanupCoreErrorsMapper();
#ifdef USE_AWS_MEMORY_MANAGEMENT
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/Globals.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/Globals.cpp
index 46b5a7b410b..55f2ee92203 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/Globals.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/Globals.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/Globals.h>
#include <aws/core/utils/EnumParseOverflowContainer.h>
#include <aws/core/utils/memory/AWSMemory.h>
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/Region.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/Region.cpp
index ae35d48e136..4b18bf2a2af 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/Region.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/Region.cpp
@@ -1,36 +1,36 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
-
-#include <aws/core/utils/memory/stl/AWSString.h>
-#include <aws/core/Region.h>
-namespace Aws
-{
- namespace Region
- {
- Aws::String ComputeSignerRegion(const Aws::String& region)
- {
- if (region == Aws::Region::AWS_GLOBAL)
- {
- return Aws::Region::US_EAST_1;
- }
- else if (region == "s3-external-1")
- {
- return Aws::Region::US_EAST_1;
- }
- else if (region.size() >= 5 && region.compare(0, 5, "fips-") == 0)
- {
- return region.substr(5);
- }
- else if (region.size() >= 5 && region.compare(region.size() - 5, 5, "-fips") == 0)
- {
- return region.substr(0, region.size() - 5);
- }
- else
- {
- return region;
- }
- }
- }
-} \ No newline at end of file
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
+
+#include <aws/core/utils/memory/stl/AWSString.h>
+#include <aws/core/Region.h>
+namespace Aws
+{
+ namespace Region
+ {
+ Aws::String ComputeSignerRegion(const Aws::String& region)
+ {
+ if (region == Aws::Region::AWS_GLOBAL)
+ {
+ return Aws::Region::US_EAST_1;
+ }
+ else if (region == "s3-external-1")
+ {
+ return Aws::Region::US_EAST_1;
+ }
+ else if (region.size() >= 5 && region.compare(0, 5, "fips-") == 0)
+ {
+ return region.substr(5);
+ }
+ else if (region.size() >= 5 && region.compare(region.size() - 5, 5, "-fips") == 0)
+ {
+ return region.substr(0, region.size() - 5);
+ }
+ else
+ {
+ return region;
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/Version.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/Version.cpp
index fa8dda381ac..35291906b77 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/Version.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/Version.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/Version.h>
#include <aws/core/VersionConfig.h>
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/auth/AWSAuthSigner.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/auth/AWSAuthSigner.cpp
index 410c446958b..de4826fa5b9 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/auth/AWSAuthSigner.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/auth/AWSAuthSigner.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/auth/AWSAuthSigner.h>
@@ -94,7 +94,7 @@ static Aws::String CanonicalizeRequestSigningString(HttpRequest& request, bool u
signingStringStream << NEWLINE << uriCpy.GetPath() << NEWLINE;
}
- if (request.GetQueryString().find('=') != std::string::npos)
+ if (request.GetQueryString().find('=') != std::string::npos)
{
signingStringStream << request.GetQueryString().substr(1) << NEWLINE;
}
@@ -138,7 +138,7 @@ static Http::HeaderValueCollection CanonicalizeHeaders(Http::HeaderValueCollecti
);
headerValue.erase(new_end, headerValue.end());
- canonicalHeaders[trimmedHeaderName] = headerValue;
+ canonicalHeaders[trimmedHeaderName] = headerValue;
}
return canonicalHeaders;
@@ -157,12 +157,12 @@ AWSAuthV4Signer::AWSAuthV4Signer(const std::shared_ptr<Auth::AWSCredentialsProvi
m_urlEscapePath(urlEscapePath)
{
//go ahead and warm up the signing cache.
- ComputeHash(credentialsProvider->GetAWSCredentials().GetAWSSecretKey(), DateTime::CalculateGmtTimestampAsString(SIMPLE_DATE_FORMAT_STR), region, m_serviceName);
+ ComputeHash(credentialsProvider->GetAWSCredentials().GetAWSSecretKey(), DateTime::CalculateGmtTimestampAsString(SIMPLE_DATE_FORMAT_STR), region, m_serviceName);
}
AWSAuthV4Signer::~AWSAuthV4Signer()
{
- // empty destructor in .cpp file to keep from needing the implementation of (AWSCredentialsProvider, Sha256, Sha256HMAC) in the header file
+ // empty destructor in .cpp file to keep from needing the implementation of (AWSCredentialsProvider, Sha256, Sha256HMAC) in the header file
}
@@ -171,7 +171,7 @@ bool AWSAuthV4Signer::ShouldSignHeader(const Aws::String& header) const
return m_unsignedHeaders.find(Aws::Utils::StringUtils::ToLower(header.c_str())) == m_unsignedHeaders.cend();
}
-bool AWSAuthV4Signer::SignRequest(Aws::Http::HttpRequest& request, const char* region, const char* serviceName, bool signBody) const
+bool AWSAuthV4Signer::SignRequest(Aws::Http::HttpRequest& request, const char* region, const char* serviceName, bool signBody) const
{
AWSCredentials credentials = m_credentialsProvider->GetAWSCredentials();
@@ -222,7 +222,7 @@ bool AWSAuthV4Signer::SignRequest(Aws::Http::HttpRequest& request, const char* r
//calculate date header to use in internal signature (this also goes into date header).
DateTime now = GetSigningTimestamp();
- Aws::String dateHeaderValue = now.ToGmtString(DateFormat::ISO_8601_BASIC);
+ Aws::String dateHeaderValue = now.ToGmtString(DateFormat::ISO_8601_BASIC);
request.SetHeaderValue(AWS_DATE_HEADER, dateHeaderValue);
Aws::StringStream headersStream;
@@ -272,24 +272,24 @@ bool AWSAuthV4Signer::SignRequest(Aws::Http::HttpRequest& request, const char* r
}
auto sha256Digest = hashResult.GetResult();
- Aws::String canonicalRequestHash = HashingUtils::HexEncode(sha256Digest);
+ Aws::String canonicalRequestHash = HashingUtils::HexEncode(sha256Digest);
Aws::String simpleDate = now.ToGmtString(SIMPLE_DATE_FORMAT_STR);
- Aws::String signingRegion = region ? region : m_region;
- Aws::String signingServiceName = serviceName ? serviceName : m_serviceName;
- Aws::String stringToSign = GenerateStringToSign(dateHeaderValue, simpleDate, canonicalRequestHash, signingRegion, signingServiceName);
- auto finalSignature = GenerateSignature(credentials, stringToSign, simpleDate, signingRegion, signingServiceName);
+ Aws::String signingRegion = region ? region : m_region;
+ Aws::String signingServiceName = serviceName ? serviceName : m_serviceName;
+ Aws::String stringToSign = GenerateStringToSign(dateHeaderValue, simpleDate, canonicalRequestHash, signingRegion, signingServiceName);
+ auto finalSignature = GenerateSignature(credentials, stringToSign, simpleDate, signingRegion, signingServiceName);
Aws::StringStream ss;
ss << AWS_HMAC_SHA256 << " " << CREDENTIAL << EQ << credentials.GetAWSAccessKeyId() << "/" << simpleDate
- << "/" << signingRegion << "/" << signingServiceName << "/" << AWS4_REQUEST << ", " << SIGNED_HEADERS << EQ
+ << "/" << signingRegion << "/" << signingServiceName << "/" << AWS4_REQUEST << ", " << SIGNED_HEADERS << EQ
<< signedHeadersValue << ", " << SIGNATURE << EQ << finalSignature;
auto awsAuthString = ss.str();
AWS_LOGSTREAM_DEBUG(v4LogTag, "Signing request with: " << awsAuthString);
request.SetAwsAuthorization(awsAuthString);
request.SetSigningAccessKey(credentials.GetAWSAccessKeyId());
- request.SetSigningRegion(signingRegion);
+ request.SetSigningRegion(signingRegion);
return true;
}
@@ -324,7 +324,7 @@ bool AWSAuthV4Signer::PresignRequest(Aws::Http::HttpRequest& request, const char
//calculate date header to use in internal signature (this also goes into date header).
DateTime now = GetSigningTimestamp();
- Aws::String dateQueryValue = now.ToGmtString(DateFormat::ISO_8601_BASIC);
+ Aws::String dateQueryValue = now.ToGmtString(DateFormat::ISO_8601_BASIC);
request.AddQueryStringParameter(Http::AWS_DATE_HEADER, dateQueryValue);
Aws::StringStream headersStream;
@@ -353,18 +353,18 @@ bool AWSAuthV4Signer::PresignRequest(Aws::Http::HttpRequest& request, const char
AWS_LOGSTREAM_DEBUG(v4LogTag, "Signed Headers value: " << signedHeadersValue);
Aws::StringStream ss;
- Aws::String signingRegion = region ? region : m_region;
- Aws::String signingServiceName = serviceName ? serviceName : m_serviceName;
+ Aws::String signingRegion = region ? region : m_region;
+ Aws::String signingServiceName = serviceName ? serviceName : m_serviceName;
Aws::String simpleDate = now.ToGmtString(SIMPLE_DATE_FORMAT_STR);
ss << credentials.GetAWSAccessKeyId() << "/" << simpleDate
- << "/" << signingRegion << "/" << signingServiceName << "/" << AWS4_REQUEST;
+ << "/" << signingRegion << "/" << signingServiceName << "/" << AWS4_REQUEST;
request.AddQueryStringParameter(X_AMZ_ALGORITHM, AWS_HMAC_SHA256);
request.AddQueryStringParameter(X_AMZ_CREDENTIAL, ss.str());
ss.str("");
request.SetSigningAccessKey(credentials.GetAWSAccessKeyId());
- request.SetSigningRegion(signingRegion);
+ request.SetSigningRegion(signingRegion);
//generate generalized canonicalized request string.
Aws::String canonicalRequestString = CanonicalizeRequestSigningString(request, m_urlEscapePath);
@@ -374,7 +374,7 @@ bool AWSAuthV4Signer::PresignRequest(Aws::Http::HttpRequest& request, const char
canonicalRequestString.append(NEWLINE);
canonicalRequestString.append(signedHeadersValue);
canonicalRequestString.append(NEWLINE);
- if (ServiceRequireUnsignedPayload(signingServiceName))
+ if (ServiceRequireUnsignedPayload(signingServiceName))
{
canonicalRequestString.append(UNSIGNED_PAYLOAD);
}
@@ -394,16 +394,16 @@ bool AWSAuthV4Signer::PresignRequest(Aws::Http::HttpRequest& request, const char
}
auto sha256Digest = hashResult.GetResult();
- auto canonicalRequestHash = HashingUtils::HexEncode(sha256Digest);
+ auto canonicalRequestHash = HashingUtils::HexEncode(sha256Digest);
- auto stringToSign = GenerateStringToSign(dateQueryValue, simpleDate, canonicalRequestHash, signingRegion, signingServiceName);
- auto finalSigningHash = GenerateSignature(credentials, stringToSign, simpleDate, signingRegion, signingServiceName);
+ auto stringToSign = GenerateStringToSign(dateQueryValue, simpleDate, canonicalRequestHash, signingRegion, signingServiceName);
+ auto finalSigningHash = GenerateSignature(credentials, stringToSign, simpleDate, signingRegion, signingServiceName);
if (finalSigningHash.empty())
{
return false;
}
- //add that the signature to the query string
+ //add that the signature to the query string
request.AddQueryStringParameter(X_AMZ_SIGNATURE, finalSigningHash);
return true;
@@ -544,7 +544,7 @@ AWSAuthEventStreamV4Signer::AWSAuthEventStreamV4Signer(const std::shared_ptr<Aut
m_unsignedHeaders.emplace_back(USER_AGENT_HEADER);
}
-bool AWSAuthEventStreamV4Signer::SignRequest(Aws::Http::HttpRequest& request, const char* region, const char* serviceName, bool /* signBody */) const
+bool AWSAuthEventStreamV4Signer::SignRequest(Aws::Http::HttpRequest& request, const char* region, const char* serviceName, bool /* signBody */) const
{
AWSCredentials credentials = m_credentialsProvider->GetAWSCredentials();
@@ -563,7 +563,7 @@ bool AWSAuthEventStreamV4Signer::SignRequest(Aws::Http::HttpRequest& request, co
//calculate date header to use in internal signature (this also goes into date header).
DateTime now = GetSigningTimestamp();
- Aws::String dateHeaderValue = now.ToGmtString(DateFormat::ISO_8601_BASIC);
+ Aws::String dateHeaderValue = now.ToGmtString(DateFormat::ISO_8601_BASIC);
request.SetHeaderValue(AWS_DATE_HEADER, dateHeaderValue);
Aws::StringStream headersStream;
@@ -613,24 +613,24 @@ bool AWSAuthEventStreamV4Signer::SignRequest(Aws::Http::HttpRequest& request, co
}
auto sha256Digest = hashResult.GetResult();
- Aws::String canonicalRequestHash = HashingUtils::HexEncode(sha256Digest);
+ Aws::String canonicalRequestHash = HashingUtils::HexEncode(sha256Digest);
Aws::String simpleDate = now.ToGmtString(SIMPLE_DATE_FORMAT_STR);
- Aws::String signingRegion = region ? region : m_region;
- Aws::String signingServiceName = serviceName ? serviceName : m_serviceName;
- Aws::String stringToSign = GenerateStringToSign(dateHeaderValue, simpleDate, canonicalRequestHash, signingRegion, signingServiceName);
- auto finalSignature = GenerateSignature(credentials, stringToSign, simpleDate, signingRegion, signingServiceName);
+ Aws::String signingRegion = region ? region : m_region;
+ Aws::String signingServiceName = serviceName ? serviceName : m_serviceName;
+ Aws::String stringToSign = GenerateStringToSign(dateHeaderValue, simpleDate, canonicalRequestHash, signingRegion, signingServiceName);
+ auto finalSignature = GenerateSignature(credentials, stringToSign, simpleDate, signingRegion, signingServiceName);
Aws::StringStream ss;
ss << AWS_HMAC_SHA256 << " " << CREDENTIAL << EQ << credentials.GetAWSAccessKeyId() << "/" << simpleDate
- << "/" << signingRegion << "/" << signingServiceName << "/" << AWS4_REQUEST << ", " << SIGNED_HEADERS << EQ
+ << "/" << signingRegion << "/" << signingServiceName << "/" << AWS4_REQUEST << ", " << SIGNED_HEADERS << EQ
<< signedHeadersValue << ", " << SIGNATURE << EQ << HashingUtils::HexEncode(finalSignature);
auto awsAuthString = ss.str();
AWS_LOGSTREAM_DEBUG(v4StreamingLogTag, "Signing request with: " << awsAuthString);
request.SetAwsAuthorization(awsAuthString);
request.SetSigningAccessKey(credentials.GetAWSAccessKeyId());
- request.SetSigningRegion(signingRegion);
+ request.SetSigningRegion(signingRegion);
return true;
}
@@ -653,7 +653,7 @@ bool AWSAuthEventStreamV4Signer::SignEventMessage(Event::Message& message, Aws::
stringToSign << EVENT_STREAM_PAYLOAD << NEWLINE;
const DateTime now = GetSigningTimestamp();
const auto simpleDate = now.ToGmtString(SIMPLE_DATE_FORMAT_STR);
- stringToSign << now.ToGmtString(DateFormat::ISO_8601_BASIC) << NEWLINE
+ stringToSign << now.ToGmtString(DateFormat::ISO_8601_BASIC) << NEWLINE
<< simpleDate << "/" << m_region << "/"
<< m_serviceName << "/aws4_request" << NEWLINE << priorSignature << NEWLINE;
@@ -698,7 +698,7 @@ bool AWSAuthEventStreamV4Signer::SignEventMessage(Event::Message& message, Aws::
AWS_LOGSTREAM_DEBUG(v4StreamingLogTag, "Payload hash - " << HashingUtils::HexEncode(payloadHash));
}
- Utils::ByteBuffer finalSignatureDigest = GenerateSignature(m_credentialsProvider->GetAWSCredentials(), stringToSign.str(), simpleDate, m_region, m_serviceName);
+ Utils::ByteBuffer finalSignatureDigest = GenerateSignature(m_credentialsProvider->GetAWSCredentials(), stringToSign.str(), simpleDate, m_region, m_serviceName);
const auto finalSignature = HashingUtils::HexEncode(finalSignatureDigest);
AWS_LOGSTREAM_DEBUG(v4StreamingLogTag, "Final computed signing hash: " << finalSignature);
priorSignature = finalSignature;
@@ -716,7 +716,7 @@ bool AWSAuthEventStreamV4Signer::ShouldSignHeader(const Aws::String& header) con
}
Utils::ByteBuffer AWSAuthEventStreamV4Signer::GenerateSignature(const AWSCredentials& credentials, const Aws::String& stringToSign,
- const Aws::String& simpleDate, const Aws::String& region, const Aws::String& serviceName) const
+ const Aws::String& simpleDate, const Aws::String& region, const Aws::String& serviceName) const
{
Utils::Threading::ReaderLockGuard guard(m_derivedKeyLock);
const auto& secretKey = credentials.GetAWSSecretKey();
@@ -728,7 +728,7 @@ Utils::ByteBuffer AWSAuthEventStreamV4Signer::GenerateSignature(const AWSCredent
{
m_currentSecretKey = secretKey;
m_currentDateStr = simpleDate;
- m_derivedKey = ComputeHash(m_currentSecretKey, m_currentDateStr, region, serviceName);
+ m_derivedKey = ComputeHash(m_currentSecretKey, m_currentDateStr, region, serviceName);
}
}
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/auth/AWSAuthSignerProvider.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/auth/AWSAuthSignerProvider.cpp
index a981bc35367..31fd6c006ba 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/auth/AWSAuthSignerProvider.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/auth/AWSAuthSignerProvider.cpp
@@ -1,26 +1,26 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/utils/logging/LogMacros.h>
#include <aws/core/auth/AWSAuthSignerProvider.h>
#include <aws/core/auth/AWSAuthSigner.h>
-#include <aws/core/auth/AWSCredentialsProvider.h>
-#include <aws/core/utils/memory/stl/AWSAllocator.h>
+#include <aws/core/auth/AWSCredentialsProvider.h>
+#include <aws/core/utils/memory/stl/AWSAllocator.h>
const char CLASS_TAG[] = "AuthSignerProvider";
using namespace Aws::Auth;
-
-DefaultAuthSignerProvider::DefaultAuthSignerProvider(const std::shared_ptr<AWSCredentialsProvider>& credentialsProvider,
- const Aws::String& serviceName, const Aws::String& region)
-{
- m_signers.emplace_back(Aws::MakeShared<Aws::Client::AWSAuthV4Signer>(CLASS_TAG, credentialsProvider, serviceName.c_str(), region));
- m_signers.emplace_back(Aws::MakeShared<Aws::Client::AWSAuthEventStreamV4Signer>(CLASS_TAG, credentialsProvider, serviceName.c_str(), region));
- m_signers.emplace_back(Aws::MakeShared<Aws::Client::AWSNullSigner>(CLASS_TAG));
-}
-
+
+DefaultAuthSignerProvider::DefaultAuthSignerProvider(const std::shared_ptr<AWSCredentialsProvider>& credentialsProvider,
+ const Aws::String& serviceName, const Aws::String& region)
+{
+ m_signers.emplace_back(Aws::MakeShared<Aws::Client::AWSAuthV4Signer>(CLASS_TAG, credentialsProvider, serviceName.c_str(), region));
+ m_signers.emplace_back(Aws::MakeShared<Aws::Client::AWSAuthEventStreamV4Signer>(CLASS_TAG, credentialsProvider, serviceName.c_str(), region));
+ m_signers.emplace_back(Aws::MakeShared<Aws::Client::AWSNullSigner>(CLASS_TAG));
+}
+
DefaultAuthSignerProvider::DefaultAuthSignerProvider(const std::shared_ptr<Aws::Client::AWSAuthSigner>& signer)
{
m_signers.emplace_back(Aws::MakeShared<Aws::Client::AWSNullSigner>(CLASS_TAG));
@@ -43,9 +43,9 @@ std::shared_ptr<Aws::Client::AWSAuthSigner> DefaultAuthSignerProvider::GetSigner
assert(false);
return nullptr;
}
-
-void DefaultAuthSignerProvider::AddSigner(std::shared_ptr<Aws::Client::AWSAuthSigner>& signer)
-{
- assert(signer);
- m_signers.emplace_back(signer);
-}
+
+void DefaultAuthSignerProvider::AddSigner(std::shared_ptr<Aws::Client::AWSAuthSigner>& signer)
+{
+ assert(signer);
+ m_signers.emplace_back(signer);
+}
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/auth/AWSCredentialsProvider.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/auth/AWSCredentialsProvider.cpp
index b4b4cae940e..31e28b996fa 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/auth/AWSCredentialsProvider.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/auth/AWSCredentialsProvider.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/auth/AWSCredentialsProvider.h>
@@ -14,9 +14,9 @@
#include <aws/core/utils/StringUtils.h>
#include <aws/core/utils/json/JsonSerializer.h>
#include <aws/core/utils/FileSystemUtils.h>
-#include <aws/core/client/AWSError.h>
-#include <aws/core/utils/StringUtils.h>
-#include <aws/core/utils/xml/XmlSerializer.h>
+#include <aws/core/client/AWSError.h>
+#include <aws/core/utils/StringUtils.h>
+#include <aws/core/utils/xml/XmlSerializer.h>
#include <cstdlib>
#include <fstream>
#include <string.h>
@@ -28,8 +28,8 @@ using namespace Aws::Utils::Logging;
using namespace Aws::Auth;
using namespace Aws::Internal;
using namespace Aws::FileSystem;
-using namespace Aws::Utils::Xml;
-using namespace Aws::Client;
+using namespace Aws::Utils::Xml;
+using namespace Aws::Client;
using Aws::Utils::Threading::ReaderLockGuard;
using Aws::Utils::Threading::WriterLockGuard;
@@ -41,11 +41,11 @@ static const char AWS_PROFILE_ENV_VAR[] = "AWS_PROFILE";
static const char AWS_PROFILE_DEFAULT_ENV_VAR[] = "AWS_DEFAULT_PROFILE";
static const char AWS_CREDENTIALS_FILE[] = "AWS_SHARED_CREDENTIALS_FILE";
-extern const char AWS_CONFIG_FILE[] = "AWS_CONFIG_FILE";
+extern const char AWS_CONFIG_FILE[] = "AWS_CONFIG_FILE";
-extern const char PROFILE_DIRECTORY[] = ".aws";
+extern const char PROFILE_DIRECTORY[] = ".aws";
static const char DEFAULT_CREDENTIALS_FILE[] = "credentials";
-extern const char DEFAULT_CONFIG_FILE[] = "config";
+extern const char DEFAULT_CONFIG_FILE[] = "config";
static const int EXPIRATION_GRACE_PERIOD = 5 * 1000;
@@ -71,7 +71,7 @@ static const char* ENVIRONMENT_LOG_TAG = "EnvironmentAWSCredentialsProvider";
AWSCredentials EnvironmentAWSCredentialsProvider::GetAWSCredentials()
{
auto accessKey = Aws::Environment::GetEnv(ACCESS_KEY_ENV_VAR);
- AWSCredentials credentials;
+ AWSCredentials credentials;
if (!accessKey.empty())
{
@@ -107,41 +107,41 @@ Aws::String Aws::Auth::GetConfigProfileFilename()
}
else
{
- return Aws::FileSystem::GetHomeDirectory() + PROFILE_DIRECTORY + PATH_DELIM + DEFAULT_CONFIG_FILE;
+ return Aws::FileSystem::GetHomeDirectory() + PROFILE_DIRECTORY + PATH_DELIM + DEFAULT_CONFIG_FILE;
+ }
+}
+
+Aws::String Aws::Auth::GetConfigProfileName()
+{
+ auto profileFromVar = Aws::Environment::GetEnv(AWS_PROFILE_DEFAULT_ENV_VAR);
+ if (profileFromVar.empty())
+ {
+ profileFromVar = Aws::Environment::GetEnv(AWS_PROFILE_ENV_VAR);
+ }
+
+ if (profileFromVar.empty())
+ {
+ return Aws::String(DEFAULT_PROFILE);
+ }
+ else
+ {
+ return profileFromVar;
}
}
-Aws::String Aws::Auth::GetConfigProfileName()
-{
- auto profileFromVar = Aws::Environment::GetEnv(AWS_PROFILE_DEFAULT_ENV_VAR);
- if (profileFromVar.empty())
- {
- profileFromVar = Aws::Environment::GetEnv(AWS_PROFILE_ENV_VAR);
- }
-
- if (profileFromVar.empty())
- {
- return Aws::String(DEFAULT_PROFILE);
- }
- else
- {
- return profileFromVar;
- }
-}
-
static const char* PROFILE_LOG_TAG = "ProfileConfigFileAWSCredentialsProvider";
Aws::String ProfileConfigFileAWSCredentialsProvider::GetCredentialsProfileFilename()
{
auto credentialsFileNameFromVar = Aws::Environment::GetEnv(AWS_CREDENTIALS_FILE);
- if (credentialsFileNameFromVar.empty())
+ if (credentialsFileNameFromVar.empty())
{
- return Aws::FileSystem::GetHomeDirectory() + PROFILE_DIRECTORY + PATH_DELIM + DEFAULT_CREDENTIALS_FILE;
+ return Aws::FileSystem::GetHomeDirectory() + PROFILE_DIRECTORY + PATH_DELIM + DEFAULT_CREDENTIALS_FILE;
}
else
{
- return credentialsFileNameFromVar;
+ return credentialsFileNameFromVar;
}
}
@@ -160,9 +160,9 @@ Aws::String ProfileConfigFileAWSCredentialsProvider::GetProfileDirectory()
}
ProfileConfigFileAWSCredentialsProvider::ProfileConfigFileAWSCredentialsProvider(long refreshRateMs) :
- m_profileToUse(Aws::Auth::GetConfigProfileName()),
- m_credentialsFileLoader(GetCredentialsProfileFilename()),
- m_loadFrequencyMs(refreshRateMs)
+ m_profileToUse(Aws::Auth::GetConfigProfileName()),
+ m_credentialsFileLoader(GetCredentialsProfileFilename()),
+ m_loadFrequencyMs(refreshRateMs)
{
AWS_LOGSTREAM_INFO(PROFILE_LOG_TAG, "Setting provider to read credentials from " << GetCredentialsProfileFilename() << " for credentials file"
<< " and " << GetConfigProfileFilename() << " for the config file "
@@ -170,9 +170,9 @@ ProfileConfigFileAWSCredentialsProvider::ProfileConfigFileAWSCredentialsProvider
}
ProfileConfigFileAWSCredentialsProvider::ProfileConfigFileAWSCredentialsProvider(const char* profile, long refreshRateMs) :
- m_profileToUse(profile),
- m_credentialsFileLoader(GetCredentialsProfileFilename()),
- m_loadFrequencyMs(refreshRateMs)
+ m_profileToUse(profile),
+ m_credentialsFileLoader(GetCredentialsProfileFilename()),
+ m_loadFrequencyMs(refreshRateMs)
{
AWS_LOGSTREAM_INFO(PROFILE_LOG_TAG, "Setting provider to read credentials from " << GetCredentialsProfileFilename() << " for credentials file"
<< " and " << GetConfigProfileFilename() << " for the config file "
@@ -196,7 +196,7 @@ AWSCredentials ProfileConfigFileAWSCredentialsProvider::GetAWSCredentials()
void ProfileConfigFileAWSCredentialsProvider::Reload()
{
- m_credentialsFileLoader.Load();
+ m_credentialsFileLoader.Load();
AWSCredentialsProvider::Reload();
}
@@ -220,16 +220,16 @@ void ProfileConfigFileAWSCredentialsProvider::RefreshIfExpired()
static const char* INSTANCE_LOG_TAG = "InstanceProfileCredentialsProvider";
InstanceProfileCredentialsProvider::InstanceProfileCredentialsProvider(long refreshRateMs) :
- m_ec2MetadataConfigLoader(Aws::MakeShared<Aws::Config::EC2InstanceProfileConfigLoader>(INSTANCE_LOG_TAG)),
- m_loadFrequencyMs(refreshRateMs)
+ m_ec2MetadataConfigLoader(Aws::MakeShared<Aws::Config::EC2InstanceProfileConfigLoader>(INSTANCE_LOG_TAG)),
+ m_loadFrequencyMs(refreshRateMs)
{
AWS_LOGSTREAM_INFO(INSTANCE_LOG_TAG, "Creating Instance with default EC2MetadataClient and refresh rate " << refreshRateMs);
}
-InstanceProfileCredentialsProvider::InstanceProfileCredentialsProvider(const std::shared_ptr<Aws::Config::EC2InstanceProfileConfigLoader>& loader, long refreshRateMs) :
- m_ec2MetadataConfigLoader(loader),
- m_loadFrequencyMs(refreshRateMs)
+InstanceProfileCredentialsProvider::InstanceProfileCredentialsProvider(const std::shared_ptr<Aws::Config::EC2InstanceProfileConfigLoader>& loader, long refreshRateMs) :
+ m_ec2MetadataConfigLoader(loader),
+ m_loadFrequencyMs(refreshRateMs)
{
AWS_LOGSTREAM_INFO(INSTANCE_LOG_TAG, "Creating Instance with injected EC2MetadataClient and refresh rate " << refreshRateMs);
}
@@ -268,7 +268,7 @@ void InstanceProfileCredentialsProvider::RefreshIfExpired()
guard.UpgradeToWriterLock();
if (!IsTimeToRefresh(m_loadFrequencyMs)) // double-checked lock to avoid refreshing twice
{
- return;
+ return;
}
Reload();
}
@@ -277,14 +277,14 @@ static const char TASK_ROLE_LOG_TAG[] = "TaskRoleCredentialsProvider";
TaskRoleCredentialsProvider::TaskRoleCredentialsProvider(const char* URI, long refreshRateMs) :
m_ecsCredentialsClient(Aws::MakeShared<Aws::Internal::ECSCredentialsClient>(TASK_ROLE_LOG_TAG, URI)),
- m_loadFrequencyMs(refreshRateMs)
+ m_loadFrequencyMs(refreshRateMs)
{
AWS_LOGSTREAM_INFO(TASK_ROLE_LOG_TAG, "Creating TaskRole with default ECSCredentialsClient and refresh rate " << refreshRateMs);
}
TaskRoleCredentialsProvider::TaskRoleCredentialsProvider(const char* endpoint, const char* token, long refreshRateMs) :
- m_ecsCredentialsClient(Aws::MakeShared<Aws::Internal::ECSCredentialsClient>(TASK_ROLE_LOG_TAG, ""/*resourcePath*/, endpoint, token)),
- m_loadFrequencyMs(refreshRateMs)
+ m_ecsCredentialsClient(Aws::MakeShared<Aws::Internal::ECSCredentialsClient>(TASK_ROLE_LOG_TAG, ""/*resourcePath*/, endpoint, token)),
+ m_loadFrequencyMs(refreshRateMs)
{
AWS_LOGSTREAM_INFO(TASK_ROLE_LOG_TAG, "Creating TaskRole with default ECSCredentialsClient and refresh rate " << refreshRateMs);
}
@@ -292,7 +292,7 @@ TaskRoleCredentialsProvider::TaskRoleCredentialsProvider(const char* endpoint, c
TaskRoleCredentialsProvider::TaskRoleCredentialsProvider(
const std::shared_ptr<Aws::Internal::ECSCredentialsClient>& client, long refreshRateMs) :
m_ecsCredentialsClient(client),
- m_loadFrequencyMs(refreshRateMs)
+ m_loadFrequencyMs(refreshRateMs)
{
AWS_LOGSTREAM_INFO(TASK_ROLE_LOG_TAG, "Creating TaskRole with default ECSCredentialsClient and refresh rate " << refreshRateMs);
}
@@ -306,7 +306,7 @@ AWSCredentials TaskRoleCredentialsProvider::GetAWSCredentials()
bool TaskRoleCredentialsProvider::ExpiresSoon() const
{
- return ((m_credentials.GetExpiration() - Aws::Utils::DateTime::Now()).count() < EXPIRATION_GRACE_PERIOD);
+ return ((m_credentials.GetExpiration() - Aws::Utils::DateTime::Now()).count() < EXPIRATION_GRACE_PERIOD);
}
void TaskRoleCredentialsProvider::Reload()
@@ -317,9 +317,9 @@ void TaskRoleCredentialsProvider::Reload()
if (credentialsStr.empty()) return;
Json::JsonValue credentialsDoc(credentialsStr);
- if (!credentialsDoc.WasParseSuccessful())
+ if (!credentialsDoc.WasParseSuccessful())
{
- AWS_LOGSTREAM_ERROR(TASK_ROLE_LOG_TAG, "Failed to parse output from ECSCredentialService.");
+ AWS_LOGSTREAM_ERROR(TASK_ROLE_LOG_TAG, "Failed to parse output from ECSCredentialService.");
return;
}
@@ -333,7 +333,7 @@ void TaskRoleCredentialsProvider::Reload()
m_credentials.SetAWSAccessKeyId(accessKey);
m_credentials.SetAWSSecretKey(secretKey);
m_credentials.SetSessionToken(token);
- m_credentials.SetExpiration(Aws::Utils::DateTime(credentialsView.GetString("Expiration"), DateFormat::ISO_8601));
+ m_credentials.SetExpiration(Aws::Utils::DateTime(credentialsView.GetString("Expiration"), DateFormat::ISO_8601));
AWSCredentialsProvider::Reload();
}
@@ -341,14 +341,14 @@ void TaskRoleCredentialsProvider::RefreshIfExpired()
{
AWS_LOGSTREAM_DEBUG(TASK_ROLE_LOG_TAG, "Checking if latest credential pull has expired.");
ReaderLockGuard guard(m_reloadLock);
- if (!m_credentials.IsEmpty() && !IsTimeToRefresh(m_loadFrequencyMs) && !ExpiresSoon())
+ if (!m_credentials.IsEmpty() && !IsTimeToRefresh(m_loadFrequencyMs) && !ExpiresSoon())
{
return;
}
guard.UpgradeToWriterLock();
- if (!m_credentials.IsEmpty() && !IsTimeToRefresh(m_loadFrequencyMs) && !ExpiresSoon())
+ if (!m_credentials.IsEmpty() && !IsTimeToRefresh(m_loadFrequencyMs) && !ExpiresSoon())
{
return;
}
@@ -358,13 +358,13 @@ void TaskRoleCredentialsProvider::RefreshIfExpired()
static const char PROCESS_LOG_TAG[] = "ProcessCredentialsProvider";
ProcessCredentialsProvider::ProcessCredentialsProvider() :
- m_profileToUse(Aws::Auth::GetConfigProfileName())
+ m_profileToUse(Aws::Auth::GetConfigProfileName())
{
AWS_LOGSTREAM_INFO(PROCESS_LOG_TAG, "Setting process credentials provider to read config from " << m_profileToUse);
}
ProcessCredentialsProvider::ProcessCredentialsProvider(const Aws::String& profile) :
- m_profileToUse(profile)
+ m_profileToUse(profile)
{
AWS_LOGSTREAM_INFO(PROCESS_LOG_TAG, "Setting process credentials provider to read config from " << m_profileToUse);
}
@@ -379,88 +379,88 @@ AWSCredentials ProcessCredentialsProvider::GetAWSCredentials()
void ProcessCredentialsProvider::Reload()
{
- auto profile = Aws::Config::GetCachedConfigProfile(m_profileToUse);
- const Aws::String &command = profile.GetCredentialProcess();
- if (command.empty())
+ auto profile = Aws::Config::GetCachedConfigProfile(m_profileToUse);
+ const Aws::String &command = profile.GetCredentialProcess();
+ if (command.empty())
{
AWS_LOGSTREAM_ERROR(PROCESS_LOG_TAG, "Failed to find credential process's profile: " << m_profileToUse);
return;
}
- m_credentials = GetCredentialsFromProcess(command);
-}
-
-void ProcessCredentialsProvider::RefreshIfExpired()
-{
- ReaderLockGuard guard(m_reloadLock);
- if (!m_credentials.IsExpiredOrEmpty())
- {
- return;
- }
-
- guard.UpgradeToWriterLock();
- if (!m_credentials.IsExpiredOrEmpty()) // double-checked lock to avoid refreshing twice
- {
- return;
- }
-
- Reload();
-}
-
-AWSCredentials Aws::Auth::GetCredentialsFromProcess(const Aws::String& process)
-{
- Aws::String command = process;
+ m_credentials = GetCredentialsFromProcess(command);
+}
+
+void ProcessCredentialsProvider::RefreshIfExpired()
+{
+ ReaderLockGuard guard(m_reloadLock);
+ if (!m_credentials.IsExpiredOrEmpty())
+ {
+ return;
+ }
+
+ guard.UpgradeToWriterLock();
+ if (!m_credentials.IsExpiredOrEmpty()) // double-checked lock to avoid refreshing twice
+ {
+ return;
+ }
+
+ Reload();
+}
+
+AWSCredentials Aws::Auth::GetCredentialsFromProcess(const Aws::String& process)
+{
+ Aws::String command = process;
command.append(" 2>&1"); // redirect stderr to stdout
Aws::String result = Aws::Utils::StringUtils::Trim(Aws::OSVersionInfo::GetSysCommandOutput(command.c_str()).c_str());
Json::JsonValue credentialsDoc(result);
- if (!credentialsDoc.WasParseSuccessful())
+ if (!credentialsDoc.WasParseSuccessful())
{
- AWS_LOGSTREAM_ERROR(PROFILE_LOG_TAG, "Failed to load credential from running: " << command << " Error: " << result);
- return {};
+ AWS_LOGSTREAM_ERROR(PROFILE_LOG_TAG, "Failed to load credential from running: " << command << " Error: " << result);
+ return {};
}
Aws::Utils::Json::JsonView credentialsView(credentialsDoc);
if (!credentialsView.KeyExists("Version") || credentialsView.GetInteger("Version") != 1)
{
- AWS_LOGSTREAM_ERROR(PROFILE_LOG_TAG, "Encountered an unsupported process credentials payload version:" << credentialsView.GetInteger("Version"));
- return {};
+ AWS_LOGSTREAM_ERROR(PROFILE_LOG_TAG, "Encountered an unsupported process credentials payload version:" << credentialsView.GetInteger("Version"));
+ return {};
}
- AWSCredentials credentials;
+ AWSCredentials credentials;
Aws::String accessKey, secretKey, token, expire;
- if (credentialsView.KeyExists("AccessKeyId"))
- {
- credentials.SetAWSAccessKeyId(credentialsView.GetString("AccessKeyId"));
- }
+ if (credentialsView.KeyExists("AccessKeyId"))
+ {
+ credentials.SetAWSAccessKeyId(credentialsView.GetString("AccessKeyId"));
+ }
- if (credentialsView.KeyExists("SecretAccessKey"))
- {
- credentials.SetAWSSecretKey(credentialsView.GetString("SecretAccessKey"));
- }
+ if (credentialsView.KeyExists("SecretAccessKey"))
+ {
+ credentials.SetAWSSecretKey(credentialsView.GetString("SecretAccessKey"));
+ }
- if (credentialsView.KeyExists("SessionToken"))
+ if (credentialsView.KeyExists("SessionToken"))
{
- credentials.SetSessionToken(credentialsView.GetString("SessionToken"));
+ credentials.SetSessionToken(credentialsView.GetString("SessionToken"));
}
- if (credentialsView.KeyExists("Expiration"))
+ if (credentialsView.KeyExists("Expiration"))
{
- const auto expiration = Aws::Utils::DateTime(credentialsView.GetString("Expiration"), DateFormat::ISO_8601);
- if (expiration.WasParseSuccessful())
- {
- credentials.SetExpiration(expiration);
- }
- else
- {
- AWS_LOGSTREAM_ERROR(PROFILE_LOG_TAG, "Failed to parse credential's expiration value as an ISO 8601 Date. Credentials will be marked expired.");
- credentials.SetExpiration(Aws::Utils::DateTime::Now());
- }
+ const auto expiration = Aws::Utils::DateTime(credentialsView.GetString("Expiration"), DateFormat::ISO_8601);
+ if (expiration.WasParseSuccessful())
+ {
+ credentials.SetExpiration(expiration);
+ }
+ else
+ {
+ AWS_LOGSTREAM_ERROR(PROFILE_LOG_TAG, "Failed to parse credential's expiration value as an ISO 8601 Date. Credentials will be marked expired.");
+ credentials.SetExpiration(Aws::Utils::DateTime::Now());
+ }
+ }
+ else
+ {
+ credentials.SetExpiration((std::chrono::time_point<std::chrono::system_clock>::max)());
}
- else
- {
- credentials.SetExpiration((std::chrono::time_point<std::chrono::system_clock>::max)());
- }
- AWS_LOGSTREAM_DEBUG(PROFILE_LOG_TAG, "Successfully pulled credentials from process credential with AccessKey: " << accessKey << ", Expiration:" << credentialsView.GetString("Expiration"));
- return credentials;
+ AWS_LOGSTREAM_DEBUG(PROFILE_LOG_TAG, "Successfully pulled credentials from process credential with AccessKey: " << accessKey << ", Expiration:" << credentialsView.GetString("Expiration"));
+ return credentials;
}
-
+
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/auth/AWSCredentialsProviderChain.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/auth/AWSCredentialsProviderChain.cpp
index 999928c8f65..373136d96a8 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/auth/AWSCredentialsProviderChain.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/auth/AWSCredentialsProviderChain.cpp
@@ -1,10 +1,10 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/auth/AWSCredentialsProviderChain.h>
-#include <aws/core/auth/STSCredentialsProvider.h>
+#include <aws/core/auth/STSCredentialsProvider.h>
#include <aws/core/platform/Environment.h>
#include <aws/core/utils/memory/AWSMemory.h>
#include <aws/core/utils/StringUtils.h>
@@ -20,7 +20,7 @@ static const char DefaultCredentialsProviderChainTag[] = "DefaultAWSCredentialsP
AWSCredentials AWSCredentialsProviderChain::GetAWSCredentials()
{
- for (auto&& credentialsProvider : m_providerChain)
+ for (auto&& credentialsProvider : m_providerChain)
{
AWSCredentials credentials = credentialsProvider->GetAWSCredentials();
if (!credentials.GetAWSAccessKeyId().empty() && !credentials.GetAWSSecretKey().empty())
@@ -29,16 +29,16 @@ AWSCredentials AWSCredentialsProviderChain::GetAWSCredentials()
}
}
- return AWSCredentials();
+ return AWSCredentials();
}
DefaultAWSCredentialsProviderChain::DefaultAWSCredentialsProviderChain() : AWSCredentialsProviderChain()
{
AddProvider(Aws::MakeShared<EnvironmentAWSCredentialsProvider>(DefaultCredentialsProviderChainTag));
AddProvider(Aws::MakeShared<ProfileConfigFileAWSCredentialsProvider>(DefaultCredentialsProviderChainTag));
- AddProvider(Aws::MakeShared<ProcessCredentialsProvider>(DefaultCredentialsProviderChainTag));
- AddProvider(Aws::MakeShared<STSAssumeRoleWebIdentityCredentialsProvider>(DefaultCredentialsProviderChainTag));
-
+ AddProvider(Aws::MakeShared<ProcessCredentialsProvider>(DefaultCredentialsProviderChainTag));
+ AddProvider(Aws::MakeShared<STSAssumeRoleWebIdentityCredentialsProvider>(DefaultCredentialsProviderChainTag));
+
//ECS TaskRole Credentials only available when ENVIRONMENT VARIABLE is set
const auto relativeUri = Aws::Environment::GetEnv(AWS_ECS_CONTAINER_CREDENTIALS_RELATIVE_URI);
AWS_LOGSTREAM_DEBUG(DefaultCredentialsProviderChainTag, "The environment variable value " << AWS_ECS_CONTAINER_CREDENTIALS_RELATIVE_URI
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/auth/STSCredentialsProvider.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/auth/STSCredentialsProvider.cpp
index c8d2bb98e83..3f48c9e0c7d 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/auth/STSCredentialsProvider.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/auth/STSCredentialsProvider.cpp
@@ -1,163 +1,163 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
-
-
-#include <aws/core/auth/STSCredentialsProvider.h>
-#include <aws/core/config/AWSProfileConfigLoader.h>
-#include <aws/core/platform/Environment.h>
-#include <aws/core/platform/FileSystem.h>
-#include <aws/core/utils/logging/LogMacros.h>
-#include <aws/core/utils/StringUtils.h>
-#include <aws/core/utils/FileSystemUtils.h>
-#include <aws/core/client/SpecifiedRetryableErrorsRetryStrategy.h>
-#include <aws/core/utils/StringUtils.h>
-#include <aws/core/utils/UUID.h>
-#include <cstdlib>
-#include <fstream>
-#include <string.h>
-#include <climits>
-
-
-using namespace Aws::Utils;
-using namespace Aws::Utils::Logging;
-using namespace Aws::Auth;
-using namespace Aws::Internal;
-using namespace Aws::FileSystem;
-using namespace Aws::Client;
-using Aws::Utils::Threading::ReaderLockGuard;
-using Aws::Utils::Threading::WriterLockGuard;
-
-static const char STS_ASSUME_ROLE_WEB_IDENTITY_LOG_TAG[] = "STSAssumeRoleWithWebIdentityCredentialsProvider";
-STSAssumeRoleWebIdentityCredentialsProvider::STSAssumeRoleWebIdentityCredentialsProvider() :
- m_initialized(false)
-{
- // check environment variables
- Aws::String tmpRegion = Aws::Environment::GetEnv("AWS_DEFAULT_REGION");
- m_roleArn = Aws::Environment::GetEnv("AWS_ROLE_ARN");
- m_tokenFile = Aws::Environment::GetEnv("AWS_WEB_IDENTITY_TOKEN_FILE");
- m_sessionName = Aws::Environment::GetEnv("AWS_ROLE_SESSION_NAME");
-
- // check profile_config if either m_roleArn or m_tokenFile is not loaded from environment variable
- // region source is not enforced, but we need it to construct sts endpoint, if we can't find from environment, we should check if it's set in config file.
- if (m_roleArn.empty() || m_tokenFile.empty() || tmpRegion.empty())
- {
- auto profile = Aws::Config::GetCachedConfigProfile(Aws::Auth::GetConfigProfileName());
- if (tmpRegion.empty())
- {
- tmpRegion = profile.GetRegion();
- }
- // If either of these two were not found from environment, use whatever found for all three in config file
- if (m_roleArn.empty() || m_tokenFile.empty())
- {
- m_roleArn = profile.GetRoleArn();
- m_tokenFile = profile.GetValue("web_identity_token_file");
- m_sessionName = profile.GetValue("role_session_name");
- }
- }
-
- if (m_tokenFile.empty())
- {
- AWS_LOGSTREAM_WARN(STS_ASSUME_ROLE_WEB_IDENTITY_LOG_TAG, "Token file must be specified to use STS AssumeRole web identity creds provider.");
- return; // No need to do further constructing
- }
- else
- {
- AWS_LOGSTREAM_DEBUG(STS_ASSUME_ROLE_WEB_IDENTITY_LOG_TAG, "Resolved token_file from profile_config or environment variable to be " << m_tokenFile);
- }
-
- if (m_roleArn.empty())
- {
- AWS_LOGSTREAM_WARN(STS_ASSUME_ROLE_WEB_IDENTITY_LOG_TAG, "RoleArn must be specified to use STS AssumeRole web identity creds provider.");
- return; // No need to do further constructing
- }
- else
- {
- AWS_LOGSTREAM_DEBUG(STS_ASSUME_ROLE_WEB_IDENTITY_LOG_TAG, "Resolved role_arn from profile_config or environment variable to be " << m_roleArn);
- }
-
- if (tmpRegion.empty())
- {
- tmpRegion = Aws::Region::US_EAST_1;
- }
- else
- {
- AWS_LOGSTREAM_DEBUG(STS_ASSUME_ROLE_WEB_IDENTITY_LOG_TAG, "Resolved region from profile_config or environment variable to be " << tmpRegion);
- }
-
- if (m_sessionName.empty())
- {
- m_sessionName = Aws::Utils::UUID::RandomUUID();
- }
- else
- {
- AWS_LOGSTREAM_DEBUG(STS_ASSUME_ROLE_WEB_IDENTITY_LOG_TAG, "Resolved session_name from profile_config or environment variable to be " << m_sessionName);
- }
-
- Aws::Client::ClientConfiguration config;
- config.scheme = Aws::Http::Scheme::HTTPS;
- config.region = tmpRegion;
-
- Aws::Vector<Aws::String> retryableErrors;
- retryableErrors.push_back("IDPCommunicationError");
- retryableErrors.push_back("InvalidIdentityToken");
-
- config.retryStrategy = Aws::MakeShared<SpecifiedRetryableErrorsRetryStrategy>(STS_ASSUME_ROLE_WEB_IDENTITY_LOG_TAG, retryableErrors, 3/*maxRetries*/);
-
- m_client = Aws::MakeUnique<Aws::Internal::STSCredentialsClient>(STS_ASSUME_ROLE_WEB_IDENTITY_LOG_TAG, config);
- m_initialized = true;
- AWS_LOGSTREAM_INFO(STS_ASSUME_ROLE_WEB_IDENTITY_LOG_TAG, "Creating STS AssumeRole with web identity creds provider.");
-}
-
-AWSCredentials STSAssumeRoleWebIdentityCredentialsProvider::GetAWSCredentials()
-{
- // A valid client means required information like role arn and token file were constructed correctly.
- // We can use this provider to load creds, otherwise, we can just return empty creds.
- if (!m_initialized)
- {
- return Aws::Auth::AWSCredentials();
- }
- RefreshIfExpired();
- ReaderLockGuard guard(m_reloadLock);
- return m_credentials;
-}
-
-void STSAssumeRoleWebIdentityCredentialsProvider::Reload()
-{
- AWS_LOGSTREAM_INFO(STS_ASSUME_ROLE_WEB_IDENTITY_LOG_TAG, "Credentials have expired, attempting to renew from STS.");
-
- Aws::IFStream tokenFile(m_tokenFile.c_str());
- if(tokenFile)
- {
- Aws::String token((std::istreambuf_iterator<char>(tokenFile)), std::istreambuf_iterator<char>());
- m_token = token;
- }
- else
- {
- AWS_LOGSTREAM_ERROR(STS_ASSUME_ROLE_WEB_IDENTITY_LOG_TAG, "Can't open token file: " << m_tokenFile);
- return;
- }
- STSCredentialsClient::STSAssumeRoleWithWebIdentityRequest request {m_sessionName, m_roleArn, m_token};
-
- auto result = m_client->GetAssumeRoleWithWebIdentityCredentials(request);
- AWS_LOGSTREAM_TRACE(STS_ASSUME_ROLE_WEB_IDENTITY_LOG_TAG, "Successfully retrieved credentials with AWS_ACCESS_KEY: " << result.creds.GetAWSAccessKeyId());
- m_credentials = result.creds;
-}
-
-void STSAssumeRoleWebIdentityCredentialsProvider::RefreshIfExpired()
-{
- ReaderLockGuard guard(m_reloadLock);
- if (!m_credentials.IsExpiredOrEmpty())
- {
- return;
- }
-
- guard.UpgradeToWriterLock();
- if (!m_credentials.IsExpiredOrEmpty()) // double-checked lock to avoid refreshing twice
- {
- return;
- }
-
- Reload();
-}
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
+
+
+#include <aws/core/auth/STSCredentialsProvider.h>
+#include <aws/core/config/AWSProfileConfigLoader.h>
+#include <aws/core/platform/Environment.h>
+#include <aws/core/platform/FileSystem.h>
+#include <aws/core/utils/logging/LogMacros.h>
+#include <aws/core/utils/StringUtils.h>
+#include <aws/core/utils/FileSystemUtils.h>
+#include <aws/core/client/SpecifiedRetryableErrorsRetryStrategy.h>
+#include <aws/core/utils/StringUtils.h>
+#include <aws/core/utils/UUID.h>
+#include <cstdlib>
+#include <fstream>
+#include <string.h>
+#include <climits>
+
+
+using namespace Aws::Utils;
+using namespace Aws::Utils::Logging;
+using namespace Aws::Auth;
+using namespace Aws::Internal;
+using namespace Aws::FileSystem;
+using namespace Aws::Client;
+using Aws::Utils::Threading::ReaderLockGuard;
+using Aws::Utils::Threading::WriterLockGuard;
+
+static const char STS_ASSUME_ROLE_WEB_IDENTITY_LOG_TAG[] = "STSAssumeRoleWithWebIdentityCredentialsProvider";
+STSAssumeRoleWebIdentityCredentialsProvider::STSAssumeRoleWebIdentityCredentialsProvider() :
+ m_initialized(false)
+{
+ // check environment variables
+ Aws::String tmpRegion = Aws::Environment::GetEnv("AWS_DEFAULT_REGION");
+ m_roleArn = Aws::Environment::GetEnv("AWS_ROLE_ARN");
+ m_tokenFile = Aws::Environment::GetEnv("AWS_WEB_IDENTITY_TOKEN_FILE");
+ m_sessionName = Aws::Environment::GetEnv("AWS_ROLE_SESSION_NAME");
+
+ // check profile_config if either m_roleArn or m_tokenFile is not loaded from environment variable
+ // region source is not enforced, but we need it to construct sts endpoint, if we can't find from environment, we should check if it's set in config file.
+ if (m_roleArn.empty() || m_tokenFile.empty() || tmpRegion.empty())
+ {
+ auto profile = Aws::Config::GetCachedConfigProfile(Aws::Auth::GetConfigProfileName());
+ if (tmpRegion.empty())
+ {
+ tmpRegion = profile.GetRegion();
+ }
+ // If either of these two were not found from environment, use whatever found for all three in config file
+ if (m_roleArn.empty() || m_tokenFile.empty())
+ {
+ m_roleArn = profile.GetRoleArn();
+ m_tokenFile = profile.GetValue("web_identity_token_file");
+ m_sessionName = profile.GetValue("role_session_name");
+ }
+ }
+
+ if (m_tokenFile.empty())
+ {
+ AWS_LOGSTREAM_WARN(STS_ASSUME_ROLE_WEB_IDENTITY_LOG_TAG, "Token file must be specified to use STS AssumeRole web identity creds provider.");
+ return; // No need to do further constructing
+ }
+ else
+ {
+ AWS_LOGSTREAM_DEBUG(STS_ASSUME_ROLE_WEB_IDENTITY_LOG_TAG, "Resolved token_file from profile_config or environment variable to be " << m_tokenFile);
+ }
+
+ if (m_roleArn.empty())
+ {
+ AWS_LOGSTREAM_WARN(STS_ASSUME_ROLE_WEB_IDENTITY_LOG_TAG, "RoleArn must be specified to use STS AssumeRole web identity creds provider.");
+ return; // No need to do further constructing
+ }
+ else
+ {
+ AWS_LOGSTREAM_DEBUG(STS_ASSUME_ROLE_WEB_IDENTITY_LOG_TAG, "Resolved role_arn from profile_config or environment variable to be " << m_roleArn);
+ }
+
+ if (tmpRegion.empty())
+ {
+ tmpRegion = Aws::Region::US_EAST_1;
+ }
+ else
+ {
+ AWS_LOGSTREAM_DEBUG(STS_ASSUME_ROLE_WEB_IDENTITY_LOG_TAG, "Resolved region from profile_config or environment variable to be " << tmpRegion);
+ }
+
+ if (m_sessionName.empty())
+ {
+ m_sessionName = Aws::Utils::UUID::RandomUUID();
+ }
+ else
+ {
+ AWS_LOGSTREAM_DEBUG(STS_ASSUME_ROLE_WEB_IDENTITY_LOG_TAG, "Resolved session_name from profile_config or environment variable to be " << m_sessionName);
+ }
+
+ Aws::Client::ClientConfiguration config;
+ config.scheme = Aws::Http::Scheme::HTTPS;
+ config.region = tmpRegion;
+
+ Aws::Vector<Aws::String> retryableErrors;
+ retryableErrors.push_back("IDPCommunicationError");
+ retryableErrors.push_back("InvalidIdentityToken");
+
+ config.retryStrategy = Aws::MakeShared<SpecifiedRetryableErrorsRetryStrategy>(STS_ASSUME_ROLE_WEB_IDENTITY_LOG_TAG, retryableErrors, 3/*maxRetries*/);
+
+ m_client = Aws::MakeUnique<Aws::Internal::STSCredentialsClient>(STS_ASSUME_ROLE_WEB_IDENTITY_LOG_TAG, config);
+ m_initialized = true;
+ AWS_LOGSTREAM_INFO(STS_ASSUME_ROLE_WEB_IDENTITY_LOG_TAG, "Creating STS AssumeRole with web identity creds provider.");
+}
+
+AWSCredentials STSAssumeRoleWebIdentityCredentialsProvider::GetAWSCredentials()
+{
+ // A valid client means required information like role arn and token file were constructed correctly.
+ // We can use this provider to load creds, otherwise, we can just return empty creds.
+ if (!m_initialized)
+ {
+ return Aws::Auth::AWSCredentials();
+ }
+ RefreshIfExpired();
+ ReaderLockGuard guard(m_reloadLock);
+ return m_credentials;
+}
+
+void STSAssumeRoleWebIdentityCredentialsProvider::Reload()
+{
+ AWS_LOGSTREAM_INFO(STS_ASSUME_ROLE_WEB_IDENTITY_LOG_TAG, "Credentials have expired, attempting to renew from STS.");
+
+ Aws::IFStream tokenFile(m_tokenFile.c_str());
+ if(tokenFile)
+ {
+ Aws::String token((std::istreambuf_iterator<char>(tokenFile)), std::istreambuf_iterator<char>());
+ m_token = token;
+ }
+ else
+ {
+ AWS_LOGSTREAM_ERROR(STS_ASSUME_ROLE_WEB_IDENTITY_LOG_TAG, "Can't open token file: " << m_tokenFile);
+ return;
+ }
+ STSCredentialsClient::STSAssumeRoleWithWebIdentityRequest request {m_sessionName, m_roleArn, m_token};
+
+ auto result = m_client->GetAssumeRoleWithWebIdentityCredentials(request);
+ AWS_LOGSTREAM_TRACE(STS_ASSUME_ROLE_WEB_IDENTITY_LOG_TAG, "Successfully retrieved credentials with AWS_ACCESS_KEY: " << result.creds.GetAWSAccessKeyId());
+ m_credentials = result.creds;
+}
+
+void STSAssumeRoleWebIdentityCredentialsProvider::RefreshIfExpired()
+{
+ ReaderLockGuard guard(m_reloadLock);
+ if (!m_credentials.IsExpiredOrEmpty())
+ {
+ return;
+ }
+
+ guard.UpgradeToWriterLock();
+ if (!m_credentials.IsExpiredOrEmpty()) // double-checked lock to avoid refreshing twice
+ {
+ return;
+ }
+
+ Reload();
+}
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/client/AWSClient.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/client/AWSClient.cpp
index 8fa8421b49d..e1ff064840f 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/client/AWSClient.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/client/AWSClient.cpp
@@ -1,6 +1,6 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/core/client/AWSClient.h>
@@ -16,7 +16,7 @@
#include <aws/core/http/HttpClientFactory.h>
#include <aws/core/http/HttpResponse.h>
#include <aws/core/http/standard/StandardHttpResponse.h>
-#include <aws/core/http/URI.h>
+#include <aws/core/http/URI.h>
#include <aws/core/utils/stream/ResponseStream.h>
#include <aws/core/utils/json/JsonSerializer.h>
#include <aws/core/utils/Outcome.h>
@@ -29,13 +29,13 @@
#include <aws/core/utils/crypto/MD5.h>
#include <aws/core/utils/HashingUtils.h>
#include <aws/core/utils/crypto/Factories.h>
-#include <aws/core/utils/event/EventStream.h>
-#include <aws/core/utils/UUID.h>
+#include <aws/core/utils/event/EventStream.h>
+#include <aws/core/utils/UUID.h>
#include <aws/core/monitoring/MonitoringManager.h>
-#include <aws/core/Region.h>
-#include <aws/core/utils/DNS.h>
-#include <aws/core/Version.h>
-#include <aws/core/platform/OSVersionInfo.h>
+#include <aws/core/Region.h>
+#include <aws/core/utils/DNS.h>
+#include <aws/core/Version.h>
+#include <aws/core/platform/OSVersionInfo.h>
#include <cstring>
#include <cassert>
@@ -52,7 +52,7 @@ static const int SUCCESS_RESPONSE_MAX = 299;
static const char AWS_CLIENT_LOG_TAG[] = "AWSClient";
//4 Minutes
-static const std::chrono::milliseconds TIME_DIFF_MAX = std::chrono::minutes(4);
+static const std::chrono::milliseconds TIME_DIFF_MAX = std::chrono::minutes(4);
//-4 Minutes
static const std::chrono::milliseconds TIME_DIFF_MIN = std::chrono::minutes(-4);
@@ -67,36 +67,36 @@ static CoreErrors GuessBodylessErrorType(Aws::Http::HttpResponseCode responseCod
return CoreErrors::RESOURCE_NOT_FOUND;
default:
return CoreErrors::UNKNOWN;
- }
+ }
}
-struct RequestInfo
-{
- Aws::Utils::DateTime ttl;
- long attempt;
- long maxAttempts;
-
- operator String()
- {
- Aws::StringStream ss;
- if (ttl.WasParseSuccessful() && ttl != DateTime())
- {
- assert(attempt > 1);
- ss << "ttl=" << ttl.ToGmtString(DateFormat::ISO_8601_BASIC) << "; ";
- }
- ss << "attempt=" << attempt;
- if (maxAttempts > 0)
- {
- ss << "; max=" << maxAttempts;
- }
- return ss.str();
- }
-};
-
+struct RequestInfo
+{
+ Aws::Utils::DateTime ttl;
+ long attempt;
+ long maxAttempts;
+
+ operator String()
+ {
+ Aws::StringStream ss;
+ if (ttl.WasParseSuccessful() && ttl != DateTime())
+ {
+ assert(attempt > 1);
+ ss << "ttl=" << ttl.ToGmtString(DateFormat::ISO_8601_BASIC) << "; ";
+ }
+ ss << "attempt=" << attempt;
+ if (maxAttempts > 0)
+ {
+ ss << "; max=" << maxAttempts;
+ }
+ return ss.str();
+ }
+};
+
AWSClient::AWSClient(const Aws::Client::ClientConfiguration& configuration,
const std::shared_ptr<Aws::Client::AWSAuthSigner>& signer,
const std::shared_ptr<AWSErrorMarshaller>& errorMarshaller) :
- m_region(configuration.region),
+ m_region(configuration.region),
m_httpClient(CreateHttpClient(configuration)),
m_signerProvider(Aws::MakeUnique<Aws::Auth::DefaultAuthSignerProvider>(AWS_CLIENT_LOG_TAG, signer)),
m_errorMarshaller(errorMarshaller),
@@ -104,18 +104,18 @@ AWSClient::AWSClient(const Aws::Client::ClientConfiguration& configuration,
m_writeRateLimiter(configuration.writeRateLimiter),
m_readRateLimiter(configuration.readRateLimiter),
m_userAgent(configuration.userAgent),
- m_customizedUserAgent(!m_userAgent.empty()),
+ m_customizedUserAgent(!m_userAgent.empty()),
m_hash(Aws::Utils::Crypto::CreateMD5Implementation()),
- m_requestTimeoutMs(configuration.requestTimeoutMs),
+ m_requestTimeoutMs(configuration.requestTimeoutMs),
m_enableClockSkewAdjustment(configuration.enableClockSkewAdjustment)
{
- SetServiceClientName("AWSBaseClient");
+ SetServiceClientName("AWSBaseClient");
}
AWSClient::AWSClient(const Aws::Client::ClientConfiguration& configuration,
const std::shared_ptr<Aws::Auth::AWSAuthSignerProvider>& signerProvider,
const std::shared_ptr<AWSErrorMarshaller>& errorMarshaller) :
- m_region(configuration.region),
+ m_region(configuration.region),
m_httpClient(CreateHttpClient(configuration)),
m_signerProvider(signerProvider),
m_errorMarshaller(errorMarshaller),
@@ -123,33 +123,33 @@ AWSClient::AWSClient(const Aws::Client::ClientConfiguration& configuration,
m_writeRateLimiter(configuration.writeRateLimiter),
m_readRateLimiter(configuration.readRateLimiter),
m_userAgent(configuration.userAgent),
- m_customizedUserAgent(!m_userAgent.empty()),
+ m_customizedUserAgent(!m_userAgent.empty()),
m_hash(Aws::Utils::Crypto::CreateMD5Implementation()),
- m_requestTimeoutMs(configuration.requestTimeoutMs),
+ m_requestTimeoutMs(configuration.requestTimeoutMs),
m_enableClockSkewAdjustment(configuration.enableClockSkewAdjustment)
{
- SetServiceClientName("AWSBaseClient");
+ SetServiceClientName("AWSBaseClient");
+}
+
+void AWSClient::SetServiceClientName(const Aws::String& name)
+{
+ m_serviceName = name;
+ if (!m_customizedUserAgent)
+ {
+ Aws::StringStream ss;
+ ss << "aws-sdk-cpp/" << Version::GetVersionString() << "/" << m_serviceName << "/" << Aws::OSVersionInfo::ComputeOSVersionString()
+ << " " << Version::GetCompilerVersionString();
+ m_userAgent = ss.str();
+ }
}
-void AWSClient::SetServiceClientName(const Aws::String& name)
-{
- m_serviceName = name;
- if (!m_customizedUserAgent)
- {
- Aws::StringStream ss;
- ss << "aws-sdk-cpp/" << Version::GetVersionString() << "/" << m_serviceName << "/" << Aws::OSVersionInfo::ComputeOSVersionString()
- << " " << Version::GetCompilerVersionString();
- m_userAgent = ss.str();
- }
+void AWSClient::DisableRequestProcessing()
+{
+ m_httpClient->DisableRequestProcessing();
}
-void AWSClient::DisableRequestProcessing()
-{
- m_httpClient->DisableRequestProcessing();
-}
-
-void AWSClient::EnableRequestProcessing()
-{
+void AWSClient::EnableRequestProcessing()
+{
m_httpClient->EnableRequestProcessing();
}
@@ -159,34 +159,34 @@ Aws::Client::AWSAuthSigner* AWSClient::GetSignerByName(const char* name) const
return signer ? signer.get() : nullptr;
}
-static DateTime GetServerTimeFromError(const AWSError<CoreErrors> error)
-{
- const Http::HeaderValueCollection& headers = error.GetResponseHeaders();
- auto awsDateHeaderIter = headers.find(StringUtils::ToLower(Http::AWS_DATE_HEADER));
- auto dateHeaderIter = headers.find(StringUtils::ToLower(Http::DATE_HEADER));
- if (awsDateHeaderIter != headers.end())
- {
- return DateTime(awsDateHeaderIter->second.c_str(), DateFormat::AutoDetect);
- }
- else if (dateHeaderIter != headers.end())
- {
- return DateTime(dateHeaderIter->second.c_str(), DateFormat::AutoDetect);
- }
- else
- {
- return DateTime();
- }
-}
-
+static DateTime GetServerTimeFromError(const AWSError<CoreErrors> error)
+{
+ const Http::HeaderValueCollection& headers = error.GetResponseHeaders();
+ auto awsDateHeaderIter = headers.find(StringUtils::ToLower(Http::AWS_DATE_HEADER));
+ auto dateHeaderIter = headers.find(StringUtils::ToLower(Http::DATE_HEADER));
+ if (awsDateHeaderIter != headers.end())
+ {
+ return DateTime(awsDateHeaderIter->second.c_str(), DateFormat::AutoDetect);
+ }
+ else if (dateHeaderIter != headers.end())
+ {
+ return DateTime(dateHeaderIter->second.c_str(), DateFormat::AutoDetect);
+ }
+ else
+ {
+ return DateTime();
+ }
+}
+
bool AWSClient::AdjustClockSkew(HttpResponseOutcome& outcome, const char* signerName) const
{
if (m_enableClockSkewAdjustment)
{
auto signer = GetSignerByName(signerName);
- //detect clock skew and try to correct.
+ //detect clock skew and try to correct.
AWS_LOGSTREAM_WARN(AWS_CLIENT_LOG_TAG, "If the signature check failed. This could be because of a time skew. Attempting to adjust the signer.");
- DateTime serverTime = GetServerTimeFromError(outcome.GetError());
+ DateTime serverTime = GetServerTimeFromError(outcome.GetError());
const auto signingTimestamp = signer->GetSigningTimestamp();
if (!serverTime.WasParseSuccessful() || serverTime == DateTime())
{
@@ -202,11 +202,11 @@ bool AWSClient::AdjustClockSkew(HttpResponseOutcome& outcome, const char* signer
diff = DateTime::Diff(serverTime, DateTime::Now());
AWS_LOGSTREAM_INFO(AWS_CLIENT_LOG_TAG, "Computed time difference as " << diff.count() << " milliseconds. Adjusting signer with the skew.");
signer->SetClockSkew(diff);
- AWSError<CoreErrors> newError(
+ AWSError<CoreErrors> newError(
outcome.GetError().GetErrorType(), outcome.GetError().GetExceptionName(), outcome.GetError().GetMessage(), true);
newError.SetResponseHeaders(outcome.GetError().GetResponseHeaders());
newError.SetResponseCode(outcome.GetError().GetResponseCode());
- outcome = std::move(newError);
+ outcome = std::move(newError);
return true;
}
}
@@ -216,43 +216,43 @@ bool AWSClient::AdjustClockSkew(HttpResponseOutcome& outcome, const char* signer
HttpResponseOutcome AWSClient::AttemptExhaustively(const Aws::Http::URI& uri,
const Aws::AmazonWebServiceRequest& request,
HttpMethod method,
- const char* signerName,
- const char* signerRegionOverride,
- const char* signerServiceNameOverride) const
+ const char* signerName,
+ const char* signerRegionOverride,
+ const char* signerServiceNameOverride) const
{
- if (!Aws::Utils::IsValidHost(uri.GetAuthority()))
- {
- return HttpResponseOutcome(AWSError<CoreErrors>(CoreErrors::VALIDATION, "", "Invalid DNS Label found in URI host", false/*retryable*/));
- }
+ if (!Aws::Utils::IsValidHost(uri.GetAuthority()))
+ {
+ return HttpResponseOutcome(AWSError<CoreErrors>(CoreErrors::VALIDATION, "", "Invalid DNS Label found in URI host", false/*retryable*/));
+ }
std::shared_ptr<HttpRequest> httpRequest(CreateHttpRequest(uri, method, request.GetResponseStreamFactory()));
HttpResponseOutcome outcome;
- AWSError<CoreErrors> lastError;
+ AWSError<CoreErrors> lastError;
Aws::Monitoring::CoreMetricsCollection coreMetrics;
auto contexts = Aws::Monitoring::OnRequestStarted(this->GetServiceClientName(), request.GetServiceRequestName(), httpRequest);
- const char* signerRegion = signerRegionOverride;
- Aws::String regionFromResponse;
-
- Aws::String invocationId = UUID::RandomUUID();
- RequestInfo requestInfo;
- requestInfo.attempt = 1;
- requestInfo.maxAttempts = 0;
- httpRequest->SetHeaderValue(Http::SDK_INVOCATION_ID_HEADER, invocationId);
- httpRequest->SetHeaderValue(Http::SDK_REQUEST_HEADER, requestInfo);
-
+ const char* signerRegion = signerRegionOverride;
+ Aws::String regionFromResponse;
+
+ Aws::String invocationId = UUID::RandomUUID();
+ RequestInfo requestInfo;
+ requestInfo.attempt = 1;
+ requestInfo.maxAttempts = 0;
+ httpRequest->SetHeaderValue(Http::SDK_INVOCATION_ID_HEADER, invocationId);
+ httpRequest->SetHeaderValue(Http::SDK_REQUEST_HEADER, requestInfo);
+
for (long retries = 0;; retries++)
{
- m_retryStrategy->GetSendToken();
- httpRequest->SetEventStreamRequest(request.IsEventStreamRequest());
-
- outcome = AttemptOneRequest(httpRequest, request, signerName, signerRegion, signerServiceNameOverride);
- if (retries == 0)
- {
- m_retryStrategy->RequestBookkeeping(outcome);
- }
- else
- {
- m_retryStrategy->RequestBookkeeping(outcome, lastError);
- }
+ m_retryStrategy->GetSendToken();
+ httpRequest->SetEventStreamRequest(request.IsEventStreamRequest());
+
+ outcome = AttemptOneRequest(httpRequest, request, signerName, signerRegion, signerServiceNameOverride);
+ if (retries == 0)
+ {
+ m_retryStrategy->RequestBookkeeping(outcome);
+ }
+ else
+ {
+ m_retryStrategy->RequestBookkeeping(outcome, lastError);
+ }
coreMetrics.httpClientMetrics = httpRequest->GetRequestMetrics();
if (outcome.IsSuccess())
{
@@ -260,11 +260,11 @@ HttpResponseOutcome AWSClient::AttemptExhaustively(const Aws::Http::URI& uri,
AWS_LOGSTREAM_TRACE(AWS_CLIENT_LOG_TAG, "Request successful returning.");
break;
}
- lastError = outcome.GetError();
+ lastError = outcome.GetError();
+
+ DateTime serverTime = GetServerTimeFromError(outcome.GetError());
+ auto clockSkew = DateTime::Diff(serverTime, DateTime::Now());
- DateTime serverTime = GetServerTimeFromError(outcome.GetError());
- auto clockSkew = DateTime::Diff(serverTime, DateTime::Now());
-
Aws::Monitoring::OnRequestFailed(this->GetServiceClientName(), request.GetServiceRequestName(), httpRequest, outcome, coreMetrics, contexts);
if (!m_httpClient->IsRequestProcessingEnabled())
@@ -273,28 +273,28 @@ HttpResponseOutcome AWSClient::AttemptExhaustively(const Aws::Http::URI& uri,
break;
}
- // Adjust region
- bool retryWithCorrectRegion = false;
- HttpResponseCode httpResponseCode = outcome.GetError().GetResponseCode();
- if (httpResponseCode == HttpResponseCode::MOVED_PERMANENTLY || // 301
- httpResponseCode == HttpResponseCode::TEMPORARY_REDIRECT || // 307
- httpResponseCode == HttpResponseCode::BAD_REQUEST || // 400
- httpResponseCode == HttpResponseCode::FORBIDDEN) // 403
- {
- regionFromResponse = GetErrorMarshaller()->ExtractRegion(outcome.GetError());
- if (m_region == Aws::Region::AWS_GLOBAL && !regionFromResponse.empty() && regionFromResponse != signerRegion)
- {
- signerRegion = regionFromResponse.c_str();
- retryWithCorrectRegion = true;
- }
- }
-
+ // Adjust region
+ bool retryWithCorrectRegion = false;
+ HttpResponseCode httpResponseCode = outcome.GetError().GetResponseCode();
+ if (httpResponseCode == HttpResponseCode::MOVED_PERMANENTLY || // 301
+ httpResponseCode == HttpResponseCode::TEMPORARY_REDIRECT || // 307
+ httpResponseCode == HttpResponseCode::BAD_REQUEST || // 400
+ httpResponseCode == HttpResponseCode::FORBIDDEN) // 403
+ {
+ regionFromResponse = GetErrorMarshaller()->ExtractRegion(outcome.GetError());
+ if (m_region == Aws::Region::AWS_GLOBAL && !regionFromResponse.empty() && regionFromResponse != signerRegion)
+ {
+ signerRegion = regionFromResponse.c_str();
+ retryWithCorrectRegion = true;
+ }
+ }
+
long sleepMillis = m_retryStrategy->CalculateDelayBeforeNextRetry(outcome.GetError(), retries);
//AdjustClockSkew returns true means clock skew was the problem and skew was adjusted, false otherwise.
- //sleep if clock skew and region was NOT the problem. AdjustClockSkew may update error inside outcome.
- bool shouldSleep = !AdjustClockSkew(outcome, signerName) && !retryWithCorrectRegion;
+ //sleep if clock skew and region was NOT the problem. AdjustClockSkew may update error inside outcome.
+ bool shouldSleep = !AdjustClockSkew(outcome, signerName) && !retryWithCorrectRegion;
- if (!retryWithCorrectRegion && !m_retryStrategy->ShouldRetry(outcome.GetError(), retries))
+ if (!retryWithCorrectRegion && !m_retryStrategy->ShouldRetry(outcome.GetError(), retries))
{
break;
}
@@ -315,68 +315,68 @@ HttpResponseOutcome AWSClient::AttemptExhaustively(const Aws::Http::URI& uri,
{
m_httpClient->RetryRequestSleep(std::chrono::milliseconds(sleepMillis));
}
-
- Aws::Http::URI newUri = uri;
- Aws::String newEndpoint = GetErrorMarshaller()->ExtractEndpoint(outcome.GetError());
- if (!newEndpoint.empty())
- {
- newUri.SetAuthority(newEndpoint);
- }
- httpRequest = CreateHttpRequest(newUri, method, request.GetResponseStreamFactory());
-
- httpRequest->SetHeaderValue(Http::SDK_INVOCATION_ID_HEADER, invocationId);
- if (serverTime.WasParseSuccessful() && serverTime != DateTime())
- {
- requestInfo.ttl = DateTime::Now() + clockSkew + std::chrono::milliseconds(m_requestTimeoutMs);
- }
- requestInfo.attempt ++;
- requestInfo.maxAttempts = m_retryStrategy->GetMaxAttempts();
- httpRequest->SetHeaderValue(Http::SDK_REQUEST_HEADER, requestInfo);
+
+ Aws::Http::URI newUri = uri;
+ Aws::String newEndpoint = GetErrorMarshaller()->ExtractEndpoint(outcome.GetError());
+ if (!newEndpoint.empty())
+ {
+ newUri.SetAuthority(newEndpoint);
+ }
+ httpRequest = CreateHttpRequest(newUri, method, request.GetResponseStreamFactory());
+
+ httpRequest->SetHeaderValue(Http::SDK_INVOCATION_ID_HEADER, invocationId);
+ if (serverTime.WasParseSuccessful() && serverTime != DateTime())
+ {
+ requestInfo.ttl = DateTime::Now() + clockSkew + std::chrono::milliseconds(m_requestTimeoutMs);
+ }
+ requestInfo.attempt ++;
+ requestInfo.maxAttempts = m_retryStrategy->GetMaxAttempts();
+ httpRequest->SetHeaderValue(Http::SDK_REQUEST_HEADER, requestInfo);
Aws::Monitoring::OnRequestRetry(this->GetServiceClientName(), request.GetServiceRequestName(), httpRequest, contexts);
}
Aws::Monitoring::OnFinish(this->GetServiceClientName(), request.GetServiceRequestName(), httpRequest, contexts);
return outcome;
}
-HttpResponseOutcome AWSClient::AttemptExhaustively(const Aws::Http::URI& uri,
- HttpMethod method,
- const char* signerName,
- const char* requestName,
- const char* signerRegionOverride,
- const char* signerServiceNameOverride) const
+HttpResponseOutcome AWSClient::AttemptExhaustively(const Aws::Http::URI& uri,
+ HttpMethod method,
+ const char* signerName,
+ const char* requestName,
+ const char* signerRegionOverride,
+ const char* signerServiceNameOverride) const
{
- if (!Aws::Utils::IsValidHost(uri.GetAuthority()))
- {
- return HttpResponseOutcome(AWSError<CoreErrors>(CoreErrors::VALIDATION, "", "Invalid DNS Label found in URI host", false/*retryable*/));
- }
-
+ if (!Aws::Utils::IsValidHost(uri.GetAuthority()))
+ {
+ return HttpResponseOutcome(AWSError<CoreErrors>(CoreErrors::VALIDATION, "", "Invalid DNS Label found in URI host", false/*retryable*/));
+ }
+
std::shared_ptr<HttpRequest> httpRequest(CreateHttpRequest(uri, method, Aws::Utils::Stream::DefaultResponseStreamFactoryMethod));
HttpResponseOutcome outcome;
- AWSError<CoreErrors> lastError;
+ AWSError<CoreErrors> lastError;
Aws::Monitoring::CoreMetricsCollection coreMetrics;
auto contexts = Aws::Monitoring::OnRequestStarted(this->GetServiceClientName(), requestName, httpRequest);
- const char* signerRegion = signerRegionOverride;
- Aws::String regionFromResponse;
-
- Aws::String invocationId = UUID::RandomUUID();
- RequestInfo requestInfo;
- requestInfo.attempt = 1;
- requestInfo.maxAttempts = 0;
- httpRequest->SetHeaderValue(Http::SDK_INVOCATION_ID_HEADER, invocationId);
- httpRequest->SetHeaderValue(Http::SDK_REQUEST_HEADER, requestInfo);
-
+ const char* signerRegion = signerRegionOverride;
+ Aws::String regionFromResponse;
+
+ Aws::String invocationId = UUID::RandomUUID();
+ RequestInfo requestInfo;
+ requestInfo.attempt = 1;
+ requestInfo.maxAttempts = 0;
+ httpRequest->SetHeaderValue(Http::SDK_INVOCATION_ID_HEADER, invocationId);
+ httpRequest->SetHeaderValue(Http::SDK_REQUEST_HEADER, requestInfo);
+
for (long retries = 0;; retries++)
{
- m_retryStrategy->GetSendToken();
- outcome = AttemptOneRequest(httpRequest, signerName, requestName, signerRegion, signerServiceNameOverride);
- if (retries == 0)
- {
- m_retryStrategy->RequestBookkeeping(outcome);
- }
- else
- {
- m_retryStrategy->RequestBookkeeping(outcome, lastError);
- }
+ m_retryStrategy->GetSendToken();
+ outcome = AttemptOneRequest(httpRequest, signerName, requestName, signerRegion, signerServiceNameOverride);
+ if (retries == 0)
+ {
+ m_retryStrategy->RequestBookkeeping(outcome);
+ }
+ else
+ {
+ m_retryStrategy->RequestBookkeeping(outcome, lastError);
+ }
coreMetrics.httpClientMetrics = httpRequest->GetRequestMetrics();
if (outcome.IsSuccess())
{
@@ -384,11 +384,11 @@ HttpResponseOutcome AWSClient::AttemptExhaustively(const Aws::Http::URI& uri,
AWS_LOGSTREAM_TRACE(AWS_CLIENT_LOG_TAG, "Request successful returning.");
break;
}
- lastError = outcome.GetError();
+ lastError = outcome.GetError();
+
+ DateTime serverTime = GetServerTimeFromError(outcome.GetError());
+ auto clockSkew = DateTime::Diff(serverTime, DateTime::Now());
- DateTime serverTime = GetServerTimeFromError(outcome.GetError());
- auto clockSkew = DateTime::Diff(serverTime, DateTime::Now());
-
Aws::Monitoring::OnRequestFailed(this->GetServiceClientName(), requestName, httpRequest, outcome, coreMetrics, contexts);
if (!m_httpClient->IsRequestProcessingEnabled())
@@ -397,28 +397,28 @@ HttpResponseOutcome AWSClient::AttemptExhaustively(const Aws::Http::URI& uri,
break;
}
- // Adjust region
- bool retryWithCorrectRegion = false;
- HttpResponseCode httpResponseCode = outcome.GetError().GetResponseCode();
- if (httpResponseCode == HttpResponseCode::MOVED_PERMANENTLY || // 301
- httpResponseCode == HttpResponseCode::TEMPORARY_REDIRECT || // 307
- httpResponseCode == HttpResponseCode::BAD_REQUEST || // 400
- httpResponseCode == HttpResponseCode::FORBIDDEN) // 403
- {
- regionFromResponse = GetErrorMarshaller()->ExtractRegion(outcome.GetError());
- if (m_region == Aws::Region::AWS_GLOBAL && !regionFromResponse.empty() && regionFromResponse != signerRegion)
- {
- signerRegion = regionFromResponse.c_str();
- retryWithCorrectRegion = true;
- }
- }
-
+ // Adjust region
+ bool retryWithCorrectRegion = false;
+ HttpResponseCode httpResponseCode = outcome.GetError().GetResponseCode();
+ if (httpResponseCode == HttpResponseCode::MOVED_PERMANENTLY || // 301
+ httpResponseCode == HttpResponseCode::TEMPORARY_REDIRECT || // 307
+ httpResponseCode == HttpResponseCode::BAD_REQUEST || // 400
+ httpResponseCode == HttpResponseCode::FORBIDDEN) // 403
+ {
+ regionFromResponse = GetErrorMarshaller()->ExtractRegion(outcome.GetError());
+ if (m_region == Aws::Region::AWS_GLOBAL && !regionFromResponse.empty() && regionFromResponse != signerRegion)
+ {
+ signerRegion = regionFromResponse.c_str();
+ retryWithCorrectRegion = true;
+ }
+ }
+
long sleepMillis = m_retryStrategy->CalculateDelayBeforeNextRetry(outcome.GetError(), retries);
//AdjustClockSkew returns true means clock skew was the problem and skew was adjusted, false otherwise.
- //sleep if clock skew and region was NOT the problem. AdjustClockSkew may update error inside outcome.
- bool shouldSleep = !AdjustClockSkew(outcome, signerName) && !retryWithCorrectRegion;
+ //sleep if clock skew and region was NOT the problem. AdjustClockSkew may update error inside outcome.
+ bool shouldSleep = !AdjustClockSkew(outcome, signerName) && !retryWithCorrectRegion;
- if (!retryWithCorrectRegion && !m_retryStrategy->ShouldRetry(outcome.GetError(), retries))
+ if (!retryWithCorrectRegion && !m_retryStrategy->ShouldRetry(outcome.GetError(), retries))
{
break;
}
@@ -429,23 +429,23 @@ HttpResponseOutcome AWSClient::AttemptExhaustively(const Aws::Http::URI& uri,
{
m_httpClient->RetryRequestSleep(std::chrono::milliseconds(sleepMillis));
}
-
- Aws::Http::URI newUri = uri;
- Aws::String newEndpoint = GetErrorMarshaller()->ExtractEndpoint(outcome.GetError());
- if (!newEndpoint.empty())
- {
- newUri.SetAuthority(newEndpoint);
- }
- httpRequest = CreateHttpRequest(newUri, method, Aws::Utils::Stream::DefaultResponseStreamFactoryMethod);
-
- httpRequest->SetHeaderValue(Http::SDK_INVOCATION_ID_HEADER, invocationId);
- if (serverTime.WasParseSuccessful() && serverTime != DateTime())
- {
- requestInfo.ttl = DateTime::Now() + clockSkew + std::chrono::milliseconds(m_requestTimeoutMs);
- }
- requestInfo.attempt ++;
- requestInfo.maxAttempts = m_retryStrategy->GetMaxAttempts();
- httpRequest->SetHeaderValue(Http::SDK_REQUEST_HEADER, requestInfo);
+
+ Aws::Http::URI newUri = uri;
+ Aws::String newEndpoint = GetErrorMarshaller()->ExtractEndpoint(outcome.GetError());
+ if (!newEndpoint.empty())
+ {
+ newUri.SetAuthority(newEndpoint);
+ }
+ httpRequest = CreateHttpRequest(newUri, method, Aws::Utils::Stream::DefaultResponseStreamFactoryMethod);
+
+ httpRequest->SetHeaderValue(Http::SDK_INVOCATION_ID_HEADER, invocationId);
+ if (serverTime.WasParseSuccessful() && serverTime != DateTime())
+ {
+ requestInfo.ttl = DateTime::Now() + clockSkew + std::chrono::milliseconds(m_requestTimeoutMs);
+ }
+ requestInfo.attempt ++;
+ requestInfo.maxAttempts = m_retryStrategy->GetMaxAttempts();
+ httpRequest->SetHeaderValue(Http::SDK_REQUEST_HEADER, requestInfo);
Aws::Monitoring::OnRequestRetry(this->GetServiceClientName(), requestName, httpRequest, contexts);
}
Aws::Monitoring::OnFinish(this->GetServiceClientName(), requestName, httpRequest, contexts);
@@ -454,29 +454,29 @@ HttpResponseOutcome AWSClient::AttemptExhaustively(const Aws::Http::URI& uri,
static bool DoesResponseGenerateError(const std::shared_ptr<HttpResponse>& response)
{
- if (response->HasClientError()) return true;
+ if (response->HasClientError()) return true;
int responseCode = static_cast<int>(response->GetResponseCode());
return responseCode < SUCCESS_RESPONSE_MIN || responseCode > SUCCESS_RESPONSE_MAX;
}
-HttpResponseOutcome AWSClient::AttemptOneRequest(const std::shared_ptr<HttpRequest>& httpRequest, const Aws::AmazonWebServiceRequest& request,
- const char* signerName, const char* signerRegionOverride, const char* signerServiceNameOverride) const
+HttpResponseOutcome AWSClient::AttemptOneRequest(const std::shared_ptr<HttpRequest>& httpRequest, const Aws::AmazonWebServiceRequest& request,
+ const char* signerName, const char* signerRegionOverride, const char* signerServiceNameOverride) const
{
BuildHttpRequest(request, httpRequest);
auto signer = GetSignerByName(signerName);
- if (!signer->SignRequest(*httpRequest, signerRegionOverride, signerServiceNameOverride, request.SignBody()))
+ if (!signer->SignRequest(*httpRequest, signerRegionOverride, signerServiceNameOverride, request.SignBody()))
{
AWS_LOGSTREAM_ERROR(AWS_CLIENT_LOG_TAG, "Request signing failed. Returning error.");
return HttpResponseOutcome(AWSError<CoreErrors>(CoreErrors::CLIENT_SIGNING_FAILURE, "", "SDK failed to sign the request", false/*retryable*/));
}
- if (request.GetRequestSignedHandler())
- {
- request.GetRequestSignedHandler()(*httpRequest);
- }
-
+ if (request.GetRequestSignedHandler())
+ {
+ request.GetRequestSignedHandler()(*httpRequest);
+ }
+
AWS_LOGSTREAM_DEBUG(AWS_CLIENT_LOG_TAG, "Request Successfully signed");
std::shared_ptr<HttpResponse> httpResponse(
m_httpClient->MakeRequest(httpRequest, m_readRateLimiter.get(), m_writeRateLimiter.get()));
@@ -484,22 +484,22 @@ HttpResponseOutcome AWSClient::AttemptOneRequest(const std::shared_ptr<HttpReque
if (DoesResponseGenerateError(httpResponse))
{
AWS_LOGSTREAM_DEBUG(AWS_CLIENT_LOG_TAG, "Request returned error. Attempting to generate appropriate error codes from response");
- auto error = BuildAWSError(httpResponse);
- return HttpResponseOutcome(std::move(error));
+ auto error = BuildAWSError(httpResponse);
+ return HttpResponseOutcome(std::move(error));
}
AWS_LOGSTREAM_DEBUG(AWS_CLIENT_LOG_TAG, "Request returned successful response.");
- return HttpResponseOutcome(std::move(httpResponse));
+ return HttpResponseOutcome(std::move(httpResponse));
}
-HttpResponseOutcome AWSClient::AttemptOneRequest(const std::shared_ptr<HttpRequest>& httpRequest,
- const char* signerName, const char* requestName, const char* signerRegionOverride, const char* signerServiceNameOverride) const
+HttpResponseOutcome AWSClient::AttemptOneRequest(const std::shared_ptr<HttpRequest>& httpRequest,
+ const char* signerName, const char* requestName, const char* signerRegionOverride, const char* signerServiceNameOverride) const
{
AWS_UNREFERENCED_PARAM(requestName);
auto signer = GetSignerByName(signerName);
- if (!signer->SignRequest(*httpRequest, signerRegionOverride, signerServiceNameOverride, true))
+ if (!signer->SignRequest(*httpRequest, signerRegionOverride, signerServiceNameOverride, true))
{
AWS_LOGSTREAM_ERROR(AWS_CLIENT_LOG_TAG, "Request signing failed. Returning error.");
return HttpResponseOutcome(AWSError<CoreErrors>(CoreErrors::CLIENT_SIGNING_FAILURE, "", "SDK failed to sign the request", false/*retryable*/));
@@ -515,23 +515,23 @@ HttpResponseOutcome AWSClient::AttemptOneRequest(const std::shared_ptr<HttpReque
if (DoesResponseGenerateError(httpResponse))
{
AWS_LOGSTREAM_DEBUG(AWS_CLIENT_LOG_TAG, "Request returned error. Attempting to generate appropriate error codes from response");
- auto error = BuildAWSError(httpResponse);
- return HttpResponseOutcome(std::move(error));
+ auto error = BuildAWSError(httpResponse);
+ return HttpResponseOutcome(std::move(error));
}
AWS_LOGSTREAM_DEBUG(AWS_CLIENT_LOG_TAG, "Request returned successful response.");
- return HttpResponseOutcome(std::move(httpResponse));
+ return HttpResponseOutcome(std::move(httpResponse));
}
StreamOutcome AWSClient::MakeRequestWithUnparsedResponse(const Aws::Http::URI& uri,
const Aws::AmazonWebServiceRequest& request,
Http::HttpMethod method,
- const char* signerName,
- const char* signerRegionOverride,
- const char* signerServiceNameOverride) const
+ const char* signerName,
+ const char* signerRegionOverride,
+ const char* signerServiceNameOverride) const
{
- HttpResponseOutcome httpResponseOutcome = AttemptExhaustively(uri, request, method, signerName, signerRegionOverride, signerServiceNameOverride);
+ HttpResponseOutcome httpResponseOutcome = AttemptExhaustively(uri, request, method, signerName, signerRegionOverride, signerServiceNameOverride);
if (httpResponseOutcome.IsSuccess())
{
return StreamOutcome(AmazonWebServiceResult<Stream::ResponseStream>(
@@ -539,17 +539,17 @@ StreamOutcome AWSClient::MakeRequestWithUnparsedResponse(const Aws::Http::URI& u
httpResponseOutcome.GetResult()->GetHeaders(), httpResponseOutcome.GetResult()->GetResponseCode()));
}
- return StreamOutcome(std::move(httpResponseOutcome));
+ return StreamOutcome(std::move(httpResponseOutcome));
}
-StreamOutcome AWSClient::MakeRequestWithUnparsedResponse(const Aws::Http::URI& uri,
- Http::HttpMethod method,
- const char* signerName,
- const char* requestName,
- const char* signerRegionOverride,
- const char* signerServiceNameOverride) const
+StreamOutcome AWSClient::MakeRequestWithUnparsedResponse(const Aws::Http::URI& uri,
+ Http::HttpMethod method,
+ const char* signerName,
+ const char* requestName,
+ const char* signerRegionOverride,
+ const char* signerServiceNameOverride) const
{
- HttpResponseOutcome httpResponseOutcome = AttemptExhaustively(uri, method, signerName, requestName, signerRegionOverride, signerServiceNameOverride);
+ HttpResponseOutcome httpResponseOutcome = AttemptExhaustively(uri, method, signerName, requestName, signerRegionOverride, signerServiceNameOverride);
if (httpResponseOutcome.IsSuccess())
{
return StreamOutcome(AmazonWebServiceResult<Stream::ResponseStream>(
@@ -557,39 +557,39 @@ StreamOutcome AWSClient::MakeRequestWithUnparsedResponse(const Aws::Http::URI& u
httpResponseOutcome.GetResult()->GetHeaders(), httpResponseOutcome.GetResult()->GetResponseCode()));
}
- return StreamOutcome(std::move(httpResponseOutcome));
+ return StreamOutcome(std::move(httpResponseOutcome));
}
XmlOutcome AWSXMLClient::MakeRequestWithEventStream(const Aws::Http::URI& uri,
const Aws::AmazonWebServiceRequest& request,
Http::HttpMethod method,
- const char* signerName,
- const char* signerRegionOverride,
- const char* signerServiceNameOverride) const
+ const char* signerName,
+ const char* signerRegionOverride,
+ const char* signerServiceNameOverride) const
{
- HttpResponseOutcome httpOutcome = AttemptExhaustively(uri, request, method, signerName, signerRegionOverride, signerServiceNameOverride);
+ HttpResponseOutcome httpOutcome = AttemptExhaustively(uri, request, method, signerName, signerRegionOverride, signerServiceNameOverride);
if (httpOutcome.IsSuccess())
{
return XmlOutcome(AmazonWebServiceResult<XmlDocument>(XmlDocument(), httpOutcome.GetResult()->GetHeaders()));
}
- return XmlOutcome(std::move(httpOutcome));
+ return XmlOutcome(std::move(httpOutcome));
}
-XmlOutcome AWSXMLClient::MakeRequestWithEventStream(const Aws::Http::URI& uri,
- Http::HttpMethod method,
- const char* signerName,
- const char* requestName,
- const char* signerRegionOverride,
- const char* signerServiceNameOverride) const
+XmlOutcome AWSXMLClient::MakeRequestWithEventStream(const Aws::Http::URI& uri,
+ Http::HttpMethod method,
+ const char* signerName,
+ const char* requestName,
+ const char* signerRegionOverride,
+ const char* signerServiceNameOverride) const
{
- HttpResponseOutcome httpOutcome = AttemptExhaustively(uri, method, signerName, requestName, signerRegionOverride, signerServiceNameOverride);
+ HttpResponseOutcome httpOutcome = AttemptExhaustively(uri, method, signerName, requestName, signerRegionOverride, signerServiceNameOverride);
if (httpOutcome.IsSuccess())
{
return XmlOutcome(AmazonWebServiceResult<XmlDocument>(XmlDocument(), httpOutcome.GetResult()->GetHeaders()));
}
- return XmlOutcome(std::move(httpOutcome));
+ return XmlOutcome(std::move(httpOutcome));
}
void AWSClient::AddHeadersToRequest(const std::shared_ptr<Aws::Http::HttpRequest>& httpRequest,
@@ -604,7 +604,7 @@ void AWSClient::AddHeadersToRequest(const std::shared_ptr<Aws::Http::HttpRequest
}
void AWSClient::AddContentBodyToRequest(const std::shared_ptr<Aws::Http::HttpRequest>& httpRequest,
- const std::shared_ptr<Aws::IOStream>& body, bool needsContentMd5, bool isChunked) const
+ const std::shared_ptr<Aws::IOStream>& body, bool needsContentMd5, bool isChunked) const
{
httpRequest->AddContentBody(body);
@@ -616,8 +616,8 @@ void AWSClient::AddContentBodyToRequest(const std::shared_ptr<Aws::Http::HttpReq
AWS_LOGSTREAM_TRACE(AWS_CLIENT_LOG_TAG, "No content body, content-length headers");
if(httpRequest->GetMethod() == HttpMethod::HTTP_POST || httpRequest->GetMethod() == HttpMethod::HTTP_PUT)
- {
- httpRequest->SetHeaderValue(Http::CONTENT_LENGTH_HEADER, "0");
+ {
+ httpRequest->SetHeaderValue(Http::CONTENT_LENGTH_HEADER, "0");
}
else
{
@@ -625,20 +625,20 @@ void AWSClient::AddContentBodyToRequest(const std::shared_ptr<Aws::Http::HttpReq
}
}
- //Add transfer-encoding:chunked to header
- if (body && isChunked)
- {
- httpRequest->SetTransferEncoding(CHUNKED_VALUE);
- }
+ //Add transfer-encoding:chunked to header
+ if (body && isChunked)
+ {
+ httpRequest->SetTransferEncoding(CHUNKED_VALUE);
+ }
//in the scenario where we are adding a content body as a stream, the request object likely already
//has a content-length header set and we don't want to seek the stream just to find this information.
- else if (body && !httpRequest->HasHeader(Http::CONTENT_LENGTH_HEADER))
+ else if (body && !httpRequest->HasHeader(Http::CONTENT_LENGTH_HEADER))
{
- if (!m_httpClient->SupportsChunkedTransferEncoding())
- {
- AWS_LOGSTREAM_WARN(AWS_CLIENT_LOG_TAG, "This http client doesn't support transfer-encoding:chunked. " <<
- "The request may fail if it's not a seekable stream.");
- }
+ if (!m_httpClient->SupportsChunkedTransferEncoding())
+ {
+ AWS_LOGSTREAM_WARN(AWS_CLIENT_LOG_TAG, "This http client doesn't support transfer-encoding:chunked. " <<
+ "The request may fail if it's not a seekable stream.");
+ }
AWS_LOGSTREAM_TRACE(AWS_CLIENT_LOG_TAG, "Found body, but content-length has not been set, attempting to compute content-length");
body->seekg(0, body->end);
auto streamSize = body->tellg();
@@ -682,20 +682,20 @@ Aws::String Aws::Client::GetAuthorizationHeader(const Aws::Http::HttpRequest& ht
return authHeader.substr(signaturePosition + strlen(Aws::Auth::SIGNATURE) + 1);
}
-void AWSClient::BuildHttpRequest(const Aws::AmazonWebServiceRequest& request,
- const std::shared_ptr<HttpRequest>& httpRequest) const
+void AWSClient::BuildHttpRequest(const Aws::AmazonWebServiceRequest& request,
+ const std::shared_ptr<HttpRequest>& httpRequest) const
{
- //do headers first since the request likely will set content-length as it's own header.
+ //do headers first since the request likely will set content-length as it's own header.
AddHeadersToRequest(httpRequest, request.GetHeaders());
- if (request.IsEventStreamRequest())
+ if (request.IsEventStreamRequest())
{
- httpRequest->AddContentBody(request.GetBody());
+ httpRequest->AddContentBody(request.GetBody());
+ }
+ else
+ {
+ AddContentBodyToRequest(httpRequest, request.GetBody(), request.ShouldComputeContentMd5(), request.IsStreaming() && request.IsChunked() && m_httpClient->SupportsChunkedTransferEncoding());
}
- else
- {
- AddContentBodyToRequest(httpRequest, request.GetBody(), request.ShouldComputeContentMd5(), request.IsStreaming() && request.IsChunked() && m_httpClient->SupportsChunkedTransferEncoding());
- }
// Pass along handlers for processing data sent/received in bytes
httpRequest->SetDataReceivedEventHandler(request.GetDataReceivedEventHandler());
@@ -738,34 +738,34 @@ Aws::String AWSClient::GeneratePresignedUrl(URI& uri, HttpMethod method, const A
return {};
}
-Aws::String AWSClient::GeneratePresignedUrl(URI& uri, HttpMethod method, const char* region, long long expirationInSeconds) const
-{
- std::shared_ptr<HttpRequest> request = CreateHttpRequest(uri, method, Aws::Utils::Stream::DefaultResponseStreamFactoryMethod);
- auto signer = GetSignerByName(Aws::Auth::SIGV4_SIGNER);
- if (signer->PresignRequest(*request, region, expirationInSeconds))
- {
- return request->GetURIString();
- }
-
- return {};
-}
-
-Aws::String AWSClient::GeneratePresignedUrl(URI& uri, HttpMethod method, const char* region, const Aws::Http::HeaderValueCollection& customizedHeaders, long long expirationInSeconds)
-{
- std::shared_ptr<HttpRequest> request = CreateHttpRequest(uri, method, Aws::Utils::Stream::DefaultResponseStreamFactoryMethod);
- for (const auto& it: customizedHeaders)
- {
- request->SetHeaderValue(it.first.c_str(), it.second);
- }
- auto signer = GetSignerByName(Aws::Auth::SIGV4_SIGNER);
- if (signer->PresignRequest(*request, region, expirationInSeconds))
- {
- return request->GetURIString();
- }
-
- return {};
-}
-
+Aws::String AWSClient::GeneratePresignedUrl(URI& uri, HttpMethod method, const char* region, long long expirationInSeconds) const
+{
+ std::shared_ptr<HttpRequest> request = CreateHttpRequest(uri, method, Aws::Utils::Stream::DefaultResponseStreamFactoryMethod);
+ auto signer = GetSignerByName(Aws::Auth::SIGV4_SIGNER);
+ if (signer->PresignRequest(*request, region, expirationInSeconds))
+ {
+ return request->GetURIString();
+ }
+
+ return {};
+}
+
+Aws::String AWSClient::GeneratePresignedUrl(URI& uri, HttpMethod method, const char* region, const Aws::Http::HeaderValueCollection& customizedHeaders, long long expirationInSeconds)
+{
+ std::shared_ptr<HttpRequest> request = CreateHttpRequest(uri, method, Aws::Utils::Stream::DefaultResponseStreamFactoryMethod);
+ for (const auto& it: customizedHeaders)
+ {
+ request->SetHeaderValue(it.first.c_str(), it.second);
+ }
+ auto signer = GetSignerByName(Aws::Auth::SIGV4_SIGNER);
+ if (signer->PresignRequest(*request, region, expirationInSeconds))
+ {
+ return request->GetURIString();
+ }
+
+ return {};
+}
+
Aws::String AWSClient::GeneratePresignedUrl(Aws::Http::URI& uri, Aws::Http::HttpMethod method, const char* region, const char* serviceName, long long expirationInSeconds) const
{
std::shared_ptr<HttpRequest> request = CreateHttpRequest(uri, method, Aws::Utils::Stream::DefaultResponseStreamFactoryMethod);
@@ -778,15 +778,15 @@ Aws::String AWSClient::GeneratePresignedUrl(Aws::Http::URI& uri, Aws::Http::Http
return {};
}
-Aws::String AWSClient::GeneratePresignedUrl(Aws::Http::URI& uri, Aws::Http::HttpMethod method, const char* region, const char* serviceName, const Aws::Http::HeaderValueCollection& customizedHeaders, long long expirationInSeconds)
+Aws::String AWSClient::GeneratePresignedUrl(Aws::Http::URI& uri, Aws::Http::HttpMethod method, const char* region, const char* serviceName, const Aws::Http::HeaderValueCollection& customizedHeaders, long long expirationInSeconds)
{
std::shared_ptr<HttpRequest> request = CreateHttpRequest(uri, method, Aws::Utils::Stream::DefaultResponseStreamFactoryMethod);
- for (const auto& it: customizedHeaders)
- {
- request->SetHeaderValue(it.first.c_str(), it.second);
- }
+ for (const auto& it: customizedHeaders)
+ {
+ request->SetHeaderValue(it.first.c_str(), it.second);
+ }
auto signer = GetSignerByName(Aws::Auth::SIGV4_SIGNER);
- if (signer->PresignRequest(*request, region, serviceName, expirationInSeconds))
+ if (signer->PresignRequest(*request, region, serviceName, expirationInSeconds))
{
return request->GetURIString();
}
@@ -841,7 +841,7 @@ std::shared_ptr<Aws::Http::HttpRequest> AWSClient::ConvertToRequestForPresigning
{
request.PutToPresignedUrl(uri);
std::shared_ptr<HttpRequest> httpRequest = CreateHttpRequest(uri, method, Aws::Utils::Stream::DefaultResponseStreamFactoryMethod);
-
+
for (auto& param : extraParams)
{
httpRequest->AddQueryStringParameter(param.first.c_str(), param.second);
@@ -875,14 +875,14 @@ AWSJsonClient::AWSJsonClient(const Aws::Client::ClientConfiguration& configurati
JsonOutcome AWSJsonClient::MakeRequest(const Aws::Http::URI& uri,
const Aws::AmazonWebServiceRequest& request,
Http::HttpMethod method,
- const char* signerName,
- const char* signerRegionOverride,
- const char* signerServiceNameOverride) const
+ const char* signerName,
+ const char* signerRegionOverride,
+ const char* signerServiceNameOverride) const
{
- HttpResponseOutcome httpOutcome(BASECLASS::AttemptExhaustively(uri, request, method, signerName, signerRegionOverride, signerServiceNameOverride));
+ HttpResponseOutcome httpOutcome(BASECLASS::AttemptExhaustively(uri, request, method, signerName, signerRegionOverride, signerServiceNameOverride));
if (!httpOutcome.IsSuccess())
{
- return JsonOutcome(std::move(httpOutcome));
+ return JsonOutcome(std::move(httpOutcome));
}
if (httpOutcome.GetResult()->GetResponseBody().tellp() > 0)
@@ -898,14 +898,14 @@ JsonOutcome AWSJsonClient::MakeRequest(const Aws::Http::URI& uri,
JsonOutcome AWSJsonClient::MakeRequest(const Aws::Http::URI& uri,
Http::HttpMethod method,
const char* signerName,
- const char* requestName,
- const char* signerRegionOverride,
- const char* signerServiceNameOverride) const
+ const char* requestName,
+ const char* signerRegionOverride,
+ const char* signerServiceNameOverride) const
{
- HttpResponseOutcome httpOutcome(BASECLASS::AttemptExhaustively(uri, method, signerName, requestName, signerRegionOverride, signerServiceNameOverride));
+ HttpResponseOutcome httpOutcome(BASECLASS::AttemptExhaustively(uri, method, signerName, requestName, signerRegionOverride, signerServiceNameOverride));
if (!httpOutcome.IsSuccess())
{
- return JsonOutcome(std::move(httpOutcome));
+ return JsonOutcome(std::move(httpOutcome));
}
if (httpOutcome.GetResult()->GetResponseBody().tellp() > 0)
@@ -933,13 +933,13 @@ JsonOutcome AWSJsonClient::MakeEventStreamRequest(std::shared_ptr<Aws::Http::Htt
if (DoesResponseGenerateError(httpResponse))
{
AWS_LOGSTREAM_DEBUG(AWS_CLIENT_LOG_TAG, "Request returned error. Attempting to generate appropriate error codes from response");
- auto error = BuildAWSError(httpResponse);
- return JsonOutcome(std::move(error));
+ auto error = BuildAWSError(httpResponse);
+ return JsonOutcome(std::move(error));
}
AWS_LOGSTREAM_DEBUG(AWS_CLIENT_LOG_TAG, "Request returned successful response.");
- HttpResponseOutcome httpOutcome(std::move(httpResponse));
+ HttpResponseOutcome httpOutcome(std::move(httpResponse));
if (httpOutcome.GetResult()->GetResponseBody().tellp() > 0)
{
@@ -962,10 +962,10 @@ AWSError<CoreErrors> AWSJsonClient::BuildAWSError(
const std::shared_ptr<Aws::Http::HttpResponse>& httpResponse) const
{
AWSError<CoreErrors> error;
- if (httpResponse->HasClientError())
+ if (httpResponse->HasClientError())
{
- bool retryable = httpResponse->GetClientErrorType() == CoreErrors::NETWORK_CONNECTION ? true : false;
- error = AWSError<CoreErrors>(httpResponse->GetClientErrorType(), "", httpResponse->GetClientErrorMessage(), retryable);
+ bool retryable = httpResponse->GetClientErrorType() == CoreErrors::NETWORK_CONNECTION ? true : false;
+ error = AWSError<CoreErrors>(httpResponse->GetClientErrorType(), "", httpResponse->GetClientErrorMessage(), retryable);
}
else if (!httpResponse->GetResponseBody() || httpResponse->GetResponseBody().tellp() < 1)
{
@@ -985,7 +985,7 @@ AWSError<CoreErrors> AWSJsonClient::BuildAWSError(
error.SetResponseHeaders(httpResponse->GetHeaders());
error.SetResponseCode(httpResponse->GetResponseCode());
- error.SetRemoteHostIpAddress(httpResponse->GetOriginatingRequest().GetResolvedRemoteHost());
+ error.SetRemoteHostIpAddress(httpResponse->GetOriginatingRequest().GetResolvedRemoteHost());
AWS_LOGSTREAM_ERROR(AWS_CLIENT_LOG_TAG, error);
return error;
}
@@ -1008,14 +1008,14 @@ AWSXMLClient::AWSXMLClient(const Aws::Client::ClientConfiguration& configuration
XmlOutcome AWSXMLClient::MakeRequest(const Aws::Http::URI& uri,
const Aws::AmazonWebServiceRequest& request,
Http::HttpMethod method,
- const char* signerName,
- const char* signerRegionOverride,
- const char* signerServiceNameOverride) const
+ const char* signerName,
+ const char* signerRegionOverride,
+ const char* signerServiceNameOverride) const
{
- HttpResponseOutcome httpOutcome(BASECLASS::AttemptExhaustively(uri, request, method, signerName, signerRegionOverride, signerServiceNameOverride));
+ HttpResponseOutcome httpOutcome(BASECLASS::AttemptExhaustively(uri, request, method, signerName, signerRegionOverride, signerServiceNameOverride));
if (!httpOutcome.IsSuccess())
{
- return XmlOutcome(std::move(httpOutcome));
+ return XmlOutcome(std::move(httpOutcome));
}
if (httpOutcome.GetResult()->GetResponseBody().tellp() > 0)
@@ -1038,14 +1038,14 @@ XmlOutcome AWSXMLClient::MakeRequest(const Aws::Http::URI& uri,
XmlOutcome AWSXMLClient::MakeRequest(const Aws::Http::URI& uri,
Http::HttpMethod method,
const char* signerName,
- const char* requestName,
- const char* signerRegionOverride,
- const char* signerServiceNameOverride) const
+ const char* requestName,
+ const char* signerRegionOverride,
+ const char* signerServiceNameOverride) const
{
- HttpResponseOutcome httpOutcome(BASECLASS::AttemptExhaustively(uri, method, signerName, requestName, signerRegionOverride, signerServiceNameOverride));
+ HttpResponseOutcome httpOutcome(BASECLASS::AttemptExhaustively(uri, method, signerName, requestName, signerRegionOverride, signerServiceNameOverride));
if (!httpOutcome.IsSuccess())
{
- return XmlOutcome(std::move(httpOutcome));
+ return XmlOutcome(std::move(httpOutcome));
}
if (httpOutcome.GetResult()->GetResponseBody().tellp() > 0)
@@ -1061,12 +1061,12 @@ XmlOutcome AWSXMLClient::MakeRequest(const Aws::Http::URI& uri,
AWSError<CoreErrors> AWSXMLClient::BuildAWSError(const std::shared_ptr<Http::HttpResponse>& httpResponse) const
{
AWSError<CoreErrors> error;
- if (httpResponse->HasClientError())
+ if (httpResponse->HasClientError())
{
- bool retryable = httpResponse->GetClientErrorType() == CoreErrors::NETWORK_CONNECTION ? true : false;
- error = AWSError<CoreErrors>(httpResponse->GetClientErrorType(), "", httpResponse->GetClientErrorMessage(), retryable);
+ bool retryable = httpResponse->GetClientErrorType() == CoreErrors::NETWORK_CONNECTION ? true : false;
+ error = AWSError<CoreErrors>(httpResponse->GetClientErrorType(), "", httpResponse->GetClientErrorMessage(), retryable);
}
- else if (!httpResponse->GetResponseBody() || httpResponse->GetResponseBody().tellp() < 1)
+ else if (!httpResponse->GetResponseBody() || httpResponse->GetResponseBody().tellp() < 1)
{
auto responseCode = httpResponse->GetResponseCode();
auto errorCode = GuessBodylessErrorType(responseCode);
@@ -1092,7 +1092,7 @@ AWSError<CoreErrors> AWSXMLClient::BuildAWSError(const std::shared_ptr<Http::Htt
error.SetResponseHeaders(httpResponse->GetHeaders());
error.SetResponseCode(httpResponse->GetResponseCode());
- error.SetRemoteHostIpAddress(httpResponse->GetOriginatingRequest().GetResolvedRemoteHost());
+ error.SetRemoteHostIpAddress(httpResponse->GetOriginatingRequest().GetResolvedRemoteHost());
AWS_LOGSTREAM_ERROR(AWS_CLIENT_LOG_TAG, error);
return error;
}
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/client/AWSErrorMarshaller.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/client/AWSErrorMarshaller.cpp
index 565d491015f..f5fa676f986 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/client/AWSErrorMarshaller.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/client/AWSErrorMarshaller.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/client/AWSErrorMarshaller.h>
#include <aws/core/utils/logging/LogMacros.h>
@@ -18,54 +18,54 @@ using namespace Aws::Http;
using namespace Aws::Utils;
using namespace Aws::Client;
-static const char AWS_ERROR_MARSHALLER_LOG_TAG[] = "AWSErrorMarshaller";
-AWS_CORE_API extern const char MESSAGE_LOWER_CASE[] = "message";
-AWS_CORE_API extern const char MESSAGE_CAMEL_CASE[] = "Message";
-AWS_CORE_API extern const char ERROR_TYPE_HEADER[] = "x-amzn-ErrorType";
-AWS_CORE_API extern const char REQUEST_ID_HEADER[] = "x-amzn-RequestId";
-AWS_CORE_API extern const char TYPE[] = "__type";
+static const char AWS_ERROR_MARSHALLER_LOG_TAG[] = "AWSErrorMarshaller";
+AWS_CORE_API extern const char MESSAGE_LOWER_CASE[] = "message";
+AWS_CORE_API extern const char MESSAGE_CAMEL_CASE[] = "Message";
+AWS_CORE_API extern const char ERROR_TYPE_HEADER[] = "x-amzn-ErrorType";
+AWS_CORE_API extern const char REQUEST_ID_HEADER[] = "x-amzn-RequestId";
+AWS_CORE_API extern const char TYPE[] = "__type";
AWSError<CoreErrors> JsonErrorMarshaller::Marshall(const Aws::Http::HttpResponse& httpResponse) const
{
JsonValue exceptionPayload(httpResponse.GetResponseBody());
JsonView payloadView(exceptionPayload);
- AWSError<CoreErrors> error;
- if (exceptionPayload.WasParseSuccessful())
+ AWSError<CoreErrors> error;
+ if (exceptionPayload.WasParseSuccessful())
{
- AWS_LOGSTREAM_TRACE(AWS_ERROR_MARSHALLER_LOG_TAG, "Error response is " << payloadView.WriteReadable());
-
- Aws::String message(payloadView.ValueExists(MESSAGE_CAMEL_CASE) ? payloadView.GetString(MESSAGE_CAMEL_CASE) :
- payloadView.ValueExists(MESSAGE_LOWER_CASE) ? payloadView.GetString(MESSAGE_LOWER_CASE) : "");
-
- if (httpResponse.HasHeader(ERROR_TYPE_HEADER))
- {
- error = Marshall(httpResponse.GetHeader(ERROR_TYPE_HEADER), message);
- }
- else if (payloadView.ValueExists(TYPE))
- {
- error = Marshall(payloadView.GetString(TYPE), message);
- }
- else
- {
- error = FindErrorByHttpResponseCode(httpResponse.GetResponseCode());
- error.SetMessage(message);
- }
+ AWS_LOGSTREAM_TRACE(AWS_ERROR_MARSHALLER_LOG_TAG, "Error response is " << payloadView.WriteReadable());
+
+ Aws::String message(payloadView.ValueExists(MESSAGE_CAMEL_CASE) ? payloadView.GetString(MESSAGE_CAMEL_CASE) :
+ payloadView.ValueExists(MESSAGE_LOWER_CASE) ? payloadView.GetString(MESSAGE_LOWER_CASE) : "");
+
+ if (httpResponse.HasHeader(ERROR_TYPE_HEADER))
+ {
+ error = Marshall(httpResponse.GetHeader(ERROR_TYPE_HEADER), message);
+ }
+ else if (payloadView.ValueExists(TYPE))
+ {
+ error = Marshall(payloadView.GetString(TYPE), message);
+ }
+ else
+ {
+ error = FindErrorByHttpResponseCode(httpResponse.GetResponseCode());
+ error.SetMessage(message);
+ }
}
else
{
- error = AWSError<CoreErrors>(CoreErrors::UNKNOWN, "", "Failed to parse error payload", false);
+ error = AWSError<CoreErrors>(CoreErrors::UNKNOWN, "", "Failed to parse error payload", false);
}
-
- error.SetRequestId(httpResponse.HasHeader(REQUEST_ID_HEADER) ? httpResponse.GetHeader(REQUEST_ID_HEADER) : "");
- error.SetJsonPayload(std::move(exceptionPayload));
- return error;
+
+ error.SetRequestId(httpResponse.HasHeader(REQUEST_ID_HEADER) ? httpResponse.GetHeader(REQUEST_ID_HEADER) : "");
+ error.SetJsonPayload(std::move(exceptionPayload));
+ return error;
+}
+
+const JsonValue& JsonErrorMarshaller::GetJsonPayloadFromError(const AWSError<CoreErrors>& error) const
+{
+ return error.GetJsonPayload();
}
-const JsonValue& JsonErrorMarshaller::GetJsonPayloadFromError(const AWSError<CoreErrors>& error) const
-{
- return error.GetJsonPayload();
-}
-
AWSError<CoreErrors> XmlErrorMarshaller::Marshall(const Aws::Http::HttpResponse& httpResponse) const
{
XmlDocument doc = XmlDocument::CreateFromXmlStream(httpResponse.GetResponseBody());
@@ -75,10 +75,10 @@ AWSError<CoreErrors> XmlErrorMarshaller::Marshall(const Aws::Http::HttpResponse&
if (doc.WasParseSuccessful() && !doc.GetRootElement().IsNull())
{
XmlNode errorNode = doc.GetRootElement();
-
- Aws::String requestId(!errorNode.FirstChild("RequestId").IsNull() ? errorNode.FirstChild("RequestId").GetText() :
- !errorNode.FirstChild("RequestID").IsNull() ? errorNode.FirstChild("RequestID").GetText() : "");
-
+
+ Aws::String requestId(!errorNode.FirstChild("RequestId").IsNull() ? errorNode.FirstChild("RequestId").GetText() :
+ !errorNode.FirstChild("RequestID").IsNull() ? errorNode.FirstChild("RequestID").GetText() : "");
+
if (errorNode.GetName() != "Error")
{
errorNode = doc.GetRootElement().FirstChild("Error");
@@ -94,9 +94,9 @@ AWSError<CoreErrors> XmlErrorMarshaller::Marshall(const Aws::Http::HttpResponse&
if (!errorNode.IsNull())
{
- requestId = !requestId.empty() ? requestId : !errorNode.FirstChild("RequestId").IsNull() ? errorNode.FirstChild("RequestId").GetText() :
- !errorNode.FirstChild("RequestID").IsNull() ? errorNode.FirstChild("RequestID").GetText() : "";
-
+ requestId = !requestId.empty() ? requestId : !errorNode.FirstChild("RequestId").IsNull() ? errorNode.FirstChild("RequestId").GetText() :
+ !errorNode.FirstChild("RequestID").IsNull() ? errorNode.FirstChild("RequestID").GetText() : "";
+
XmlNode codeNode = errorNode.FirstChild("Code");
XmlNode messageNode = errorNode.FirstChild("Message");
@@ -107,8 +107,8 @@ AWSError<CoreErrors> XmlErrorMarshaller::Marshall(const Aws::Http::HttpResponse&
errorParsed = true;
}
}
-
- error.SetRequestId(requestId);
+
+ error.SetRequestId(requestId);
}
if(!errorParsed)
@@ -120,15 +120,15 @@ AWSError<CoreErrors> XmlErrorMarshaller::Marshall(const Aws::Http::HttpResponse&
error = FindErrorByHttpResponseCode(httpResponse.GetResponseCode());
}
- error.SetXmlPayload(std::move(doc));
+ error.SetXmlPayload(std::move(doc));
return error;
}
-const XmlDocument& XmlErrorMarshaller::GetXmlPayloadFromError(const AWSError<CoreErrors>& error) const
-{
- return error.GetXmlPayload();
-}
-
+const XmlDocument& XmlErrorMarshaller::GetXmlPayloadFromError(const AWSError<CoreErrors>& error) const
+{
+ return error.GetXmlPayload();
+}
+
AWSError<CoreErrors> AWSErrorMarshaller::Marshall(const Aws::String& exceptionName, const Aws::String& message) const
{
if(exceptionName.empty())
@@ -142,11 +142,11 @@ AWSError<CoreErrors> AWSErrorMarshaller::Marshall(const Aws::String& exceptionNa
if (locationOfPound != Aws::String::npos)
{
- formalExceptionName = exceptionName.substr(locationOfPound + 1);
+ formalExceptionName = exceptionName.substr(locationOfPound + 1);
}
else if (locationOfColon != Aws::String::npos)
{
- formalExceptionName = exceptionName.substr(0, locationOfColon);
+ formalExceptionName = exceptionName.substr(0, locationOfColon);
}
else
{
@@ -161,7 +161,7 @@ AWSError<CoreErrors> AWSErrorMarshaller::Marshall(const Aws::String& exceptionNa
error.SetExceptionName(formalExceptionName);
error.SetMessage(message);
return error;
- }
+ }
AWS_LOGSTREAM_WARN(AWS_ERROR_MARSHALLER_LOG_TAG, "Encountered Unknown AWSError '" << exceptionName.c_str() <<
"': " << message.c_str());
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/client/AsyncCallerContext.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/client/AsyncCallerContext.cpp
index 80e19495df0..4f9abdc9e41 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/client/AsyncCallerContext.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/client/AsyncCallerContext.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/client/AsyncCallerContext.h>
#include <aws/core/utils/UUID.h>
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/client/ClientConfiguration.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/client/ClientConfiguration.cpp
index 6e2fd8e56d1..e517379a779 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/client/ClientConfiguration.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/client/ClientConfiguration.cpp
@@ -1,31 +1,31 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/client/ClientConfiguration.h>
-#include <aws/core/auth/AWSCredentialsProvider.h>
+#include <aws/core/auth/AWSCredentialsProvider.h>
#include <aws/core/client/DefaultRetryStrategy.h>
-#include <aws/core/platform/Environment.h>
+#include <aws/core/platform/Environment.h>
#include <aws/core/platform/OSVersionInfo.h>
#include <aws/core/utils/memory/AWSMemory.h>
-#include <aws/core/utils/StringUtils.h>
+#include <aws/core/utils/StringUtils.h>
#include <aws/core/utils/threading/Executor.h>
#include <aws/core/utils/memory/stl/AWSStringStream.h>
#include <aws/core/Version.h>
-#include <aws/core/config/AWSProfileConfigLoader.h>
-#include <aws/core/utils/logging/LogMacros.h>
+#include <aws/core/config/AWSProfileConfigLoader.h>
+#include <aws/core/utils/logging/LogMacros.h>
namespace Aws
{
-namespace Auth
-{
- AWS_CORE_API Aws::String GetConfigProfileFilename();
-}
+namespace Auth
+{
+ AWS_CORE_API Aws::String GetConfigProfileFilename();
+}
namespace Client
{
-static const char* CLIENT_CONFIG_TAG = "ClientConfiguration";
+static const char* CLIENT_CONFIG_TAG = "ClientConfiguration";
AWS_CORE_API Aws::String ComputeUserAgentString()
{
@@ -35,126 +35,126 @@ AWS_CORE_API Aws::String ComputeUserAgentString()
return ss.str();
}
-ClientConfiguration::ClientConfiguration() :
- scheme(Aws::Http::Scheme::HTTPS),
+ClientConfiguration::ClientConfiguration() :
+ scheme(Aws::Http::Scheme::HTTPS),
useDualStack(false),
- maxConnections(25),
- httpRequestTimeoutMs(0),
- requestTimeoutMs(3000),
+ maxConnections(25),
+ httpRequestTimeoutMs(0),
+ requestTimeoutMs(3000),
connectTimeoutMs(1000),
- enableTcpKeepAlive(true),
- tcpKeepAliveIntervalMs(30000),
- lowSpeedLimit(1),
+ enableTcpKeepAlive(true),
+ tcpKeepAliveIntervalMs(30000),
+ lowSpeedLimit(1),
proxyScheme(Aws::Http::Scheme::HTTP),
proxyPort(0),
- executor(Aws::MakeShared<Aws::Utils::Threading::DefaultExecutor>(CLIENT_CONFIG_TAG)),
+ executor(Aws::MakeShared<Aws::Utils::Threading::DefaultExecutor>(CLIENT_CONFIG_TAG)),
verifySSL(true),
writeRateLimiter(nullptr),
readRateLimiter(nullptr),
httpLibOverride(Aws::Http::TransferLibType::DEFAULT_CLIENT),
- followRedirects(FollowRedirectsPolicy::DEFAULT),
+ followRedirects(FollowRedirectsPolicy::DEFAULT),
disableExpectHeader(false),
enableClockSkewAdjustment(true),
enableHostPrefixInjection(true),
- enableEndpointDiscovery(false),
- profileName(Aws::Auth::GetConfigProfileName())
+ enableEndpointDiscovery(false),
+ profileName(Aws::Auth::GetConfigProfileName())
+{
+ AWS_LOGSTREAM_DEBUG(CLIENT_CONFIG_TAG, "ClientConfiguration will use SDK Auto Resolved profile: [" << profileName << "] if not specified by users.");
+
+ // Initialize Retry Strategy
+ int maxAttempts;
+ Aws::String maxAttemptsString = Aws::Environment::GetEnv("AWS_MAX_ATTEMPTS");
+ if (maxAttemptsString.empty())
+ {
+ maxAttemptsString = Aws::Config::GetCachedConfigValue("max_attempts");
+ }
+ // In case users specify 0 explicitly to disable retry.
+ if (maxAttemptsString == "0")
+ {
+ maxAttempts = 0;
+ }
+ else
+ {
+ maxAttempts = static_cast<int>(Aws::Utils::StringUtils::ConvertToInt32(maxAttemptsString.c_str()));
+ if (maxAttempts == 0)
+ {
+ AWS_LOGSTREAM_WARN(CLIENT_CONFIG_TAG, "Retry Strategy will use the default max attempts.");
+ maxAttempts = -1;
+ }
+ }
+
+ Aws::String retryMode = Aws::Environment::GetEnv("AWS_RETRY_MODE");
+ if (retryMode.empty())
+ {
+ retryMode = Aws::Config::GetCachedConfigValue("retry_mode");
+ }
+ if (retryMode == "standard")
+ {
+ if (maxAttempts < 0)
+ {
+ retryStrategy = Aws::MakeShared<StandardRetryStrategy>(CLIENT_CONFIG_TAG);
+ }
+ else
+ {
+ retryStrategy = Aws::MakeShared<StandardRetryStrategy>(CLIENT_CONFIG_TAG, maxAttempts);
+ }
+ }
+ else
+ {
+ retryStrategy = Aws::MakeShared<DefaultRetryStrategy>(CLIENT_CONFIG_TAG);
+ }
+
+ // Automatically determine the AWS region from environment variables, configuration file and EC2 metadata.
+ region = Aws::Environment::GetEnv("AWS_DEFAULT_REGION");
+ if (!region.empty())
+ {
+ return;
+ }
+
+ region = Aws::Environment::GetEnv("AWS_REGION");
+ if (!region.empty())
+ {
+ return;
+ }
+
+ region = Aws::Config::GetCachedConfigValue("region");
+ if (!region.empty())
+ {
+ return;
+ }
+
+ if (Aws::Utils::StringUtils::ToLower(Aws::Environment::GetEnv("AWS_EC2_METADATA_DISABLED").c_str()) != "true")
+ {
+ auto client = Aws::Internal::GetEC2MetadataClient();
+ if (client)
+ {
+ region = client->GetCurrentRegion();
+ }
+ }
+
+ if (!region.empty())
+ {
+ return;
+ }
+
+ region = Aws::String(Aws::Region::US_EAST_1);
+}
+
+ClientConfiguration::ClientConfiguration(const char* profile) : ClientConfiguration()
{
- AWS_LOGSTREAM_DEBUG(CLIENT_CONFIG_TAG, "ClientConfiguration will use SDK Auto Resolved profile: [" << profileName << "] if not specified by users.");
-
- // Initialize Retry Strategy
- int maxAttempts;
- Aws::String maxAttemptsString = Aws::Environment::GetEnv("AWS_MAX_ATTEMPTS");
- if (maxAttemptsString.empty())
- {
- maxAttemptsString = Aws::Config::GetCachedConfigValue("max_attempts");
- }
- // In case users specify 0 explicitly to disable retry.
- if (maxAttemptsString == "0")
- {
- maxAttempts = 0;
- }
- else
- {
- maxAttempts = static_cast<int>(Aws::Utils::StringUtils::ConvertToInt32(maxAttemptsString.c_str()));
- if (maxAttempts == 0)
- {
- AWS_LOGSTREAM_WARN(CLIENT_CONFIG_TAG, "Retry Strategy will use the default max attempts.");
- maxAttempts = -1;
- }
- }
-
- Aws::String retryMode = Aws::Environment::GetEnv("AWS_RETRY_MODE");
- if (retryMode.empty())
- {
- retryMode = Aws::Config::GetCachedConfigValue("retry_mode");
- }
- if (retryMode == "standard")
- {
- if (maxAttempts < 0)
- {
- retryStrategy = Aws::MakeShared<StandardRetryStrategy>(CLIENT_CONFIG_TAG);
- }
- else
- {
- retryStrategy = Aws::MakeShared<StandardRetryStrategy>(CLIENT_CONFIG_TAG, maxAttempts);
- }
- }
- else
- {
- retryStrategy = Aws::MakeShared<DefaultRetryStrategy>(CLIENT_CONFIG_TAG);
- }
-
- // Automatically determine the AWS region from environment variables, configuration file and EC2 metadata.
- region = Aws::Environment::GetEnv("AWS_DEFAULT_REGION");
- if (!region.empty())
- {
- return;
- }
-
- region = Aws::Environment::GetEnv("AWS_REGION");
- if (!region.empty())
- {
- return;
- }
-
- region = Aws::Config::GetCachedConfigValue("region");
- if (!region.empty())
- {
- return;
- }
-
- if (Aws::Utils::StringUtils::ToLower(Aws::Environment::GetEnv("AWS_EC2_METADATA_DISABLED").c_str()) != "true")
- {
- auto client = Aws::Internal::GetEC2MetadataClient();
- if (client)
- {
- region = client->GetCurrentRegion();
- }
- }
-
- if (!region.empty())
- {
- return;
- }
-
- region = Aws::String(Aws::Region::US_EAST_1);
+ if (profile && Aws::Config::HasCachedConfigProfile(profile))
+ {
+ this->profileName = Aws::String(profile);
+ AWS_LOGSTREAM_DEBUG(CLIENT_CONFIG_TAG, "Use user specified profile: [" << this->profileName << "] for ClientConfiguration.");
+ auto tmpRegion = Aws::Config::GetCachedConfigProfile(this->profileName).GetRegion();
+ if (!tmpRegion.empty())
+ {
+ region = tmpRegion;
+ }
+ return;
+ }
+ AWS_LOGSTREAM_WARN(CLIENT_CONFIG_TAG, "User specified profile: [" << profile << "] is not found, will use the SDK resolved one.");
}
-ClientConfiguration::ClientConfiguration(const char* profile) : ClientConfiguration()
-{
- if (profile && Aws::Config::HasCachedConfigProfile(profile))
- {
- this->profileName = Aws::String(profile);
- AWS_LOGSTREAM_DEBUG(CLIENT_CONFIG_TAG, "Use user specified profile: [" << this->profileName << "] for ClientConfiguration.");
- auto tmpRegion = Aws::Config::GetCachedConfigProfile(this->profileName).GetRegion();
- if (!tmpRegion.empty())
- {
- region = tmpRegion;
- }
- return;
- }
- AWS_LOGSTREAM_WARN(CLIENT_CONFIG_TAG, "User specified profile: [" << profile << "] is not found, will use the SDK resolved one.");
-}
-
} // namespace Client
} // namespace Aws
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/client/CoreErrors.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/client/CoreErrors.cpp
index 03d736bd36c..8c2c288dcd4 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/client/CoreErrors.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/client/CoreErrors.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/client/AWSError.h>
#include <aws/core/client/CoreErrors.h>
@@ -31,7 +31,7 @@ void CoreErrorsMapper::InitCoreErrorsMapper()
return;
}
s_CoreErrorsMapper = Aws::MakeUnique<Aws::Map<Aws::String, AWSError<CoreErrors> > >("InitCoreErrorsMapper");
-
+
s_CoreErrorsMapper->emplace("IncompleteSignature", AWSError<CoreErrors>(CoreErrors::INCOMPLETE_SIGNATURE, false));
s_CoreErrorsMapper->emplace("IncompleteSignatureException", AWSError<CoreErrors>(CoreErrors::INCOMPLETE_SIGNATURE, false));
s_CoreErrorsMapper->emplace("InvalidSignatureException", AWSError<CoreErrors>(CoreErrors::INVALID_SIGNATURE, false));
@@ -112,40 +112,40 @@ AWS_CORE_API AWSError<CoreErrors> CoreErrorsMapper::GetErrorForHttpResponseCode(
{
// best effort attempt to map HTTP response codes to CoreErrors
bool retryable = IsRetryableHttpResponseCode(code);
- AWSError<CoreErrors> error;
- switch (code)
+ AWSError<CoreErrors> error;
+ switch (code)
{
case HttpResponseCode::UNAUTHORIZED:
case HttpResponseCode::FORBIDDEN:
- error = AWSError<CoreErrors>(CoreErrors::ACCESS_DENIED, retryable);
- break;
+ error = AWSError<CoreErrors>(CoreErrors::ACCESS_DENIED, retryable);
+ break;
case HttpResponseCode::NOT_FOUND:
- error = AWSError<CoreErrors>(CoreErrors::RESOURCE_NOT_FOUND, retryable);
- break;
+ error = AWSError<CoreErrors>(CoreErrors::RESOURCE_NOT_FOUND, retryable);
+ break;
case HttpResponseCode::TOO_MANY_REQUESTS:
- error = AWSError<CoreErrors>(CoreErrors::SLOW_DOWN, retryable);
- break;
+ error = AWSError<CoreErrors>(CoreErrors::SLOW_DOWN, retryable);
+ break;
case HttpResponseCode::INTERNAL_SERVER_ERROR:
- error = AWSError<CoreErrors>(CoreErrors::INTERNAL_FAILURE, retryable);
- break;
+ error = AWSError<CoreErrors>(CoreErrors::INTERNAL_FAILURE, retryable);
+ break;
case HttpResponseCode::BANDWIDTH_LIMIT_EXCEEDED:
- error = AWSError<CoreErrors>(CoreErrors::THROTTLING, retryable);
- break;
+ error = AWSError<CoreErrors>(CoreErrors::THROTTLING, retryable);
+ break;
case HttpResponseCode::SERVICE_UNAVAILABLE:
- error = AWSError<CoreErrors>(CoreErrors::SERVICE_UNAVAILABLE, retryable);
- break;
+ error = AWSError<CoreErrors>(CoreErrors::SERVICE_UNAVAILABLE, retryable);
+ break;
case HttpResponseCode::REQUEST_TIMEOUT:
case HttpResponseCode::AUTHENTICATION_TIMEOUT:
case HttpResponseCode::LOGIN_TIMEOUT:
case HttpResponseCode::GATEWAY_TIMEOUT:
case HttpResponseCode::NETWORK_READ_TIMEOUT:
case HttpResponseCode::NETWORK_CONNECT_TIMEOUT:
- error = AWSError<CoreErrors>(CoreErrors::REQUEST_TIMEOUT, retryable);
- break;
+ error = AWSError<CoreErrors>(CoreErrors::REQUEST_TIMEOUT, retryable);
+ break;
default:
int codeValue = static_cast<int>(code);
- error = AWSError<CoreErrors>(CoreErrors::UNKNOWN, codeValue >= 500 && codeValue < 600);
+ error = AWSError<CoreErrors>(CoreErrors::UNKNOWN, codeValue >= 500 && codeValue < 600);
}
- error.SetResponseCode(code);
- return error;
+ error.SetResponseCode(code);
+ return error;
}
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/client/DefaultRetryStrategy.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/client/DefaultRetryStrategy.cpp
index 7bda42541d9..7e57c79ffc4 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/client/DefaultRetryStrategy.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/client/DefaultRetryStrategy.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/client/DefaultRetryStrategy.h>
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/client/RetryStrategy.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/client/RetryStrategy.cpp
index f66070220df..b439b7ca995 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/client/RetryStrategy.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/client/RetryStrategy.cpp
@@ -1,102 +1,102 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
-
-#include <aws/core/client/RetryStrategy.h>
-
-#include <aws/core/client/AWSError.h>
-#include <aws/core/client/CoreErrors.h>
-#include <aws/core/utils/Outcome.h>
-
-using namespace Aws::Utils::Threading;
-
-namespace Aws
-{
- namespace Client
- {
- static const int INITIAL_RETRY_TOKENS = 500;
- static const int RETRY_COST = 5;
- static const int NO_RETRY_INCREMENT = 1;
- static const int TIMEOUT_RETRY_COST = 10;
-
- StandardRetryStrategy::StandardRetryStrategy(long maxAttempts) :
- m_retryQuotaContainer(Aws::MakeShared<DefaultRetryQuotaContainer>("StandardRetryStrategy")),
- m_maxAttempts(maxAttempts)
- {}
-
- StandardRetryStrategy::StandardRetryStrategy(std::shared_ptr<RetryQuotaContainer> retryQuotaContainer, long maxAttempts) :
- m_retryQuotaContainer(retryQuotaContainer),
- m_maxAttempts(maxAttempts)
- {}
-
- void StandardRetryStrategy::RequestBookkeeping(const HttpResponseOutcome& httpResponseOutcome)
- {
- if (httpResponseOutcome.IsSuccess())
- {
- m_retryQuotaContainer->ReleaseRetryQuota(NO_RETRY_INCREMENT);
- }
- }
-
- void StandardRetryStrategy::RequestBookkeeping(const HttpResponseOutcome& httpResponseOutcome, const AWSError<CoreErrors>& lastError)
- {
- if (httpResponseOutcome.IsSuccess())
- {
- m_retryQuotaContainer->ReleaseRetryQuota(lastError);
- }
- }
-
- bool StandardRetryStrategy::ShouldRetry(const AWSError<CoreErrors>& error, long attemptedRetries) const
- {
- if (!error.ShouldRetry())
- return false;
-
- if (attemptedRetries + 1 >= m_maxAttempts)
- return false;
-
- return m_retryQuotaContainer->AcquireRetryQuota(error);
- }
-
- long StandardRetryStrategy::CalculateDelayBeforeNextRetry(const AWSError<CoreErrors>& error, long attemptedRetries) const
- {
- AWS_UNREFERENCED_PARAM(error);
- return (std::min)(rand() % 1000 * (1 << attemptedRetries), 20000);
- }
-
- DefaultRetryQuotaContainer::DefaultRetryQuotaContainer() : m_retryQuota(INITIAL_RETRY_TOKENS)
- {}
-
- bool DefaultRetryQuotaContainer::AcquireRetryQuota(int capacityAmount)
- {
- WriterLockGuard guard(m_retryQuotaLock);
-
- if (capacityAmount > m_retryQuota)
- {
- return false;
- }
- else
- {
- m_retryQuota -= capacityAmount;
- return true;
- }
- }
-
- bool DefaultRetryQuotaContainer::AcquireRetryQuota(const AWSError<CoreErrors>& error)
- {
- int capacityAmount = error.GetErrorType() == CoreErrors::REQUEST_TIMEOUT ? TIMEOUT_RETRY_COST : RETRY_COST;
- return AcquireRetryQuota(capacityAmount);
- }
-
- void DefaultRetryQuotaContainer::ReleaseRetryQuota(int capacityAmount)
- {
- WriterLockGuard guard(m_retryQuotaLock);
- m_retryQuota = (std::min)(m_retryQuota + capacityAmount, INITIAL_RETRY_TOKENS);
- }
-
- void DefaultRetryQuotaContainer::ReleaseRetryQuota(const AWSError<CoreErrors>& error)
- {
- int capacityAmount = error.GetErrorType() == CoreErrors::REQUEST_TIMEOUT ? TIMEOUT_RETRY_COST : RETRY_COST;
- ReleaseRetryQuota(capacityAmount);
- }
- }
-} \ No newline at end of file
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
+
+#include <aws/core/client/RetryStrategy.h>
+
+#include <aws/core/client/AWSError.h>
+#include <aws/core/client/CoreErrors.h>
+#include <aws/core/utils/Outcome.h>
+
+using namespace Aws::Utils::Threading;
+
+namespace Aws
+{
+ namespace Client
+ {
+ static const int INITIAL_RETRY_TOKENS = 500;
+ static const int RETRY_COST = 5;
+ static const int NO_RETRY_INCREMENT = 1;
+ static const int TIMEOUT_RETRY_COST = 10;
+
+ StandardRetryStrategy::StandardRetryStrategy(long maxAttempts) :
+ m_retryQuotaContainer(Aws::MakeShared<DefaultRetryQuotaContainer>("StandardRetryStrategy")),
+ m_maxAttempts(maxAttempts)
+ {}
+
+ StandardRetryStrategy::StandardRetryStrategy(std::shared_ptr<RetryQuotaContainer> retryQuotaContainer, long maxAttempts) :
+ m_retryQuotaContainer(retryQuotaContainer),
+ m_maxAttempts(maxAttempts)
+ {}
+
+ void StandardRetryStrategy::RequestBookkeeping(const HttpResponseOutcome& httpResponseOutcome)
+ {
+ if (httpResponseOutcome.IsSuccess())
+ {
+ m_retryQuotaContainer->ReleaseRetryQuota(NO_RETRY_INCREMENT);
+ }
+ }
+
+ void StandardRetryStrategy::RequestBookkeeping(const HttpResponseOutcome& httpResponseOutcome, const AWSError<CoreErrors>& lastError)
+ {
+ if (httpResponseOutcome.IsSuccess())
+ {
+ m_retryQuotaContainer->ReleaseRetryQuota(lastError);
+ }
+ }
+
+ bool StandardRetryStrategy::ShouldRetry(const AWSError<CoreErrors>& error, long attemptedRetries) const
+ {
+ if (!error.ShouldRetry())
+ return false;
+
+ if (attemptedRetries + 1 >= m_maxAttempts)
+ return false;
+
+ return m_retryQuotaContainer->AcquireRetryQuota(error);
+ }
+
+ long StandardRetryStrategy::CalculateDelayBeforeNextRetry(const AWSError<CoreErrors>& error, long attemptedRetries) const
+ {
+ AWS_UNREFERENCED_PARAM(error);
+ return (std::min)(rand() % 1000 * (1 << attemptedRetries), 20000);
+ }
+
+ DefaultRetryQuotaContainer::DefaultRetryQuotaContainer() : m_retryQuota(INITIAL_RETRY_TOKENS)
+ {}
+
+ bool DefaultRetryQuotaContainer::AcquireRetryQuota(int capacityAmount)
+ {
+ WriterLockGuard guard(m_retryQuotaLock);
+
+ if (capacityAmount > m_retryQuota)
+ {
+ return false;
+ }
+ else
+ {
+ m_retryQuota -= capacityAmount;
+ return true;
+ }
+ }
+
+ bool DefaultRetryQuotaContainer::AcquireRetryQuota(const AWSError<CoreErrors>& error)
+ {
+ int capacityAmount = error.GetErrorType() == CoreErrors::REQUEST_TIMEOUT ? TIMEOUT_RETRY_COST : RETRY_COST;
+ return AcquireRetryQuota(capacityAmount);
+ }
+
+ void DefaultRetryQuotaContainer::ReleaseRetryQuota(int capacityAmount)
+ {
+ WriterLockGuard guard(m_retryQuotaLock);
+ m_retryQuota = (std::min)(m_retryQuota + capacityAmount, INITIAL_RETRY_TOKENS);
+ }
+
+ void DefaultRetryQuotaContainer::ReleaseRetryQuota(const AWSError<CoreErrors>& error)
+ {
+ int capacityAmount = error.GetErrorType() == CoreErrors::REQUEST_TIMEOUT ? TIMEOUT_RETRY_COST : RETRY_COST;
+ ReleaseRetryQuota(capacityAmount);
+ }
+ }
+} \ No newline at end of file
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/client/SpecifiedRetryableErrorsRetryStrategy.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/client/SpecifiedRetryableErrorsRetryStrategy.cpp
index 007743c322b..ec4e3733048 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/client/SpecifiedRetryableErrorsRetryStrategy.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/client/SpecifiedRetryableErrorsRetryStrategy.cpp
@@ -1,28 +1,28 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
-
-#include <aws/core/client/SpecifiedRetryableErrorsRetryStrategy.h>
-
-#include <aws/core/client/AWSError.h>
-
-using namespace Aws;
-using namespace Aws::Client;
-
-bool SpecifiedRetryableErrorsRetryStrategy::ShouldRetry(const AWSError<CoreErrors>& error, long attemptedRetries) const
-{
- if (attemptedRetries >= m_maxRetries)
- {
- return false;
- }
- for (const auto& err: m_specifiedRetryableErrors)
- {
- if (error.GetExceptionName() == err)
- {
- return true;
- }
- }
-
- return error.ShouldRetry();
-}
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
+
+#include <aws/core/client/SpecifiedRetryableErrorsRetryStrategy.h>
+
+#include <aws/core/client/AWSError.h>
+
+using namespace Aws;
+using namespace Aws::Client;
+
+bool SpecifiedRetryableErrorsRetryStrategy::ShouldRetry(const AWSError<CoreErrors>& error, long attemptedRetries) const
+{
+ if (attemptedRetries >= m_maxRetries)
+ {
+ return false;
+ }
+ for (const auto& err: m_specifiedRetryableErrors)
+ {
+ if (error.GetExceptionName() == err)
+ {
+ return true;
+ }
+ }
+
+ return error.ShouldRetry();
+}
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/config/AWSProfileConfigLoader.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/config/AWSProfileConfigLoader.cpp
index 5c99d1c83b5..9ec2e54f551 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/config/AWSProfileConfigLoader.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/config/AWSProfileConfigLoader.cpp
@@ -1,11 +1,11 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/config/AWSProfileConfigLoader.h>
#include <aws/core/internal/AWSHttpResourceClient.h>
-#include <aws/core/auth/AWSCredentialsProvider.h>
+#include <aws/core/auth/AWSCredentialsProvider.h>
#include <aws/core/utils/memory/stl/AWSList.h>
#include <aws/core/utils/memory/stl/AWSStreamFwd.h>
#include <aws/core/utils/StringUtils.h>
@@ -21,24 +21,24 @@ namespace Aws
using namespace Aws::Auth;
static const char* const CONFIG_LOADER_TAG = "Aws::Config::AWSProfileConfigLoader";
- #ifdef _MSC_VER
- // VS2015 compiler's bug, warning s_CoreErrorsMapper: symbol will be dynamically initialized (implementation limitation)
- AWS_SUPPRESS_WARNING(4592,
- static Aws::UniquePtr<ConfigAndCredentialsCacheManager> s_configManager(nullptr);
- )
- #else
- static Aws::UniquePtr<ConfigAndCredentialsCacheManager> s_configManager(nullptr);
- #endif
-
- static const char CONFIG_CREDENTIALS_CACHE_MANAGER_TAG[] = "ConfigAndCredentialsCacheManager";
-
+ #ifdef _MSC_VER
+ // VS2015 compiler's bug, warning s_CoreErrorsMapper: symbol will be dynamically initialized (implementation limitation)
+ AWS_SUPPRESS_WARNING(4592,
+ static Aws::UniquePtr<ConfigAndCredentialsCacheManager> s_configManager(nullptr);
+ )
+ #else
+ static Aws::UniquePtr<ConfigAndCredentialsCacheManager> s_configManager(nullptr);
+ #endif
+
+ static const char CONFIG_CREDENTIALS_CACHE_MANAGER_TAG[] = "ConfigAndCredentialsCacheManager";
+
bool AWSProfileConfigLoader::Load()
{
if(LoadInternal())
{
AWS_LOGSTREAM_INFO(CONFIG_LOADER_TAG, "Successfully reloaded configuration.");
m_lastLoadTime = DateTime::Now();
- AWS_LOGSTREAM_TRACE(CONFIG_LOADER_TAG, "reloaded config at "
+ AWS_LOGSTREAM_TRACE(CONFIG_LOADER_TAG, "reloaded config at "
<< m_lastLoadTime.ToGmtString(DateFormat::ISO_8601));
return true;
}
@@ -54,7 +54,7 @@ namespace Aws
AWS_LOGSTREAM_INFO(CONFIG_LOADER_TAG, "Successfully persisted configuration.");
m_profiles = profiles;
m_lastLoadTime = DateTime::Now();
- AWS_LOGSTREAM_TRACE(CONFIG_LOADER_TAG, "persisted config at "
+ AWS_LOGSTREAM_TRACE(CONFIG_LOADER_TAG, "persisted config at "
<< m_lastLoadTime.ToGmtString(DateFormat::ISO_8601));
return true;
}
@@ -63,19 +63,19 @@ namespace Aws
return false;
}
- static const char REGION_KEY[] = "region";
- static const char ACCESS_KEY_ID_KEY[] = "aws_access_key_id";
- static const char SECRET_KEY_KEY[] = "aws_secret_access_key";
- static const char SESSION_TOKEN_KEY[] = "aws_session_token";
- static const char ROLE_ARN_KEY[] = "role_arn";
- static const char EXTERNAL_ID_KEY[] = "external_id";
- static const char CREDENTIAL_PROCESS_COMMAND[] = "credential_process";
- static const char SOURCE_PROFILE_KEY[] = "source_profile";
- static const char PROFILE_PREFIX[] = "profile ";
- static const char EQ = '=';
- static const char LEFT_BRACKET = '[';
- static const char RIGHT_BRACKET = ']';
- static const char PARSER_TAG[] = "Aws::Config::ConfigFileProfileFSM";
+ static const char REGION_KEY[] = "region";
+ static const char ACCESS_KEY_ID_KEY[] = "aws_access_key_id";
+ static const char SECRET_KEY_KEY[] = "aws_secret_access_key";
+ static const char SESSION_TOKEN_KEY[] = "aws_session_token";
+ static const char ROLE_ARN_KEY[] = "role_arn";
+ static const char EXTERNAL_ID_KEY[] = "external_id";
+ static const char CREDENTIAL_PROCESS_COMMAND[] = "credential_process";
+ static const char SOURCE_PROFILE_KEY[] = "source_profile";
+ static const char PROFILE_PREFIX[] = "profile ";
+ static const char EQ = '=';
+ static const char LEFT_BRACKET = '[';
+ static const char RIGHT_BRACKET = ']';
+ static const char PARSER_TAG[] = "Aws::Config::ConfigFileProfileFSM";
class ConfigFileProfileFSM
{
@@ -179,7 +179,7 @@ namespace Aws
if (sessionTokenIter != m_profileKeyValuePairs.end())
{
sessionToken = sessionTokenIter->second;
- }
+ }
profile.SetCredentials(Aws::Auth::AWSCredentials(accessKey, secretKey, sessionToken));
}
@@ -245,7 +245,7 @@ namespace Aws
AWSConfigFileProfileConfigLoader::AWSConfigFileProfileConfigLoader(const Aws::String& fileName, bool useProfilePrefix) :
m_fileName(fileName), m_useProfilePrefix(useProfilePrefix)
{
- AWS_LOGSTREAM_INFO(CONFIG_FILE_LOADER, "Initializing config loader against fileName "
+ AWS_LOGSTREAM_INFO(CONFIG_FILE_LOADER, "Initializing config loader against fileName "
<< fileName << " and using profilePrefix = " << useProfilePrefix);
}
@@ -325,14 +325,14 @@ namespace Aws
bool EC2InstanceProfileConfigLoader::LoadInternal()
{
- auto credentialsStr = m_ec2metadataClient->GetDefaultCredentialsSecurely();
+ auto credentialsStr = m_ec2metadataClient->GetDefaultCredentialsSecurely();
if(credentialsStr.empty()) return false;
Json::JsonValue credentialsDoc(credentialsStr);
- if (!credentialsDoc.WasParseSuccessful())
+ if (!credentialsDoc.WasParseSuccessful())
{
- AWS_LOGSTREAM_ERROR(EC2_INSTANCE_PROFILE_LOG_TAG,
- "Failed to parse output from EC2MetadataService.");
+ AWS_LOGSTREAM_ERROR(EC2_INSTANCE_PROFILE_LOG_TAG,
+ "Failed to parse output from EC2MetadataService.");
return false;
}
const char* accessKeyId = "AccessKeyId";
@@ -341,7 +341,7 @@ namespace Aws
auto credentialsView = credentialsDoc.View();
accessKey = credentialsView.GetString(accessKeyId);
- AWS_LOGSTREAM_INFO(EC2_INSTANCE_PROFILE_LOG_TAG,
+ AWS_LOGSTREAM_INFO(EC2_INSTANCE_PROFILE_LOG_TAG,
"Successfully pulled credentials from metadata service with access key " << accessKey);
secretKey = credentialsView.GetString(secretAccessKey);
@@ -359,182 +359,182 @@ namespace Aws
return true;
}
- ConfigAndCredentialsCacheManager::ConfigAndCredentialsCacheManager() :
- m_credentialsFileLoader(Aws::Auth::ProfileConfigFileAWSCredentialsProvider::GetCredentialsProfileFilename()),
- m_configFileLoader(Aws::Auth::GetConfigProfileFilename(), true/*use profile prefix*/)
- {
- ReloadCredentialsFile();
- ReloadConfigFile();
- }
-
- void ConfigAndCredentialsCacheManager::ReloadConfigFile()
- {
- Aws::Utils::Threading::WriterLockGuard guard(m_configLock);
- m_configFileLoader.SetFileName(Aws::Auth::GetConfigProfileFilename());
- m_configFileLoader.Load();
- }
-
- void ConfigAndCredentialsCacheManager::ReloadCredentialsFile()
- {
- Aws::Utils::Threading::WriterLockGuard guard(m_credentialsLock);
- m_credentialsFileLoader.SetFileName(Aws::Auth::ProfileConfigFileAWSCredentialsProvider::GetCredentialsProfileFilename());
- m_credentialsFileLoader.Load();
- }
-
- bool ConfigAndCredentialsCacheManager::HasConfigProfile(const Aws::String& profileName) const
- {
- Aws::Utils::Threading::ReaderLockGuard guard(m_configLock);
- return (m_configFileLoader.GetProfiles().count(profileName) == 1);
- }
-
- Aws::Config::Profile ConfigAndCredentialsCacheManager::GetConfigProfile(const Aws::String& profileName) const
- {
- Aws::Utils::Threading::ReaderLockGuard guard(m_configLock);
- const auto& profiles = m_configFileLoader.GetProfiles();
- const auto &iter = profiles.find(profileName);
- if (iter == profiles.end())
- {
- return {};
- }
- return iter->second;
- }
-
- Aws::Map<Aws::String, Aws::Config::Profile> ConfigAndCredentialsCacheManager::GetConfigProfiles() const
- {
- Aws::Utils::Threading::ReaderLockGuard guard(m_configLock);
- return m_configFileLoader.GetProfiles();
- }
-
- Aws::String ConfigAndCredentialsCacheManager::GetConfig(const Aws::String& profileName, const Aws::String& key) const
- {
- Aws::Utils::Threading::ReaderLockGuard guard(m_configLock);
- const auto& profiles = m_configFileLoader.GetProfiles();
- const auto &iter = profiles.find(profileName);
- if (iter == profiles.end())
- {
- return {};
- }
- return iter->second.GetValue(key);
- }
-
- bool ConfigAndCredentialsCacheManager::HasCredentialsProfile(const Aws::String& profileName) const
- {
- Aws::Utils::Threading::ReaderLockGuard guard(m_credentialsLock);
- return (m_credentialsFileLoader.GetProfiles().count(profileName) == 1);
- }
-
- Aws::Config::Profile ConfigAndCredentialsCacheManager::GetCredentialsProfile(const Aws::String& profileName) const
- {
- Aws::Utils::Threading::ReaderLockGuard guard(m_credentialsLock);
- const auto &profiles = m_credentialsFileLoader.GetProfiles();
- const auto &iter = profiles.find(profileName);
- if (iter == profiles.end())
- {
- return {};
- }
- return iter->second;
- }
-
- Aws::Map<Aws::String, Aws::Config::Profile> ConfigAndCredentialsCacheManager::GetCredentialsProfiles() const
- {
- Aws::Utils::Threading::ReaderLockGuard guard(m_credentialsLock);
- return m_credentialsFileLoader.GetProfiles();
- }
-
- Aws::Auth::AWSCredentials ConfigAndCredentialsCacheManager::GetCredentials(const Aws::String& profileName) const
- {
- Aws::Utils::Threading::ReaderLockGuard guard(m_credentialsLock);
- const auto& profiles = m_credentialsFileLoader.GetProfiles();
- const auto &iter = profiles.find(profileName);
- if (iter == profiles.end())
- {
- return {};
- }
- return iter->second.GetCredentials();
- }
-
- void InitConfigAndCredentialsCacheManager()
- {
- if (s_configManager)
- {
- return;
- }
- s_configManager = Aws::MakeUnique<ConfigAndCredentialsCacheManager>(CONFIG_CREDENTIALS_CACHE_MANAGER_TAG);
- }
-
- void CleanupConfigAndCredentialsCacheManager()
- {
- if (!s_configManager)
- {
- return;
- }
- s_configManager = nullptr;
- }
-
- void ReloadCachedConfigFile()
- {
- assert(s_configManager);
- s_configManager->ReloadConfigFile();
- }
-
- void ReloadCachedCredentialsFile()
- {
- assert(s_configManager);
- s_configManager->ReloadCredentialsFile();
- }
-
- bool HasCachedConfigProfile(const Aws::String& profileName)
- {
- assert(s_configManager);
- return s_configManager->HasConfigProfile(profileName);
- }
-
- Aws::Config::Profile GetCachedConfigProfile(const Aws::String& profileName)
- {
- assert(s_configManager);
- return s_configManager->GetConfigProfile(profileName);
- }
-
- Aws::Map<Aws::String, Aws::Config::Profile> GetCachedConfigProfiles()
- {
- assert(s_configManager);
- return s_configManager->GetConfigProfiles();
- }
-
- Aws::String GetCachedConfigValue(const Aws::String &profileName, const Aws::String &key)
- {
- assert(s_configManager);
- return s_configManager->GetConfig(profileName, key);
- }
-
- Aws::String GetCachedConfigValue(const Aws::String &key)
- {
- assert(s_configManager);
- return s_configManager->GetConfig(Aws::Auth::GetConfigProfileName(), key);
- }
-
- bool HasCachedCredentialsProfile(const Aws::String& profileName)
- {
- assert(s_configManager);
- return s_configManager->HasCredentialsProfile(profileName);
- }
-
- Aws::Config::Profile GetCachedCredentialsProfile(const Aws::String &profileName)
- {
- assert(s_configManager);
- return s_configManager->GetCredentialsProfile(profileName);
- }
-
- Aws::Map<Aws::String, Aws::Config::Profile> GetCachedCredentialsProfiles()
- {
- assert(s_configManager);
- return s_configManager->GetCredentialsProfiles();
- }
-
- Aws::Auth::AWSCredentials GetCachedCredentials(const Aws::String &profileName)
- {
- assert(s_configManager);
- return s_configManager->GetCredentials(profileName);
- }
+ ConfigAndCredentialsCacheManager::ConfigAndCredentialsCacheManager() :
+ m_credentialsFileLoader(Aws::Auth::ProfileConfigFileAWSCredentialsProvider::GetCredentialsProfileFilename()),
+ m_configFileLoader(Aws::Auth::GetConfigProfileFilename(), true/*use profile prefix*/)
+ {
+ ReloadCredentialsFile();
+ ReloadConfigFile();
+ }
+
+ void ConfigAndCredentialsCacheManager::ReloadConfigFile()
+ {
+ Aws::Utils::Threading::WriterLockGuard guard(m_configLock);
+ m_configFileLoader.SetFileName(Aws::Auth::GetConfigProfileFilename());
+ m_configFileLoader.Load();
+ }
+
+ void ConfigAndCredentialsCacheManager::ReloadCredentialsFile()
+ {
+ Aws::Utils::Threading::WriterLockGuard guard(m_credentialsLock);
+ m_credentialsFileLoader.SetFileName(Aws::Auth::ProfileConfigFileAWSCredentialsProvider::GetCredentialsProfileFilename());
+ m_credentialsFileLoader.Load();
+ }
+
+ bool ConfigAndCredentialsCacheManager::HasConfigProfile(const Aws::String& profileName) const
+ {
+ Aws::Utils::Threading::ReaderLockGuard guard(m_configLock);
+ return (m_configFileLoader.GetProfiles().count(profileName) == 1);
+ }
+
+ Aws::Config::Profile ConfigAndCredentialsCacheManager::GetConfigProfile(const Aws::String& profileName) const
+ {
+ Aws::Utils::Threading::ReaderLockGuard guard(m_configLock);
+ const auto& profiles = m_configFileLoader.GetProfiles();
+ const auto &iter = profiles.find(profileName);
+ if (iter == profiles.end())
+ {
+ return {};
+ }
+ return iter->second;
+ }
+
+ Aws::Map<Aws::String, Aws::Config::Profile> ConfigAndCredentialsCacheManager::GetConfigProfiles() const
+ {
+ Aws::Utils::Threading::ReaderLockGuard guard(m_configLock);
+ return m_configFileLoader.GetProfiles();
+ }
+
+ Aws::String ConfigAndCredentialsCacheManager::GetConfig(const Aws::String& profileName, const Aws::String& key) const
+ {
+ Aws::Utils::Threading::ReaderLockGuard guard(m_configLock);
+ const auto& profiles = m_configFileLoader.GetProfiles();
+ const auto &iter = profiles.find(profileName);
+ if (iter == profiles.end())
+ {
+ return {};
+ }
+ return iter->second.GetValue(key);
+ }
+
+ bool ConfigAndCredentialsCacheManager::HasCredentialsProfile(const Aws::String& profileName) const
+ {
+ Aws::Utils::Threading::ReaderLockGuard guard(m_credentialsLock);
+ return (m_credentialsFileLoader.GetProfiles().count(profileName) == 1);
+ }
+
+ Aws::Config::Profile ConfigAndCredentialsCacheManager::GetCredentialsProfile(const Aws::String& profileName) const
+ {
+ Aws::Utils::Threading::ReaderLockGuard guard(m_credentialsLock);
+ const auto &profiles = m_credentialsFileLoader.GetProfiles();
+ const auto &iter = profiles.find(profileName);
+ if (iter == profiles.end())
+ {
+ return {};
+ }
+ return iter->second;
+ }
+
+ Aws::Map<Aws::String, Aws::Config::Profile> ConfigAndCredentialsCacheManager::GetCredentialsProfiles() const
+ {
+ Aws::Utils::Threading::ReaderLockGuard guard(m_credentialsLock);
+ return m_credentialsFileLoader.GetProfiles();
+ }
+
+ Aws::Auth::AWSCredentials ConfigAndCredentialsCacheManager::GetCredentials(const Aws::String& profileName) const
+ {
+ Aws::Utils::Threading::ReaderLockGuard guard(m_credentialsLock);
+ const auto& profiles = m_credentialsFileLoader.GetProfiles();
+ const auto &iter = profiles.find(profileName);
+ if (iter == profiles.end())
+ {
+ return {};
+ }
+ return iter->second.GetCredentials();
+ }
+
+ void InitConfigAndCredentialsCacheManager()
+ {
+ if (s_configManager)
+ {
+ return;
+ }
+ s_configManager = Aws::MakeUnique<ConfigAndCredentialsCacheManager>(CONFIG_CREDENTIALS_CACHE_MANAGER_TAG);
+ }
+
+ void CleanupConfigAndCredentialsCacheManager()
+ {
+ if (!s_configManager)
+ {
+ return;
+ }
+ s_configManager = nullptr;
+ }
+
+ void ReloadCachedConfigFile()
+ {
+ assert(s_configManager);
+ s_configManager->ReloadConfigFile();
+ }
+
+ void ReloadCachedCredentialsFile()
+ {
+ assert(s_configManager);
+ s_configManager->ReloadCredentialsFile();
+ }
+
+ bool HasCachedConfigProfile(const Aws::String& profileName)
+ {
+ assert(s_configManager);
+ return s_configManager->HasConfigProfile(profileName);
+ }
+
+ Aws::Config::Profile GetCachedConfigProfile(const Aws::String& profileName)
+ {
+ assert(s_configManager);
+ return s_configManager->GetConfigProfile(profileName);
+ }
+
+ Aws::Map<Aws::String, Aws::Config::Profile> GetCachedConfigProfiles()
+ {
+ assert(s_configManager);
+ return s_configManager->GetConfigProfiles();
+ }
+
+ Aws::String GetCachedConfigValue(const Aws::String &profileName, const Aws::String &key)
+ {
+ assert(s_configManager);
+ return s_configManager->GetConfig(profileName, key);
+ }
+
+ Aws::String GetCachedConfigValue(const Aws::String &key)
+ {
+ assert(s_configManager);
+ return s_configManager->GetConfig(Aws::Auth::GetConfigProfileName(), key);
+ }
+
+ bool HasCachedCredentialsProfile(const Aws::String& profileName)
+ {
+ assert(s_configManager);
+ return s_configManager->HasCredentialsProfile(profileName);
+ }
+
+ Aws::Config::Profile GetCachedCredentialsProfile(const Aws::String &profileName)
+ {
+ assert(s_configManager);
+ return s_configManager->GetCredentialsProfile(profileName);
+ }
+
+ Aws::Map<Aws::String, Aws::Config::Profile> GetCachedCredentialsProfiles()
+ {
+ assert(s_configManager);
+ return s_configManager->GetCredentialsProfiles();
+ }
+
+ Aws::Auth::AWSCredentials GetCachedCredentials(const Aws::String &profileName)
+ {
+ assert(s_configManager);
+ return s_configManager->GetCredentials(profileName);
+ }
} // Config namespace
} // Aws namespace
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/external/cjson/cJSON.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/external/cjson/cJSON.cpp
index 4d090ca9a8b..2525976334e 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/external/cjson/cJSON.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/external/cjson/cJSON.cpp
@@ -269,7 +269,7 @@ static cJSON_bool parse_number(cJSON * const item, parse_buffer * const input_bu
unsigned char *after_end = NULL;
unsigned char number_c_string[64];
unsigned char decimal_point = get_decimal_point();
- bool isInteger = true;
+ bool isInteger = true;
size_t i = 0;
if ((input_buffer == NULL) || (input_buffer->content == NULL))
@@ -296,17 +296,17 @@ static cJSON_bool parse_number(cJSON * const item, parse_buffer * const input_bu
case '9':
case '+':
case '-':
- number_c_string[i] = buffer_at_offset(input_buffer)[i];
- break;
+ number_c_string[i] = buffer_at_offset(input_buffer)[i];
+ break;
case 'e':
case 'E':
number_c_string[i] = buffer_at_offset(input_buffer)[i];
- isInteger = false;
+ isInteger = false;
break;
case '.':
number_c_string[i] = decimal_point;
- isInteger = false;
+ isInteger = false;
break;
default:
@@ -323,12 +323,12 @@ loop_end:
}
item->valuedouble = number;
- // For integer which is out of the range of [INT_MIN, INT_MAX], it may lose precision if we cast it to double.
- // Instead, we keep the integer literal as a string.
- if (isInteger && (number > INT_MAX || number < INT_MIN))
- {
- item->valuestring = (char*)cJSON_strdup(number_c_string, &global_hooks);
- }
+ // For integer which is out of the range of [INT_MIN, INT_MAX], it may lose precision if we cast it to double.
+ // Instead, we keep the integer literal as a string.
+ if (isInteger && (number > INT_MAX || number < INT_MIN))
+ {
+ item->valuestring = (char*)cJSON_strdup(number_c_string, &global_hooks);
+ }
/* use saturation in case of overflow */
if (number >= INT_MAX)
@@ -497,13 +497,13 @@ static cJSON_bool print_number(const cJSON * const item, printbuffer * const out
return false;
}
- /* For integer which is out of the range of [INT_MIN, INT_MAX], valuestring is an integer literal. */
- if (item->valuestring)
- {
- length = sprintf((char*)number_buffer, "%s", item->valuestring);
- }
+ /* For integer which is out of the range of [INT_MIN, INT_MAX], valuestring is an integer literal. */
+ if (item->valuestring)
+ {
+ length = sprintf((char*)number_buffer, "%s", item->valuestring);
+ }
/* This checks for NaN and Infinity */
- else if ((d * 0) != 0)
+ else if ((d * 0) != 0)
{
length = sprintf((char*)number_buffer, "null");
}
@@ -520,7 +520,7 @@ static cJSON_bool print_number(const cJSON * const item, printbuffer * const out
}
}
- /* sprintf failed or buffer overrun occurred */
+ /* sprintf failed or buffer overrun occurred */
if ((length < 0) || (length > (int)(sizeof(number_buffer) - 1)))
{
return false;
@@ -1571,7 +1571,7 @@ static cJSON_bool parse_object(cJSON * const item, parse_buffer * const input_bu
buffer_skip_whitespace(input_buffer);
if (!parse_string(current_item, input_buffer))
{
- goto fail; /* failed to parse name */
+ goto fail; /* failed to parse name */
}
buffer_skip_whitespace(input_buffer);
@@ -2329,41 +2329,41 @@ CJSON_PUBLIC(cJSON *) cJSON_CreateNumber(double num)
return item;
}
-CJSON_PUBLIC(cJSON *) cJSON_CreateInt64(long long num)
-{
- cJSON *item = cJSON_New_Item(&global_hooks);
- if(item)
- {
- item->type = cJSON_Number;
- item->valuedouble = static_cast<double>(num);
-
- // For integer which is out of the range of [INT_MIN, INT_MAX], it may lose precision if we cast it to double.
- // Instead, we keep the integer literal as a string.
- if (num > INT_MAX || num < INT_MIN)
- {
- char buf[21];
- sprintf(buf, "%lld", num);
- item->valuestring = (char*)cJSON_strdup((const unsigned char*)buf, &global_hooks);
- }
-
- /* use saturation in case of overflow */
- if (num >= INT_MAX)
- {
- item->valueint = INT_MAX;
- }
- else if (num <= INT_MIN)
- {
- item->valueint = INT_MIN;
- }
- else
- {
- item->valueint = (int)num;
- }
- }
-
- return item;
-}
-
+CJSON_PUBLIC(cJSON *) cJSON_CreateInt64(long long num)
+{
+ cJSON *item = cJSON_New_Item(&global_hooks);
+ if(item)
+ {
+ item->type = cJSON_Number;
+ item->valuedouble = static_cast<double>(num);
+
+ // For integer which is out of the range of [INT_MIN, INT_MAX], it may lose precision if we cast it to double.
+ // Instead, we keep the integer literal as a string.
+ if (num > INT_MAX || num < INT_MIN)
+ {
+ char buf[21];
+ sprintf(buf, "%lld", num);
+ item->valuestring = (char*)cJSON_strdup((const unsigned char*)buf, &global_hooks);
+ }
+
+ /* use saturation in case of overflow */
+ if (num >= INT_MAX)
+ {
+ item->valueint = INT_MAX;
+ }
+ else if (num <= INT_MIN)
+ {
+ item->valueint = INT_MIN;
+ }
+ else
+ {
+ item->valueint = (int)num;
+ }
+ }
+
+ return item;
+}
+
CJSON_PUBLIC(cJSON *) cJSON_CreateString(const char *string)
{
cJSON *item = cJSON_New_Item(&global_hooks);
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/external/tinyxml2/tinyxml2.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/external/tinyxml2/tinyxml2.cpp
index 0323c55d040..ebe0fd9eec0 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/external/tinyxml2/tinyxml2.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/external/tinyxml2/tinyxml2.cpp
@@ -770,7 +770,7 @@ XMLNode::~XMLNode()
}
}
-const char* XMLNode::Value() const
+const char* XMLNode::Value() const
{
// Edge case: XMLDocuments don't have a Value. Return null.
if ( this->ToDocument() )
@@ -1339,12 +1339,12 @@ bool XMLUnknown::Accept( XMLVisitor* visitor ) const
// --------- XMLAttribute ---------- //
-const char* XMLAttribute::Name() const
+const char* XMLAttribute::Name() const
{
return _name.GetStr();
}
-const char* XMLAttribute::Value() const
+const char* XMLAttribute::Value() const
{
return _value.GetStr();
}
@@ -1531,42 +1531,42 @@ const char* XMLElement::Attribute( const char* name, const char* value ) const
return 0;
}
-int XMLElement::IntAttribute(const char* name, int defaultValue) const
+int XMLElement::IntAttribute(const char* name, int defaultValue) const
{
int i = defaultValue;
QueryIntAttribute(name, &i);
return i;
}
-unsigned XMLElement::UnsignedAttribute(const char* name, unsigned defaultValue) const
+unsigned XMLElement::UnsignedAttribute(const char* name, unsigned defaultValue) const
{
unsigned i = defaultValue;
QueryUnsignedAttribute(name, &i);
return i;
}
-int64_t XMLElement::Int64Attribute(const char* name, int64_t defaultValue) const
+int64_t XMLElement::Int64Attribute(const char* name, int64_t defaultValue) const
{
int64_t i = defaultValue;
QueryInt64Attribute(name, &i);
return i;
}
-bool XMLElement::BoolAttribute(const char* name, bool defaultValue) const
+bool XMLElement::BoolAttribute(const char* name, bool defaultValue) const
{
bool b = defaultValue;
QueryBoolAttribute(name, &b);
return b;
}
-double XMLElement::DoubleAttribute(const char* name, double defaultValue) const
+double XMLElement::DoubleAttribute(const char* name, double defaultValue) const
{
double d = defaultValue;
QueryDoubleAttribute(name, &d);
return d;
}
-float XMLElement::FloatAttribute(const char* name, float defaultValue) const
+float XMLElement::FloatAttribute(const char* name, float defaultValue) const
{
float f = defaultValue;
QueryFloatAttribute(name, &f);
@@ -1593,7 +1593,7 @@ void XMLElement::SetText( const char* inText )
}
-void XMLElement::SetText( int v )
+void XMLElement::SetText( int v )
{
char buf[BUF_SIZE];
XMLUtil::ToStr( v, buf, BUF_SIZE );
@@ -1601,7 +1601,7 @@ void XMLElement::SetText( int v )
}
-void XMLElement::SetText( unsigned v )
+void XMLElement::SetText( unsigned v )
{
char buf[BUF_SIZE];
XMLUtil::ToStr( v, buf, BUF_SIZE );
@@ -1625,7 +1625,7 @@ void XMLElement::SetText( bool v )
}
-void XMLElement::SetText( float v )
+void XMLElement::SetText( float v )
{
char buf[BUF_SIZE];
XMLUtil::ToStr( v, buf, BUF_SIZE );
@@ -1633,7 +1633,7 @@ void XMLElement::SetText( float v )
}
-void XMLElement::SetText( double v )
+void XMLElement::SetText( double v )
{
char buf[BUF_SIZE];
XMLUtil::ToStr( v, buf, BUF_SIZE );
@@ -2061,7 +2061,7 @@ void XMLDocument::Clear()
_commentPool.Trace( "comment" );
_attributePool.Trace( "attribute" );
#endif
-
+
#ifdef DEBUG
if ( !hadError ) {
TIXMLASSERT( _elementPool.CurrentAllocs() == _elementPool.Untracked() );
@@ -2140,7 +2140,7 @@ static FILE* callfopen( const char* filepath, const char* mode )
#endif
return fp;
}
-
+
void XMLDocument::DeleteNode( XMLNode* node ) {
TIXMLASSERT( node );
TIXMLASSERT(node->_document == this );
@@ -2340,7 +2340,7 @@ void XMLDocument::SetError( XMLError error, int lineNum, const char* format, ...
return errorName;
}
-const char* XMLDocument::ErrorStr() const
+const char* XMLDocument::ErrorStr() const
{
return _errorStr.Empty() ? "" : _errorStr.GetStr();
}
@@ -2798,5 +2798,5 @@ bool XMLPrinter::Visit( const XMLUnknown& unknown )
}
} // namespace tinyxml2
-} // namespace External
+} // namespace External
} // namespace Aws \ No newline at end of file
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/http/HttpClient.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/http/HttpClient.cpp
index 2502464cd09..85420233936 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/http/HttpClient.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/http/HttpClient.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/http/HttpClient.h>
#include <aws/core/http/HttpRequest.h>
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/http/HttpClientFactory.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/http/HttpClientFactory.cpp
index 7d199264754..a556e39a5d8 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/http/HttpClientFactory.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/http/HttpClientFactory.cpp
@@ -1,8 +1,8 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
-
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
+
#include <aws/core/http/HttpClientFactory.h>
#if ENABLE_CURL_CLIENT
@@ -34,11 +34,11 @@ namespace Aws
{
namespace Http
{
- static std::shared_ptr<HttpClientFactory>& GetHttpClientFactory()
- {
- static std::shared_ptr<HttpClientFactory> s_HttpClientFactory(nullptr);
- return s_HttpClientFactory;
- }
+ static std::shared_ptr<HttpClientFactory>& GetHttpClientFactory()
+ {
+ static std::shared_ptr<HttpClientFactory> s_HttpClientFactory(nullptr);
+ return s_HttpClientFactory;
+ }
static bool s_InitCleanupCurlFlag(false);
static bool s_InstallSigPipeHandler(false);
@@ -160,44 +160,44 @@ namespace Aws
void InitHttp()
{
- if(!GetHttpClientFactory())
+ if(!GetHttpClientFactory())
{
- GetHttpClientFactory() = Aws::MakeShared<DefaultHttpClientFactory>(HTTP_CLIENT_FACTORY_ALLOCATION_TAG);
+ GetHttpClientFactory() = Aws::MakeShared<DefaultHttpClientFactory>(HTTP_CLIENT_FACTORY_ALLOCATION_TAG);
}
- GetHttpClientFactory()->InitStaticState();
+ GetHttpClientFactory()->InitStaticState();
}
void CleanupHttp()
{
- if(GetHttpClientFactory())
+ if(GetHttpClientFactory())
{
- GetHttpClientFactory()->CleanupStaticState();
- GetHttpClientFactory() = nullptr;
+ GetHttpClientFactory()->CleanupStaticState();
+ GetHttpClientFactory() = nullptr;
}
}
void SetHttpClientFactory(const std::shared_ptr<HttpClientFactory>& factory)
{
CleanupHttp();
- GetHttpClientFactory() = factory;
+ GetHttpClientFactory() = factory;
}
std::shared_ptr<HttpClient> CreateHttpClient(const Aws::Client::ClientConfiguration& clientConfiguration)
{
- assert(GetHttpClientFactory());
- return GetHttpClientFactory()->CreateHttpClient(clientConfiguration);
+ assert(GetHttpClientFactory());
+ return GetHttpClientFactory()->CreateHttpClient(clientConfiguration);
}
std::shared_ptr<HttpRequest> CreateHttpRequest(const Aws::String& uri, HttpMethod method, const Aws::IOStreamFactory& streamFactory)
{
- assert(GetHttpClientFactory());
- return GetHttpClientFactory()->CreateHttpRequest(uri, method, streamFactory);
+ assert(GetHttpClientFactory());
+ return GetHttpClientFactory()->CreateHttpRequest(uri, method, streamFactory);
}
std::shared_ptr<HttpRequest> CreateHttpRequest(const URI& uri, HttpMethod method, const Aws::IOStreamFactory& streamFactory)
{
- assert(GetHttpClientFactory());
- return GetHttpClientFactory()->CreateHttpRequest(uri, method, streamFactory);
+ assert(GetHttpClientFactory());
+ return GetHttpClientFactory()->CreateHttpRequest(uri, method, streamFactory);
}
}
}
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/http/HttpRequest.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/http/HttpRequest.cpp
index 121f6f30c97..95cb626c22e 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/http/HttpRequest.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/http/HttpRequest.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/http/HttpRequest.h>
@@ -10,28 +10,28 @@ namespace Aws
namespace Http
{
-const char DATE_HEADER[] = "date";
-const char AWS_DATE_HEADER[] = "X-Amz-Date";
-const char AWS_SECURITY_TOKEN[] = "X-Amz-Security-Token";
-const char ACCEPT_HEADER[] = "accept";
-const char ACCEPT_CHAR_SET_HEADER[] = "accept-charset";
-const char ACCEPT_ENCODING_HEADER[] = "accept-encoding";
-const char AUTHORIZATION_HEADER[] = "authorization";
-const char AWS_AUTHORIZATION_HEADER[] = "authorization";
-const char COOKIE_HEADER[] = "cookie";
-const char CONTENT_LENGTH_HEADER[] = "content-length";
-const char CONTENT_TYPE_HEADER[] = "content-type";
-const char TRANSFER_ENCODING_HEADER[] = "transfer-encoding";
-const char USER_AGENT_HEADER[] = "user-agent";
-const char VIA_HEADER[] = "via";
-const char HOST_HEADER[] = "host";
-const char AMZ_TARGET_HEADER[] = "x-amz-target";
-const char X_AMZ_EXPIRES_HEADER[] = "X-Amz-Expires";
-const char CONTENT_MD5_HEADER[] = "content-md5";
-const char API_VERSION_HEADER[] = "x-amz-api-version";
-const char SDK_INVOCATION_ID_HEADER[] = "amz-sdk-invocation-id";
-const char SDK_REQUEST_HEADER[] = "amz-sdk-request";
-const char CHUNKED_VALUE[] = "chunked";
+const char DATE_HEADER[] = "date";
+const char AWS_DATE_HEADER[] = "X-Amz-Date";
+const char AWS_SECURITY_TOKEN[] = "X-Amz-Security-Token";
+const char ACCEPT_HEADER[] = "accept";
+const char ACCEPT_CHAR_SET_HEADER[] = "accept-charset";
+const char ACCEPT_ENCODING_HEADER[] = "accept-encoding";
+const char AUTHORIZATION_HEADER[] = "authorization";
+const char AWS_AUTHORIZATION_HEADER[] = "authorization";
+const char COOKIE_HEADER[] = "cookie";
+const char CONTENT_LENGTH_HEADER[] = "content-length";
+const char CONTENT_TYPE_HEADER[] = "content-type";
+const char TRANSFER_ENCODING_HEADER[] = "transfer-encoding";
+const char USER_AGENT_HEADER[] = "user-agent";
+const char VIA_HEADER[] = "via";
+const char HOST_HEADER[] = "host";
+const char AMZ_TARGET_HEADER[] = "x-amz-target";
+const char X_AMZ_EXPIRES_HEADER[] = "X-Amz-Expires";
+const char CONTENT_MD5_HEADER[] = "content-md5";
+const char API_VERSION_HEADER[] = "x-amz-api-version";
+const char SDK_INVOCATION_ID_HEADER[] = "amz-sdk-invocation-id";
+const char SDK_REQUEST_HEADER[] = "amz-sdk-request";
+const char CHUNKED_VALUE[] = "chunked";
} // Http
} // Aws
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/http/HttpTypes.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/http/HttpTypes.cpp
index feac9ff9045..4d313e52f39 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/http/HttpTypes.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/http/HttpTypes.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/http/HttpTypes.h>
#include <cassert>
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/http/Scheme.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/http/Scheme.cpp
index f04aa145d3f..5dcea06aab8 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/http/Scheme.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/http/Scheme.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/http/Scheme.h>
#include <aws/core/utils/memory/stl/AWSString.h>
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/http/URI.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/http/URI.cpp
index 2248219e544..a2239df54b1 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/http/URI.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/http/URI.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/http/URI.h>
@@ -131,8 +131,8 @@ Aws::String URI::URLEncodePathRFC3986(const Aws::String& path)
// RFC 3986 §2.2 Reserved characters
// NOTE: this implementation does not accurately implement the RFC on purpose to accommodate for
// discrepancies in the implementations of URL encoding between AWS services for legacy reasons.
- case '$': case '&': case ',':
- case ':': case '=': case '@':
+ case '$': case '&': case ',':
+ case ':': case '=': case '@':
ss << c;
break;
default:
@@ -161,42 +161,42 @@ Aws::String URI::URLEncodePath(const Aws::String& path)
}
//if the last character was also a slash, then add that back here.
- if (path.length() > 0 && path[path.length() - 1] == '/')
+ if (path.length() > 0 && path[path.length() - 1] == '/')
{
ss << '/';
}
- if (path.length() > 0 && path[0] != '/')
- {
- return ss.str().substr(1);
- }
- else
- {
- return ss.str();
- }
+ if (path.length() > 0 && path[0] != '/')
+ {
+ return ss.str().substr(1);
+ }
+ else
+ {
+ return ss.str();
+ }
}
void URI::SetPath(const Aws::String& value)
-{
- const Aws::Vector<Aws::String> pathParts = StringUtils::Split(value, '/');
- Aws::String path;
- path.reserve(value.length() + 1/* in case we have to append slash before the path. */);
-
- for (const auto& segment : pathParts)
- {
- path.push_back('/');
- path.append(segment);
- }
-
- if (value.back() == '/')
- {
- path.push_back('/');
- }
- m_path = std::move(path);
+{
+ const Aws::Vector<Aws::String> pathParts = StringUtils::Split(value, '/');
+ Aws::String path;
+ path.reserve(value.length() + 1/* in case we have to append slash before the path. */);
+
+ for (const auto& segment : pathParts)
+ {
+ path.push_back('/');
+ path.append(segment);
+ }
+
+ if (value.back() == '/')
+ {
+ path.push_back('/');
+ }
+ m_path = std::move(path);
}
//ugh, this isn't even part of the canonicalization spec. It is part of how our services have implemented their signers though....
-//it doesn't really hurt anything to reorder it though, so go ahead and sort the values for parameters with the same key
+//it doesn't really hurt anything to reorder it though, so go ahead and sort the values for parameters with the same key
void InsertValueOrderedParameter(QueryStringParameterCollection& queryParams, const Aws::String& key, const Aws::String& value)
{
auto entriesAtKey = queryParams.equal_range(key);
@@ -204,7 +204,7 @@ void InsertValueOrderedParameter(QueryStringParameterCollection& queryParams, co
{
if (entry->second > value)
{
- queryParams.emplace_hint(entry, key, value);
+ queryParams.emplace_hint(entry, key, value);
return;
}
}
@@ -275,7 +275,7 @@ void URI::CanonicalizeQueryString()
queryStringStream << "?";
}
- if(m_queryString.find('=') != std::string::npos)
+ if(m_queryString.find('=') != std::string::npos)
{
for (QueryStringParameterCollection::iterator iter = sortedParameters.begin();
iter != sortedParameters.end(); ++iter)
@@ -320,7 +320,7 @@ void URI::SetQueryString(const Aws::String& str)
m_queryString = "";
if (str.empty()) return;
-
+
if (str.front() != '?')
{
m_queryString.append("?").append(str);
@@ -328,7 +328,7 @@ void URI::SetQueryString(const Aws::String& str)
else
{
m_queryString = str;
- }
+ }
}
Aws::String URI::GetURIString(bool includeQueryString) const
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/http/curl/CurlHandleContainer.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/http/curl/CurlHandleContainer.cpp
index 840247ed949..1a965cd7950 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/http/curl/CurlHandleContainer.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/http/curl/CurlHandleContainer.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/http/curl/CurlHandleContainer.h>
#include <aws/core/utils/logging/LogMacros.h>
@@ -14,10 +14,10 @@ using namespace Aws::Http;
static const char* CURL_HANDLE_CONTAINER_TAG = "CurlHandleContainer";
-CurlHandleContainer::CurlHandleContainer(unsigned maxSize, long httpRequestTimeout, long connectTimeout, bool enableTcpKeepAlive,
- unsigned long tcpKeepAliveIntervalMs, long lowSpeedTime, unsigned long lowSpeedLimit) :
- m_maxPoolSize(maxSize), m_httpRequestTimeout(httpRequestTimeout), m_connectTimeout(connectTimeout), m_enableTcpKeepAlive(enableTcpKeepAlive),
- m_tcpKeepAliveIntervalMs(tcpKeepAliveIntervalMs), m_lowSpeedTime(lowSpeedTime), m_lowSpeedLimit(lowSpeedLimit), m_poolSize(0)
+CurlHandleContainer::CurlHandleContainer(unsigned maxSize, long httpRequestTimeout, long connectTimeout, bool enableTcpKeepAlive,
+ unsigned long tcpKeepAliveIntervalMs, long lowSpeedTime, unsigned long lowSpeedLimit) :
+ m_maxPoolSize(maxSize), m_httpRequestTimeout(httpRequestTimeout), m_connectTimeout(connectTimeout), m_enableTcpKeepAlive(enableTcpKeepAlive),
+ m_tcpKeepAliveIntervalMs(tcpKeepAliveIntervalMs), m_lowSpeedTime(lowSpeedTime), m_lowSpeedLimit(lowSpeedLimit), m_poolSize(0)
{
AWS_LOGSTREAM_INFO(CURL_HANDLE_CONTAINER_TAG, "Initializing CurlHandleContainer with size " << maxSize);
}
@@ -60,45 +60,45 @@ void CurlHandleContainer::ReleaseCurlHandle(CURL* handle)
}
}
-void CurlHandleContainer::DestroyCurlHandle(CURL* handle)
-{
- if (!handle)
- {
- return;
- }
-
- curl_easy_cleanup(handle);
- AWS_LOGSTREAM_DEBUG(CURL_HANDLE_CONTAINER_TAG, "Destroy curl handle: " << handle);
- {
- std::lock_guard<std::mutex> locker(m_containerLock);
- // Other threads could be blocked and waiting on m_handleContainer.Acquire()
- // If the handle is not released back to the pool, it could create a deadlock
- // Create a new handle and release that into the pool
- handle = CreateCurlHandleInPool();
- }
- if (handle)
- {
- AWS_LOGSTREAM_DEBUG(CURL_HANDLE_CONTAINER_TAG, "Created replacement handle and released to pool: " << handle);
- }
-}
-
-
-CURL* CurlHandleContainer::CreateCurlHandleInPool()
-{
- CURL* curlHandle = curl_easy_init();
-
- if (curlHandle)
- {
- SetDefaultOptionsOnHandle(curlHandle);
- m_handleContainer.Release(curlHandle);
- }
- else
- {
- AWS_LOGSTREAM_ERROR(CURL_HANDLE_CONTAINER_TAG, "curl_easy_init failed to allocate.");
- }
- return curlHandle;
-}
-
+void CurlHandleContainer::DestroyCurlHandle(CURL* handle)
+{
+ if (!handle)
+ {
+ return;
+ }
+
+ curl_easy_cleanup(handle);
+ AWS_LOGSTREAM_DEBUG(CURL_HANDLE_CONTAINER_TAG, "Destroy curl handle: " << handle);
+ {
+ std::lock_guard<std::mutex> locker(m_containerLock);
+ // Other threads could be blocked and waiting on m_handleContainer.Acquire()
+ // If the handle is not released back to the pool, it could create a deadlock
+ // Create a new handle and release that into the pool
+ handle = CreateCurlHandleInPool();
+ }
+ if (handle)
+ {
+ AWS_LOGSTREAM_DEBUG(CURL_HANDLE_CONTAINER_TAG, "Created replacement handle and released to pool: " << handle);
+ }
+}
+
+
+CURL* CurlHandleContainer::CreateCurlHandleInPool()
+{
+ CURL* curlHandle = curl_easy_init();
+
+ if (curlHandle)
+ {
+ SetDefaultOptionsOnHandle(curlHandle);
+ m_handleContainer.Release(curlHandle);
+ }
+ else
+ {
+ AWS_LOGSTREAM_ERROR(CURL_HANDLE_CONTAINER_TAG, "curl_easy_init failed to allocate.");
+ }
+ return curlHandle;
+}
+
bool CurlHandleContainer::CheckAndGrowPool()
{
std::lock_guard<std::mutex> locker(m_containerLock);
@@ -111,7 +111,7 @@ bool CurlHandleContainer::CheckAndGrowPool()
unsigned actuallyAdded = 0;
for (unsigned i = 0; i < amountToAdd; ++i)
{
- CURL* curlHandle = CreateCurlHandleInPool();
+ CURL* curlHandle = CreateCurlHandleInPool();
if (curlHandle)
{
@@ -140,13 +140,13 @@ void CurlHandleContainer::SetDefaultOptionsOnHandle(CURL* handle)
//always turn signals off. This also forces dns queries to
//not be included in the timeout calculations.
curl_easy_setopt(handle, CURLOPT_NOSIGNAL, 1L);
- curl_easy_setopt(handle, CURLOPT_TIMEOUT_MS, m_httpRequestTimeout);
+ curl_easy_setopt(handle, CURLOPT_TIMEOUT_MS, m_httpRequestTimeout);
curl_easy_setopt(handle, CURLOPT_CONNECTTIMEOUT_MS, m_connectTimeout);
- curl_easy_setopt(handle, CURLOPT_LOW_SPEED_LIMIT, m_lowSpeedLimit);
- curl_easy_setopt(handle, CURLOPT_LOW_SPEED_TIME, m_lowSpeedTime < 1000 ? (m_lowSpeedTime == 0 ? 0 : 1) : m_lowSpeedTime / 1000);
- curl_easy_setopt(handle, CURLOPT_TCP_KEEPALIVE, m_enableTcpKeepAlive ? 1L : 0L);
- curl_easy_setopt(handle, CURLOPT_TCP_KEEPINTVL, m_tcpKeepAliveIntervalMs / 1000);
- curl_easy_setopt(handle, CURLOPT_TCP_KEEPIDLE, m_tcpKeepAliveIntervalMs / 1000);
+ curl_easy_setopt(handle, CURLOPT_LOW_SPEED_LIMIT, m_lowSpeedLimit);
+ curl_easy_setopt(handle, CURLOPT_LOW_SPEED_TIME, m_lowSpeedTime < 1000 ? (m_lowSpeedTime == 0 ? 0 : 1) : m_lowSpeedTime / 1000);
+ curl_easy_setopt(handle, CURLOPT_TCP_KEEPALIVE, m_enableTcpKeepAlive ? 1L : 0L);
+ curl_easy_setopt(handle, CURLOPT_TCP_KEEPINTVL, m_tcpKeepAliveIntervalMs / 1000);
+ curl_easy_setopt(handle, CURLOPT_TCP_KEEPIDLE, m_tcpKeepAliveIntervalMs / 1000);
#ifdef CURL_HAS_H2
curl_easy_setopt(handle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2_0);
#endif
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/http/curl/CurlHttpClient.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/http/curl/CurlHttpClient.cpp
index ee03bea8754..2fb9cc9643f 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/http/curl/CurlHttpClient.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/http/curl/CurlHttpClient.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/http/curl/CurlHttpClient.h>
#include <aws/core/http/HttpRequest.h>
@@ -123,8 +123,8 @@ static char* strdup_callback(const char* str)
struct CurlWriteCallbackContext
{
CurlWriteCallbackContext(const CurlHttpClient* client,
- HttpRequest* request,
- HttpResponse* response,
+ HttpRequest* request,
+ HttpResponse* response,
Aws::Utils::RateLimits::RateLimiterInterface* rateLimiter) :
m_client(client),
m_request(request),
@@ -149,171 +149,171 @@ struct CurlReadCallbackContext
{}
const CurlHttpClient* m_client;
- CURL* m_curlHandle;
+ CURL* m_curlHandle;
Aws::Utils::RateLimits::RateLimiterInterface* m_rateLimiter;
HttpRequest* m_request;
};
static const char* CURL_HTTP_CLIENT_TAG = "CurlHttpClient";
-static size_t WriteData(char* ptr, size_t size, size_t nmemb, void* userdata)
+static size_t WriteData(char* ptr, size_t size, size_t nmemb, void* userdata)
{
- if (ptr)
+ if (ptr)
+ {
+ CurlWriteCallbackContext* context = reinterpret_cast<CurlWriteCallbackContext*>(userdata);
+
+ const CurlHttpClient* client = context->m_client;
+ if(!client->ContinueRequest(*context->m_request) || !client->IsRequestProcessingEnabled())
+ {
+ return 0;
+ }
+
+ HttpResponse* response = context->m_response;
+ size_t sizeToWrite = size * nmemb;
+ if (context->m_rateLimiter)
+ {
+ context->m_rateLimiter->ApplyAndPayForCost(static_cast<int64_t>(sizeToWrite));
+ }
+
+ response->GetResponseBody().write(ptr, static_cast<std::streamsize>(sizeToWrite));
+ if (context->m_request->IsEventStreamRequest())
+ {
+ response->GetResponseBody().flush();
+ }
+ auto& receivedHandler = context->m_request->GetDataReceivedEventHandler();
+ if (receivedHandler)
+ {
+ receivedHandler(context->m_request, context->m_response, static_cast<long long>(sizeToWrite));
+ }
+
+ AWS_LOGSTREAM_TRACE(CURL_HTTP_CLIENT_TAG, sizeToWrite << " bytes written to response.");
+ context->m_numBytesResponseReceived += sizeToWrite;
+ return sizeToWrite;
+ }
+ return 0;
+}
+
+static size_t WriteHeader(char* ptr, size_t size, size_t nmemb, void* userdata)
+{
+ if (ptr)
+ {
+ CurlWriteCallbackContext* context = reinterpret_cast<CurlWriteCallbackContext*>(userdata);
+ AWS_LOGSTREAM_TRACE(CURL_HTTP_CLIENT_TAG, ptr);
+ HttpResponse* response = context->m_response;
+ Aws::String headerLine(ptr);
+ Aws::Vector<Aws::String> keyValuePair = StringUtils::Split(headerLine, ':', 2);
+
+ if (keyValuePair.size() == 2)
+ {
+ response->AddHeader(StringUtils::Trim(keyValuePair[0].c_str()), StringUtils::Trim(keyValuePair[1].c_str()));
+ }
+
+ return size * nmemb;
+ }
+ return 0;
+}
+
+
+static size_t ReadBody(char* ptr, size_t size, size_t nmemb, void* userdata)
+{
+ CurlReadCallbackContext* context = reinterpret_cast<CurlReadCallbackContext*>(userdata);
+ if(context == nullptr)
+ {
+ return 0;
+ }
+
+ const CurlHttpClient* client = context->m_client;
+ if(!client->ContinueRequest(*context->m_request) || !client->IsRequestProcessingEnabled())
+ {
+ return CURL_READFUNC_ABORT;
+ }
+
+ HttpRequest* request = context->m_request;
+ const std::shared_ptr<Aws::IOStream>& ioStream = request->GetContentBody();
+
+ const size_t amountToRead = size * nmemb;
+ if (ioStream != nullptr && amountToRead > 0)
+ {
+ if (request->IsEventStreamRequest())
+ {
+ // Waiting for next available character to read.
+ // Without peek(), readsome() will keep reading 0 byte from the stream.
+ ioStream->peek();
+ ioStream->readsome(ptr, amountToRead);
+ }
+ else
+ {
+ ioStream->read(ptr, amountToRead);
+ }
+ size_t amountRead = static_cast<size_t>(ioStream->gcount());
+ auto& sentHandler = request->GetDataSentEventHandler();
+ if (sentHandler)
+ {
+ sentHandler(request, static_cast<long long>(amountRead));
+ }
+
+ if (context->m_rateLimiter)
+ {
+ context->m_rateLimiter->ApplyAndPayForCost(static_cast<int64_t>(amountRead));
+ }
+
+ return amountRead;
+ }
+
+ return 0;
+}
+
+static size_t SeekBody(void* userdata, curl_off_t offset, int origin)
+{
+ CurlReadCallbackContext* context = reinterpret_cast<CurlReadCallbackContext*>(userdata);
+ if(context == nullptr)
+ {
+ return CURL_SEEKFUNC_FAIL;
+ }
+
+ const CurlHttpClient* client = context->m_client;
+ if(!client->ContinueRequest(*context->m_request) || !client->IsRequestProcessingEnabled())
+ {
+ return CURL_SEEKFUNC_FAIL;
+ }
+
+ HttpRequest* request = context->m_request;
+ const std::shared_ptr<Aws::IOStream>& ioStream = request->GetContentBody();
+
+ std::ios_base::seekdir dir;
+ switch(origin)
+ {
+ case SEEK_SET:
+ dir = std::ios_base::beg;
+ break;
+ case SEEK_CUR:
+ dir = std::ios_base::cur;
+ break;
+ case SEEK_END:
+ dir = std::ios_base::end;
+ break;
+ default:
+ return CURL_SEEKFUNC_FAIL;
+ }
+
+ ioStream->clear();
+ ioStream->seekg(offset, dir);
+ if (ioStream->fail()) {
+ return CURL_SEEKFUNC_CANTSEEK;
+ }
+
+ return CURL_SEEKFUNC_OK;
+}
+
+void SetOptCodeForHttpMethod(CURL* requestHandle, const std::shared_ptr<HttpRequest>& request)
+{
+ switch (request->GetMethod())
{
- CurlWriteCallbackContext* context = reinterpret_cast<CurlWriteCallbackContext*>(userdata);
-
- const CurlHttpClient* client = context->m_client;
- if(!client->ContinueRequest(*context->m_request) || !client->IsRequestProcessingEnabled())
- {
- return 0;
- }
-
- HttpResponse* response = context->m_response;
- size_t sizeToWrite = size * nmemb;
- if (context->m_rateLimiter)
- {
- context->m_rateLimiter->ApplyAndPayForCost(static_cast<int64_t>(sizeToWrite));
- }
-
- response->GetResponseBody().write(ptr, static_cast<std::streamsize>(sizeToWrite));
- if (context->m_request->IsEventStreamRequest())
- {
- response->GetResponseBody().flush();
- }
- auto& receivedHandler = context->m_request->GetDataReceivedEventHandler();
- if (receivedHandler)
- {
- receivedHandler(context->m_request, context->m_response, static_cast<long long>(sizeToWrite));
- }
-
- AWS_LOGSTREAM_TRACE(CURL_HTTP_CLIENT_TAG, sizeToWrite << " bytes written to response.");
- context->m_numBytesResponseReceived += sizeToWrite;
- return sizeToWrite;
- }
- return 0;
-}
-
-static size_t WriteHeader(char* ptr, size_t size, size_t nmemb, void* userdata)
-{
- if (ptr)
- {
- CurlWriteCallbackContext* context = reinterpret_cast<CurlWriteCallbackContext*>(userdata);
- AWS_LOGSTREAM_TRACE(CURL_HTTP_CLIENT_TAG, ptr);
- HttpResponse* response = context->m_response;
- Aws::String headerLine(ptr);
- Aws::Vector<Aws::String> keyValuePair = StringUtils::Split(headerLine, ':', 2);
-
- if (keyValuePair.size() == 2)
- {
- response->AddHeader(StringUtils::Trim(keyValuePair[0].c_str()), StringUtils::Trim(keyValuePair[1].c_str()));
- }
-
- return size * nmemb;
- }
- return 0;
-}
-
-
-static size_t ReadBody(char* ptr, size_t size, size_t nmemb, void* userdata)
-{
- CurlReadCallbackContext* context = reinterpret_cast<CurlReadCallbackContext*>(userdata);
- if(context == nullptr)
- {
- return 0;
- }
-
- const CurlHttpClient* client = context->m_client;
- if(!client->ContinueRequest(*context->m_request) || !client->IsRequestProcessingEnabled())
- {
- return CURL_READFUNC_ABORT;
- }
-
- HttpRequest* request = context->m_request;
- const std::shared_ptr<Aws::IOStream>& ioStream = request->GetContentBody();
-
- const size_t amountToRead = size * nmemb;
- if (ioStream != nullptr && amountToRead > 0)
- {
- if (request->IsEventStreamRequest())
- {
- // Waiting for next available character to read.
- // Without peek(), readsome() will keep reading 0 byte from the stream.
- ioStream->peek();
- ioStream->readsome(ptr, amountToRead);
- }
- else
- {
- ioStream->read(ptr, amountToRead);
- }
- size_t amountRead = static_cast<size_t>(ioStream->gcount());
- auto& sentHandler = request->GetDataSentEventHandler();
- if (sentHandler)
- {
- sentHandler(request, static_cast<long long>(amountRead));
- }
-
- if (context->m_rateLimiter)
- {
- context->m_rateLimiter->ApplyAndPayForCost(static_cast<int64_t>(amountRead));
- }
-
- return amountRead;
- }
-
- return 0;
-}
-
-static size_t SeekBody(void* userdata, curl_off_t offset, int origin)
-{
- CurlReadCallbackContext* context = reinterpret_cast<CurlReadCallbackContext*>(userdata);
- if(context == nullptr)
- {
- return CURL_SEEKFUNC_FAIL;
- }
-
- const CurlHttpClient* client = context->m_client;
- if(!client->ContinueRequest(*context->m_request) || !client->IsRequestProcessingEnabled())
- {
- return CURL_SEEKFUNC_FAIL;
- }
-
- HttpRequest* request = context->m_request;
- const std::shared_ptr<Aws::IOStream>& ioStream = request->GetContentBody();
-
- std::ios_base::seekdir dir;
- switch(origin)
- {
- case SEEK_SET:
- dir = std::ios_base::beg;
- break;
- case SEEK_CUR:
- dir = std::ios_base::cur;
- break;
- case SEEK_END:
- dir = std::ios_base::end;
- break;
- default:
- return CURL_SEEKFUNC_FAIL;
- }
-
- ioStream->clear();
- ioStream->seekg(offset, dir);
- if (ioStream->fail()) {
- return CURL_SEEKFUNC_CANTSEEK;
- }
-
- return CURL_SEEKFUNC_OK;
-}
-
-void SetOptCodeForHttpMethod(CURL* requestHandle, const std::shared_ptr<HttpRequest>& request)
-{
- switch (request->GetMethod())
- {
case HttpMethod::HTTP_GET:
curl_easy_setopt(requestHandle, CURLOPT_HTTPGET, 1L);
break;
case HttpMethod::HTTP_POST:
- if (request->HasHeader(Aws::Http::CONTENT_LENGTH_HEADER) && request->GetHeaderValue(Aws::Http::CONTENT_LENGTH_HEADER) == "0")
+ if (request->HasHeader(Aws::Http::CONTENT_LENGTH_HEADER) && request->GetHeaderValue(Aws::Http::CONTENT_LENGTH_HEADER) == "0")
{
curl_easy_setopt(requestHandle, CURLOPT_CUSTOMREQUEST, "POST");
}
@@ -323,8 +323,8 @@ void SetOptCodeForHttpMethod(CURL* requestHandle, const std::shared_ptr<HttpRequ
}
break;
case HttpMethod::HTTP_PUT:
- if ((!request->HasHeader(Aws::Http::CONTENT_LENGTH_HEADER) || request->GetHeaderValue(Aws::Http::CONTENT_LENGTH_HEADER) == "0") &&
- !request->HasHeader(Aws::Http::TRANSFER_ENCODING_HEADER))
+ if ((!request->HasHeader(Aws::Http::CONTENT_LENGTH_HEADER) || request->GetHeaderValue(Aws::Http::CONTENT_LENGTH_HEADER) == "0") &&
+ !request->HasHeader(Aws::Http::TRANSFER_ENCODING_HEADER))
{
curl_easy_setopt(requestHandle, CURLOPT_CUSTOMREQUEST, "PUT");
}
@@ -338,8 +338,8 @@ void SetOptCodeForHttpMethod(CURL* requestHandle, const std::shared_ptr<HttpRequ
curl_easy_setopt(requestHandle, CURLOPT_NOBODY, 1L);
break;
case HttpMethod::HTTP_PATCH:
- if ((!request->HasHeader(Aws::Http::CONTENT_LENGTH_HEADER)|| request->GetHeaderValue(Aws::Http::CONTENT_LENGTH_HEADER) == "0") &&
- !request->HasHeader(Aws::Http::TRANSFER_ENCODING_HEADER))
+ if ((!request->HasHeader(Aws::Http::CONTENT_LENGTH_HEADER)|| request->GetHeaderValue(Aws::Http::CONTENT_LENGTH_HEADER) == "0") &&
+ !request->HasHeader(Aws::Http::TRANSFER_ENCODING_HEADER))
{
curl_easy_setopt(requestHandle, CURLOPT_CUSTOMREQUEST, "PATCH");
}
@@ -367,9 +367,9 @@ void CurlHttpClient::InitGlobalState()
{
if (!isInit)
{
- auto curlVersionData = curl_version_info(CURLVERSION_NOW);
- AWS_LOGSTREAM_INFO(CURL_HTTP_CLIENT_TAG, "Initializing Curl library with version: " << curlVersionData->version
- << ", ssl version: " << curlVersionData->ssl_version);
+ auto curlVersionData = curl_version_info(CURLVERSION_NOW);
+ AWS_LOGSTREAM_INFO(CURL_HTTP_CLIENT_TAG, "Initializing Curl library with version: " << curlVersionData->version
+ << ", ssl version: " << curlVersionData->ssl_version);
isInit = true;
#ifdef AWS_CUSTOM_MEMORY_MANAGEMENT
curl_global_init_mem(CURL_GLOBAL_ALL, &malloc_callback, &free_callback, &realloc_callback, &strdup_callback, &calloc_callback);
@@ -435,48 +435,48 @@ int CurlDebugCallback(CURL *handle, curl_infotype type, char *data, size_t size,
CurlHttpClient::CurlHttpClient(const ClientConfiguration& clientConfig) :
- Base(),
- m_curlHandleContainer(clientConfig.maxConnections, clientConfig.httpRequestTimeoutMs, clientConfig.connectTimeoutMs, clientConfig.enableTcpKeepAlive,
- clientConfig.tcpKeepAliveIntervalMs, clientConfig.requestTimeoutMs, clientConfig.lowSpeedLimit),
+ Base(),
+ m_curlHandleContainer(clientConfig.maxConnections, clientConfig.httpRequestTimeoutMs, clientConfig.connectTimeoutMs, clientConfig.enableTcpKeepAlive,
+ clientConfig.tcpKeepAliveIntervalMs, clientConfig.requestTimeoutMs, clientConfig.lowSpeedLimit),
m_isUsingProxy(!clientConfig.proxyHost.empty()), m_proxyUserName(clientConfig.proxyUserName),
m_proxyPassword(clientConfig.proxyPassword), m_proxyScheme(SchemeMapper::ToString(clientConfig.proxyScheme)), m_proxyHost(clientConfig.proxyHost),
- m_proxySSLCertPath(clientConfig.proxySSLCertPath), m_proxySSLCertType(clientConfig.proxySSLCertType),
- m_proxySSLKeyPath(clientConfig.proxySSLKeyPath), m_proxySSLKeyType(clientConfig.proxySSLKeyType),
- m_proxyKeyPasswd(clientConfig.proxySSLKeyPassword),
+ m_proxySSLCertPath(clientConfig.proxySSLCertPath), m_proxySSLCertType(clientConfig.proxySSLCertType),
+ m_proxySSLKeyPath(clientConfig.proxySSLKeyPath), m_proxySSLKeyType(clientConfig.proxySSLKeyType),
+ m_proxyKeyPasswd(clientConfig.proxySSLKeyPassword),
m_proxyPort(clientConfig.proxyPort), m_verifySSL(clientConfig.verifySSL), m_caPath(clientConfig.caPath),
m_caFile(clientConfig.caFile), m_proxyCaPath(clientConfig.proxyCaPath), m_proxyCaFile(clientConfig.proxyCaFile),
- m_disableExpectHeader(clientConfig.disableExpectHeader)
+ m_disableExpectHeader(clientConfig.disableExpectHeader)
{
- if (clientConfig.followRedirects == FollowRedirectsPolicy::NEVER ||
- (clientConfig.followRedirects == FollowRedirectsPolicy::DEFAULT && clientConfig.region == Aws::Region::AWS_GLOBAL))
- {
- m_allowRedirects = false;
- }
- else
- {
- m_allowRedirects = true;
- }
+ if (clientConfig.followRedirects == FollowRedirectsPolicy::NEVER ||
+ (clientConfig.followRedirects == FollowRedirectsPolicy::DEFAULT && clientConfig.region == Aws::Region::AWS_GLOBAL))
+ {
+ m_allowRedirects = false;
+ }
+ else
+ {
+ m_allowRedirects = true;
+ }
}
-std::shared_ptr<HttpResponse> CurlHttpClient::MakeRequest(const std::shared_ptr<HttpRequest>& request,
- Aws::Utils::RateLimits::RateLimiterInterface* readLimiter,
- Aws::Utils::RateLimits::RateLimiterInterface* writeLimiter) const
+std::shared_ptr<HttpResponse> CurlHttpClient::MakeRequest(const std::shared_ptr<HttpRequest>& request,
+ Aws::Utils::RateLimits::RateLimiterInterface* readLimiter,
+ Aws::Utils::RateLimits::RateLimiterInterface* writeLimiter) const
{
- URI uri = request->GetUri();
+ URI uri = request->GetUri();
Aws::String url = uri.GetURIString();
- std::shared_ptr<HttpResponse> response = Aws::MakeShared<StandardHttpResponse>(CURL_HTTP_CLIENT_TAG, request);
+ std::shared_ptr<HttpResponse> response = Aws::MakeShared<StandardHttpResponse>(CURL_HTTP_CLIENT_TAG, request);
AWS_LOGSTREAM_TRACE(CURL_HTTP_CLIENT_TAG, "Making request to " << url);
struct curl_slist* headers = NULL;
if (writeLimiter != nullptr)
{
- writeLimiter->ApplyAndPayForCost(request->GetSize());
+ writeLimiter->ApplyAndPayForCost(request->GetSize());
}
Aws::StringStream headerStream;
- HeaderValueCollection requestHeaders = request->GetHeaders();
+ HeaderValueCollection requestHeaders = request->GetHeaders();
AWS_LOGSTREAM_TRACE(CURL_HTTP_CLIENT_TAG, "Including headers:");
for (auto& requestHeader : requestHeaders)
@@ -488,17 +488,17 @@ std::shared_ptr<HttpResponse> CurlHttpClient::MakeRequest(const std::shared_ptr<
headers = curl_slist_append(headers, headerString.c_str());
}
- if (!request->HasHeader(Http::TRANSFER_ENCODING_HEADER))
+ if (!request->HasHeader(Http::TRANSFER_ENCODING_HEADER))
+ {
+ headers = curl_slist_append(headers, "transfer-encoding:");
+ }
+
+ if (!request->HasHeader(Http::CONTENT_LENGTH_HEADER))
{
- headers = curl_slist_append(headers, "transfer-encoding:");
- }
-
- if (!request->HasHeader(Http::CONTENT_LENGTH_HEADER))
- {
headers = curl_slist_append(headers, "content-length:");
}
- if (!request->HasHeader(Http::CONTENT_TYPE_HEADER))
+ if (!request->HasHeader(Http::CONTENT_TYPE_HEADER))
{
headers = curl_slist_append(headers, "content-type:");
}
@@ -520,16 +520,16 @@ std::shared_ptr<HttpResponse> CurlHttpClient::MakeRequest(const std::shared_ptr<
curl_easy_setopt(connectionHandle, CURLOPT_HTTPHEADER, headers);
}
- CurlWriteCallbackContext writeContext(this, request.get(), response.get(), readLimiter);
- CurlReadCallbackContext readContext(this, request.get(), writeLimiter);
+ CurlWriteCallbackContext writeContext(this, request.get(), response.get(), readLimiter);
+ CurlReadCallbackContext readContext(this, request.get(), writeLimiter);
SetOptCodeForHttpMethod(connectionHandle, request);
curl_easy_setopt(connectionHandle, CURLOPT_URL, url.c_str());
- curl_easy_setopt(connectionHandle, CURLOPT_WRITEFUNCTION, WriteData);
+ curl_easy_setopt(connectionHandle, CURLOPT_WRITEFUNCTION, WriteData);
curl_easy_setopt(connectionHandle, CURLOPT_WRITEDATA, &writeContext);
- curl_easy_setopt(connectionHandle, CURLOPT_HEADERFUNCTION, WriteHeader);
- curl_easy_setopt(connectionHandle, CURLOPT_HEADERDATA, &writeContext);
+ curl_easy_setopt(connectionHandle, CURLOPT_HEADERFUNCTION, WriteHeader);
+ curl_easy_setopt(connectionHandle, CURLOPT_HEADERDATA, &writeContext);
//we only want to override the default path if someone has explicitly told us to.
if(!m_caPath.empty())
@@ -595,59 +595,59 @@ std::shared_ptr<HttpResponse> CurlHttpClient::MakeRequest(const std::shared_ptr<
curl_easy_setopt(connectionHandle, CURLOPT_PROXYUSERNAME, m_proxyUserName.c_str());
curl_easy_setopt(connectionHandle, CURLOPT_PROXYPASSWORD, m_proxyPassword.c_str());
}
-#ifdef CURL_HAS_TLS_PROXY
- if (!m_proxySSLCertPath.empty())
- {
- curl_easy_setopt(connectionHandle, CURLOPT_PROXY_SSLCERT, m_proxySSLCertPath.c_str());
- if (!m_proxySSLCertType.empty())
- {
- curl_easy_setopt(connectionHandle, CURLOPT_PROXY_SSLCERTTYPE, m_proxySSLCertType.c_str());
- }
- }
- if (!m_proxySSLKeyPath.empty())
- {
- curl_easy_setopt(connectionHandle, CURLOPT_PROXY_SSLKEY, m_proxySSLKeyPath.c_str());
- if (!m_proxySSLKeyType.empty())
- {
- curl_easy_setopt(connectionHandle, CURLOPT_PROXY_SSLKEYTYPE, m_proxySSLKeyType.c_str());
- }
- if (!m_proxyKeyPasswd.empty())
- {
- curl_easy_setopt(connectionHandle, CURLOPT_PROXY_KEYPASSWD, m_proxyKeyPasswd.c_str());
- }
- }
-#endif //CURL_HAS_TLS_PROXY
+#ifdef CURL_HAS_TLS_PROXY
+ if (!m_proxySSLCertPath.empty())
+ {
+ curl_easy_setopt(connectionHandle, CURLOPT_PROXY_SSLCERT, m_proxySSLCertPath.c_str());
+ if (!m_proxySSLCertType.empty())
+ {
+ curl_easy_setopt(connectionHandle, CURLOPT_PROXY_SSLCERTTYPE, m_proxySSLCertType.c_str());
+ }
+ }
+ if (!m_proxySSLKeyPath.empty())
+ {
+ curl_easy_setopt(connectionHandle, CURLOPT_PROXY_SSLKEY, m_proxySSLKeyPath.c_str());
+ if (!m_proxySSLKeyType.empty())
+ {
+ curl_easy_setopt(connectionHandle, CURLOPT_PROXY_SSLKEYTYPE, m_proxySSLKeyType.c_str());
+ }
+ if (!m_proxyKeyPasswd.empty())
+ {
+ curl_easy_setopt(connectionHandle, CURLOPT_PROXY_KEYPASSWD, m_proxyKeyPasswd.c_str());
+ }
+ }
+#endif //CURL_HAS_TLS_PROXY
}
else
{
curl_easy_setopt(connectionHandle, CURLOPT_PROXY, "");
}
- if (request->GetContentBody())
+ if (request->GetContentBody())
{
- curl_easy_setopt(connectionHandle, CURLOPT_READFUNCTION, ReadBody);
+ curl_easy_setopt(connectionHandle, CURLOPT_READFUNCTION, ReadBody);
curl_easy_setopt(connectionHandle, CURLOPT_READDATA, &readContext);
- curl_easy_setopt(connectionHandle, CURLOPT_SEEKFUNCTION, SeekBody);
+ curl_easy_setopt(connectionHandle, CURLOPT_SEEKFUNCTION, SeekBody);
curl_easy_setopt(connectionHandle, CURLOPT_SEEKDATA, &readContext);
}
-
- OverrideOptionsOnConnectionHandle(connectionHandle);
+
+ OverrideOptionsOnConnectionHandle(connectionHandle);
Aws::Utils::DateTime startTransmissionTime = Aws::Utils::DateTime::Now();
CURLcode curlResponseCode = curl_easy_perform(connectionHandle);
- bool shouldContinueRequest = ContinueRequest(*request);
+ bool shouldContinueRequest = ContinueRequest(*request);
if (curlResponseCode != CURLE_OK && shouldContinueRequest)
{
- response->SetClientErrorType(CoreErrors::NETWORK_CONNECTION);
- Aws::StringStream ss;
- ss << "curlCode: " << curlResponseCode << ", " << curl_easy_strerror(curlResponseCode);
- response->SetClientErrorMessage(ss.str());
- AWS_LOGSTREAM_ERROR(CURL_HTTP_CLIENT_TAG, "Curl returned error code " << curlResponseCode
- << " - " << curl_easy_strerror(curlResponseCode));
+ response->SetClientErrorType(CoreErrors::NETWORK_CONNECTION);
+ Aws::StringStream ss;
+ ss << "curlCode: " << curlResponseCode << ", " << curl_easy_strerror(curlResponseCode);
+ response->SetClientErrorMessage(ss.str());
+ AWS_LOGSTREAM_ERROR(CURL_HTTP_CLIENT_TAG, "Curl returned error code " << curlResponseCode
+ << " - " << curl_easy_strerror(curlResponseCode));
}
else if(!shouldContinueRequest)
{
- response->SetClientErrorType(CoreErrors::USER_CANCELLED);
- response->SetClientErrorMessage("Request cancelled by user's continuation handler");
+ response->SetClientErrorType(CoreErrors::USER_CANCELLED);
+ response->SetClientErrorMessage("Request cancelled by user's continuation handler");
}
else
{
@@ -664,7 +664,7 @@ std::shared_ptr<HttpResponse> CurlHttpClient::MakeRequest(const std::shared_ptr<
AWS_LOGSTREAM_DEBUG(CURL_HTTP_CLIENT_TAG, "Returned content type " << contentType);
}
- if (request->GetMethod() != HttpMethod::HTTP_HEAD &&
+ if (request->GetMethod() != HttpMethod::HTTP_HEAD &&
writeContext.m_client->IsRequestProcessingEnabled() &&
response->HasHeader(Aws::Http::CONTENT_LENGTH_HEADER))
{
@@ -674,8 +674,8 @@ std::shared_ptr<HttpResponse> CurlHttpClient::MakeRequest(const std::shared_ptr<
AWS_LOGSTREAM_TRACE(CURL_HTTP_CLIENT_TAG, "Response body length: " << numBytesResponseReceived);
if (StringUtils::ConvertToInt64(contentLength.c_str()) != numBytesResponseReceived)
{
- response->SetClientErrorType(CoreErrors::NETWORK_CONNECTION);
- response->SetClientErrorMessage("Response body length doesn't match the content-length header.");
+ response->SetClientErrorType(CoreErrors::NETWORK_CONNECTION);
+ response->SetClientErrorMessage("Response body length doesn't match the content-length header.");
AWS_LOGSTREAM_ERROR(CURL_HTTP_CLIENT_TAG, "Response body length doesn't match the content-length header.");
}
}
@@ -687,38 +687,38 @@ std::shared_ptr<HttpResponse> CurlHttpClient::MakeRequest(const std::shared_ptr<
CURLcode ret = curl_easy_getinfo(connectionHandle, CURLINFO_NAMELOOKUP_TIME, &timep); // DNS Resolve Latency, seconds.
if (ret == CURLE_OK)
{
- request->AddRequestMetric(GetHttpClientMetricNameByType(HttpClientMetricsType::DnsLatency), static_cast<int64_t>(timep * 1000));// to milliseconds
+ request->AddRequestMetric(GetHttpClientMetricNameByType(HttpClientMetricsType::DnsLatency), static_cast<int64_t>(timep * 1000));// to milliseconds
}
- ret = curl_easy_getinfo(connectionHandle, CURLINFO_STARTTRANSFER_TIME, &timep); // Connect Latency
+ ret = curl_easy_getinfo(connectionHandle, CURLINFO_STARTTRANSFER_TIME, &timep); // Connect Latency
if (ret == CURLE_OK)
{
- request->AddRequestMetric(GetHttpClientMetricNameByType(HttpClientMetricsType::ConnectLatency), static_cast<int64_t>(timep * 1000));
+ request->AddRequestMetric(GetHttpClientMetricNameByType(HttpClientMetricsType::ConnectLatency), static_cast<int64_t>(timep * 1000));
}
ret = curl_easy_getinfo(connectionHandle, CURLINFO_APPCONNECT_TIME, &timep); // Ssl Latency
if (ret == CURLE_OK)
{
- request->AddRequestMetric(GetHttpClientMetricNameByType(HttpClientMetricsType::SslLatency), static_cast<int64_t>(timep * 1000));
+ request->AddRequestMetric(GetHttpClientMetricNameByType(HttpClientMetricsType::SslLatency), static_cast<int64_t>(timep * 1000));
}
const char* ip = nullptr;
auto curlGetInfoResult = curl_easy_getinfo(connectionHandle, CURLINFO_PRIMARY_IP, &ip); // Get the IP address of the remote endpoint
if (curlGetInfoResult == CURLE_OK && ip)
{
- request->SetResolvedRemoteHost(ip);
+ request->SetResolvedRemoteHost(ip);
}
- if (curlResponseCode != CURLE_OK)
+ if (curlResponseCode != CURLE_OK)
+ {
+ m_curlHandleContainer.DestroyCurlHandle(connectionHandle);
+ }
+ else
{
- m_curlHandleContainer.DestroyCurlHandle(connectionHandle);
+ m_curlHandleContainer.ReleaseCurlHandle(connectionHandle);
}
- else
- {
- m_curlHandleContainer.ReleaseCurlHandle(connectionHandle);
- }
- //go ahead and flush the response body stream
- response->GetResponseBody().flush();
- request->AddRequestMetric(GetHttpClientMetricNameByType(HttpClientMetricsType::RequestLatency), (DateTime::Now() - startTransmissionTime).count());
+ //go ahead and flush the response body stream
+ response->GetResponseBody().flush();
+ request->AddRequestMetric(GetHttpClientMetricNameByType(HttpClientMetricsType::RequestLatency), (DateTime::Now() - startTransmissionTime).count());
}
if (headers)
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/http/standard/StandardHttpRequest.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/http/standard/StandardHttpRequest.cpp
index cfc3bc57c8a..47a0ee4faca 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/http/standard/StandardHttpRequest.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/http/standard/StandardHttpRequest.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/http/standard/StandardHttpRequest.h>
@@ -35,13 +35,13 @@ StandardHttpRequest::StandardHttpRequest(const URI& uri, HttpMethod method) :
{
if(IsDefaultPort(uri))
{
- StandardHttpRequest::SetHeaderValue(HOST_HEADER, uri.GetAuthority());
+ StandardHttpRequest::SetHeaderValue(HOST_HEADER, uri.GetAuthority());
}
else
{
Aws::StringStream host;
host << uri.GetAuthority() << ":" << uri.GetPort();
- StandardHttpRequest::SetHeaderValue(HOST_HEADER, host.str());
+ StandardHttpRequest::SetHeaderValue(HOST_HEADER, host.str());
}
}
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/http/standard/StandardHttpResponse.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/http/standard/StandardHttpResponse.cpp
index f7d84d98882..92d7a062b6c 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/http/standard/StandardHttpResponse.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/http/standard/StandardHttpResponse.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/http/standard/StandardHttpResponse.h>
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/internal/AWSHttpResourceClient.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/internal/AWSHttpResourceClient.cpp
index 7dd2bd53ad2..24145e4d92d 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/internal/AWSHttpResourceClient.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/internal/AWSHttpResourceClient.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/internal/AWSHttpResourceClient.h>
#include <aws/core/client/DefaultRetryStrategy.h>
@@ -10,31 +10,31 @@
#include <aws/core/http/HttpResponse.h>
#include <aws/core/utils/logging/LogMacros.h>
#include <aws/core/utils/StringUtils.h>
-#include <aws/core/utils/HashingUtils.h>
+#include <aws/core/utils/HashingUtils.h>
#include <aws/core/platform/Environment.h>
#include <aws/core/client/AWSError.h>
#include <aws/core/client/CoreErrors.h>
-#include <aws/core/utils/xml/XmlSerializer.h>
-#include <mutex>
+#include <aws/core/utils/xml/XmlSerializer.h>
+#include <mutex>
#include <sstream>
-using namespace Aws;
+using namespace Aws;
using namespace Aws::Utils;
using namespace Aws::Utils::Logging;
-using namespace Aws::Utils::Xml;
+using namespace Aws::Utils::Xml;
using namespace Aws::Http;
using namespace Aws::Client;
using namespace Aws::Internal;
-static const char EC2_SECURITY_CREDENTIALS_RESOURCE[] = "/latest/meta-data/iam/security-credentials";
-static const char EC2_REGION_RESOURCE[] = "/latest/meta-data/placement/availability-zone";
-static const char EC2_IMDS_TOKEN_RESOURCE[] = "/latest/api/token";
-static const char EC2_IMDS_TOKEN_TTL_DEFAULT_VALUE[] = "21600";
-static const char EC2_IMDS_TOKEN_TTL_HEADER[] = "x-aws-ec2-metadata-token-ttl-seconds";
-static const char EC2_IMDS_TOKEN_HEADER[] = "x-aws-ec2-metadata-token";
-static const char RESOURCE_CLIENT_CONFIGURATION_ALLOCATION_TAG[] = "AWSHttpResourceClient";
-static const char EC2_METADATA_CLIENT_LOG_TAG[] = "EC2MetadataClient";
-static const char ECS_CREDENTIALS_CLIENT_LOG_TAG[] = "ECSCredentialsClient";
+static const char EC2_SECURITY_CREDENTIALS_RESOURCE[] = "/latest/meta-data/iam/security-credentials";
+static const char EC2_REGION_RESOURCE[] = "/latest/meta-data/placement/availability-zone";
+static const char EC2_IMDS_TOKEN_RESOURCE[] = "/latest/api/token";
+static const char EC2_IMDS_TOKEN_TTL_DEFAULT_VALUE[] = "21600";
+static const char EC2_IMDS_TOKEN_TTL_HEADER[] = "x-aws-ec2-metadata-token-ttl-seconds";
+static const char EC2_IMDS_TOKEN_HEADER[] = "x-aws-ec2-metadata-token";
+static const char RESOURCE_CLIENT_CONFIGURATION_ALLOCATION_TAG[] = "AWSHttpResourceClient";
+static const char EC2_METADATA_CLIENT_LOG_TAG[] = "EC2MetadataClient";
+static const char ECS_CREDENTIALS_CLIENT_LOG_TAG[] = "ECSCredentialsClient";
namespace Aws
{
@@ -43,464 +43,464 @@ namespace Aws
Aws::String ComputeUserAgentString();
}
- namespace Internal
- {
- static ClientConfiguration MakeDefaultHttpResourceClientConfiguration(const char *logtag)
- {
- ClientConfiguration res;
-
- res.maxConnections = 2;
- res.scheme = Scheme::HTTP;
-
- #if defined(WIN32) && defined(BYPASS_DEFAULT_PROXY)
- // For security reasons, we must bypass any proxy settings when fetching sensitive information, for example
- // user credentials. On Windows, IXMLHttpRequest2 does not support bypassing proxy settings, therefore,
- // we force using WinHTTP client. On POSIX systems, CURL is set to bypass proxy settings by default.
- res.httpLibOverride = TransferLibType::WIN_HTTP_CLIENT;
- AWS_LOGSTREAM_INFO(logtag, "Overriding the current HTTP client to WinHTTP to bypass proxy settings.");
- #else
- (void) logtag; // To disable warning about unused variable
- #endif
- // Explicitly set the proxy settings to empty/zero to avoid relying on defaults that could potentially change
- // in the future.
- res.proxyHost = "";
- res.proxyUserName = "";
- res.proxyPassword = "";
- res.proxyPort = 0;
-
- // EC2MetadataService throttles by delaying the response so the service client should set a large read timeout.
- // EC2MetadataService delay is in order of seconds so it only make sense to retry after a couple of seconds.
- res.connectTimeoutMs = 1000;
- res.requestTimeoutMs = 1000;
- res.retryStrategy = Aws::MakeShared<DefaultRetryStrategy>(RESOURCE_CLIENT_CONFIGURATION_ALLOCATION_TAG, 1, 1000);
-
- return res;
- }
-
- AWSHttpResourceClient::AWSHttpResourceClient(const Aws::Client::ClientConfiguration& clientConfiguration, const char* logtag)
- : m_logtag(logtag), m_retryStrategy(clientConfiguration.retryStrategy), m_httpClient(nullptr)
- {
- AWS_LOGSTREAM_INFO(m_logtag.c_str(),
- "Creating AWSHttpResourceClient with max connections "
- << clientConfiguration.maxConnections
- << " and scheme "
- << SchemeMapper::ToString(clientConfiguration.scheme));
-
- m_httpClient = CreateHttpClient(clientConfiguration);
- }
-
- AWSHttpResourceClient::AWSHttpResourceClient(const char* logtag)
- : AWSHttpResourceClient(MakeDefaultHttpResourceClientConfiguration(logtag), logtag)
- {
- }
-
- AWSHttpResourceClient::~AWSHttpResourceClient()
- {
- }
-
- Aws::String AWSHttpResourceClient::GetResource(const char* endpoint, const char* resource, const char* authToken) const
- {
- return GetResourceWithAWSWebServiceResult(endpoint, resource, authToken).GetPayload();
- }
-
- AmazonWebServiceResult<Aws::String> AWSHttpResourceClient::GetResourceWithAWSWebServiceResult(const char *endpoint, const char *resource, const char *authToken) const
- {
- Aws::StringStream ss;
- ss << endpoint;
- if (resource)
- {
- ss << resource;
- }
- std::shared_ptr<HttpRequest> request(CreateHttpRequest(ss.str(), HttpMethod::HTTP_GET,
- Aws::Utils::Stream::DefaultResponseStreamFactoryMethod));
-
- request->SetUserAgent(ComputeUserAgentString());
-
- if (authToken)
- {
- request->SetHeaderValue(Aws::Http::AWS_AUTHORIZATION_HEADER, authToken);
- }
-
- return GetResourceWithAWSWebServiceResult(request);
- }
-
- AmazonWebServiceResult<Aws::String> AWSHttpResourceClient::GetResourceWithAWSWebServiceResult(const std::shared_ptr<HttpRequest> &httpRequest) const
+ namespace Internal
+ {
+ static ClientConfiguration MakeDefaultHttpResourceClientConfiguration(const char *logtag)
+ {
+ ClientConfiguration res;
+
+ res.maxConnections = 2;
+ res.scheme = Scheme::HTTP;
+
+ #if defined(WIN32) && defined(BYPASS_DEFAULT_PROXY)
+ // For security reasons, we must bypass any proxy settings when fetching sensitive information, for example
+ // user credentials. On Windows, IXMLHttpRequest2 does not support bypassing proxy settings, therefore,
+ // we force using WinHTTP client. On POSIX systems, CURL is set to bypass proxy settings by default.
+ res.httpLibOverride = TransferLibType::WIN_HTTP_CLIENT;
+ AWS_LOGSTREAM_INFO(logtag, "Overriding the current HTTP client to WinHTTP to bypass proxy settings.");
+ #else
+ (void) logtag; // To disable warning about unused variable
+ #endif
+ // Explicitly set the proxy settings to empty/zero to avoid relying on defaults that could potentially change
+ // in the future.
+ res.proxyHost = "";
+ res.proxyUserName = "";
+ res.proxyPassword = "";
+ res.proxyPort = 0;
+
+ // EC2MetadataService throttles by delaying the response so the service client should set a large read timeout.
+ // EC2MetadataService delay is in order of seconds so it only make sense to retry after a couple of seconds.
+ res.connectTimeoutMs = 1000;
+ res.requestTimeoutMs = 1000;
+ res.retryStrategy = Aws::MakeShared<DefaultRetryStrategy>(RESOURCE_CLIENT_CONFIGURATION_ALLOCATION_TAG, 1, 1000);
+
+ return res;
+ }
+
+ AWSHttpResourceClient::AWSHttpResourceClient(const Aws::Client::ClientConfiguration& clientConfiguration, const char* logtag)
+ : m_logtag(logtag), m_retryStrategy(clientConfiguration.retryStrategy), m_httpClient(nullptr)
+ {
+ AWS_LOGSTREAM_INFO(m_logtag.c_str(),
+ "Creating AWSHttpResourceClient with max connections "
+ << clientConfiguration.maxConnections
+ << " and scheme "
+ << SchemeMapper::ToString(clientConfiguration.scheme));
+
+ m_httpClient = CreateHttpClient(clientConfiguration);
+ }
+
+ AWSHttpResourceClient::AWSHttpResourceClient(const char* logtag)
+ : AWSHttpResourceClient(MakeDefaultHttpResourceClientConfiguration(logtag), logtag)
+ {
+ }
+
+ AWSHttpResourceClient::~AWSHttpResourceClient()
+ {
+ }
+
+ Aws::String AWSHttpResourceClient::GetResource(const char* endpoint, const char* resource, const char* authToken) const
+ {
+ return GetResourceWithAWSWebServiceResult(endpoint, resource, authToken).GetPayload();
+ }
+
+ AmazonWebServiceResult<Aws::String> AWSHttpResourceClient::GetResourceWithAWSWebServiceResult(const char *endpoint, const char *resource, const char *authToken) const
{
- AWS_LOGSTREAM_TRACE(m_logtag.c_str(), "Retrieving credentials from " << httpRequest->GetURIString());
-
- for (long retries = 0;; retries++)
- {
- std::shared_ptr<HttpResponse> response(m_httpClient->MakeRequest(httpRequest));
-
- if (response->GetResponseCode() == HttpResponseCode::OK)
- {
- Aws::IStreamBufIterator eos;
- return {Aws::String(Aws::IStreamBufIterator(response->GetResponseBody()), eos), response->GetHeaders(), HttpResponseCode::OK};
- }
-
- const Aws::Client::AWSError<Aws::Client::CoreErrors> error = [this, &response]() {
- if (response->HasClientError() || response->GetResponseBody().tellp() < 1)
- {
- AWS_LOGSTREAM_ERROR(m_logtag.c_str(), "Http request to retrieve credentials failed");
- return AWSError<CoreErrors>(CoreErrors::NETWORK_CONNECTION, true); // Retryable
- }
- else if (m_errorMarshaller)
- {
- return m_errorMarshaller->Marshall(*response);
- }
- else
- {
- const auto responseCode = response->GetResponseCode();
-
- AWS_LOGSTREAM_ERROR(m_logtag.c_str(), "Http request to retrieve credentials failed with error code "
- << static_cast<int>(responseCode));
- return CoreErrorsMapper::GetErrorForHttpResponseCode(responseCode);
- }
- }();
-
- if (!m_retryStrategy->ShouldRetry(error, retries))
- {
- AWS_LOGSTREAM_ERROR(m_logtag.c_str(), "Can not retrive resource from " << httpRequest->GetURIString());
- return {{}, response->GetHeaders(), error.GetResponseCode()};
- }
- auto sleepMillis = m_retryStrategy->CalculateDelayBeforeNextRetry(error, retries);
- AWS_LOGSTREAM_WARN(m_logtag.c_str(), "Request failed, now waiting " << sleepMillis << " ms before attempting again.");
- m_httpClient->RetryRequestSleep(std::chrono::milliseconds(sleepMillis));
- }
+ Aws::StringStream ss;
+ ss << endpoint;
+ if (resource)
+ {
+ ss << resource;
+ }
+ std::shared_ptr<HttpRequest> request(CreateHttpRequest(ss.str(), HttpMethod::HTTP_GET,
+ Aws::Utils::Stream::DefaultResponseStreamFactoryMethod));
+
+ request->SetUserAgent(ComputeUserAgentString());
+
+ if (authToken)
+ {
+ request->SetHeaderValue(Aws::Http::AWS_AUTHORIZATION_HEADER, authToken);
+ }
+
+ return GetResourceWithAWSWebServiceResult(request);
+ }
+
+ AmazonWebServiceResult<Aws::String> AWSHttpResourceClient::GetResourceWithAWSWebServiceResult(const std::shared_ptr<HttpRequest> &httpRequest) const
+ {
+ AWS_LOGSTREAM_TRACE(m_logtag.c_str(), "Retrieving credentials from " << httpRequest->GetURIString());
+
+ for (long retries = 0;; retries++)
+ {
+ std::shared_ptr<HttpResponse> response(m_httpClient->MakeRequest(httpRequest));
+
+ if (response->GetResponseCode() == HttpResponseCode::OK)
+ {
+ Aws::IStreamBufIterator eos;
+ return {Aws::String(Aws::IStreamBufIterator(response->GetResponseBody()), eos), response->GetHeaders(), HttpResponseCode::OK};
+ }
+
+ const Aws::Client::AWSError<Aws::Client::CoreErrors> error = [this, &response]() {
+ if (response->HasClientError() || response->GetResponseBody().tellp() < 1)
+ {
+ AWS_LOGSTREAM_ERROR(m_logtag.c_str(), "Http request to retrieve credentials failed");
+ return AWSError<CoreErrors>(CoreErrors::NETWORK_CONNECTION, true); // Retryable
+ }
+ else if (m_errorMarshaller)
+ {
+ return m_errorMarshaller->Marshall(*response);
+ }
+ else
+ {
+ const auto responseCode = response->GetResponseCode();
+
+ AWS_LOGSTREAM_ERROR(m_logtag.c_str(), "Http request to retrieve credentials failed with error code "
+ << static_cast<int>(responseCode));
+ return CoreErrorsMapper::GetErrorForHttpResponseCode(responseCode);
+ }
+ }();
+
+ if (!m_retryStrategy->ShouldRetry(error, retries))
+ {
+ AWS_LOGSTREAM_ERROR(m_logtag.c_str(), "Can not retrive resource from " << httpRequest->GetURIString());
+ return {{}, response->GetHeaders(), error.GetResponseCode()};
+ }
+ auto sleepMillis = m_retryStrategy->CalculateDelayBeforeNextRetry(error, retries);
+ AWS_LOGSTREAM_WARN(m_logtag.c_str(), "Request failed, now waiting " << sleepMillis << " ms before attempting again.");
+ m_httpClient->RetryRequestSleep(std::chrono::milliseconds(sleepMillis));
+ }
+ }
+
+ EC2MetadataClient::EC2MetadataClient(const char* endpoint)
+ : AWSHttpResourceClient(EC2_METADATA_CLIENT_LOG_TAG), m_endpoint(endpoint), m_tokenRequired(true)
+ {
+ }
+
+ EC2MetadataClient::EC2MetadataClient(const Aws::Client::ClientConfiguration &clientConfiguration, const char *endpoint)
+ : AWSHttpResourceClient(clientConfiguration, EC2_METADATA_CLIENT_LOG_TAG), m_endpoint(endpoint), m_tokenRequired(true)
+ {
+ }
+
+ EC2MetadataClient::~EC2MetadataClient()
+ {
+
+ }
+
+ Aws::String EC2MetadataClient::GetResource(const char* resourcePath) const
+ {
+ return GetResource(m_endpoint.c_str(), resourcePath, nullptr/*authToken*/);
+ }
+
+ Aws::String EC2MetadataClient::GetDefaultCredentials() const
+ {
+ std::unique_lock<std::recursive_mutex> locker(m_tokenMutex);
+ if (m_tokenRequired)
+ {
+ return GetDefaultCredentialsSecurely();
+ }
+
+ AWS_LOGSTREAM_TRACE(m_logtag.c_str(), "Getting default credentials for ec2 instance");
+ auto result = GetResourceWithAWSWebServiceResult(m_endpoint.c_str(), EC2_SECURITY_CREDENTIALS_RESOURCE, nullptr);
+ Aws::String credentialsString = result.GetPayload();
+ auto httpResponseCode = result.GetResponseCode();
+
+ // Note, if service is insane, it might return 404 for our initial secure call,
+ // then when we fall back to insecure call, it might return 401 ask for secure call,
+ // Then, SDK might get into a recursive loop call situation between secure and insecure call.
+ if (httpResponseCode == Http::HttpResponseCode::UNAUTHORIZED)
+ {
+ m_tokenRequired = true;
+ return {};
+ }
+ locker.unlock();
+
+ Aws::String trimmedCredentialsString = StringUtils::Trim(credentialsString.c_str());
+ if (trimmedCredentialsString.empty()) return {};
+
+ Aws::Vector<Aws::String> securityCredentials = StringUtils::Split(trimmedCredentialsString, '\n');
+
+ AWS_LOGSTREAM_DEBUG(m_logtag.c_str(), "Calling EC2MetadataService resource, " << EC2_SECURITY_CREDENTIALS_RESOURCE
+ << " returned credential string " << trimmedCredentialsString);
+
+ if (securityCredentials.size() == 0)
+ {
+ AWS_LOGSTREAM_WARN(m_logtag.c_str(), "Initial call to ec2Metadataservice to get credentials failed");
+ return {};
+ }
+
+ Aws::StringStream ss;
+ ss << EC2_SECURITY_CREDENTIALS_RESOURCE << "/" << securityCredentials[0];
+ AWS_LOGSTREAM_DEBUG(m_logtag.c_str(), "Calling EC2MetadataService resource " << ss.str());
+ return GetResource(ss.str().c_str());
}
- EC2MetadataClient::EC2MetadataClient(const char* endpoint)
- : AWSHttpResourceClient(EC2_METADATA_CLIENT_LOG_TAG), m_endpoint(endpoint), m_tokenRequired(true)
- {
- }
+ Aws::String EC2MetadataClient::GetDefaultCredentialsSecurely() const
+ {
+ std::unique_lock<std::recursive_mutex> locker(m_tokenMutex);
+ if (!m_tokenRequired)
+ {
+ return GetDefaultCredentials();
+ }
- EC2MetadataClient::EC2MetadataClient(const Aws::Client::ClientConfiguration &clientConfiguration, const char *endpoint)
- : AWSHttpResourceClient(clientConfiguration, EC2_METADATA_CLIENT_LOG_TAG), m_endpoint(endpoint), m_tokenRequired(true)
+ Aws::StringStream ss;
+ ss << m_endpoint << EC2_IMDS_TOKEN_RESOURCE;
+ std::shared_ptr<HttpRequest> tokenRequest(CreateHttpRequest(ss.str(), HttpMethod::HTTP_PUT,
+ Aws::Utils::Stream::DefaultResponseStreamFactoryMethod));
+ tokenRequest->SetHeaderValue(EC2_IMDS_TOKEN_TTL_HEADER, EC2_IMDS_TOKEN_TTL_DEFAULT_VALUE);
+ auto userAgentString = ComputeUserAgentString();
+ tokenRequest->SetUserAgent(userAgentString);
+ AWS_LOGSTREAM_TRACE(m_logtag.c_str(), "Calling EC2MetadataService to get token");
+ auto result = GetResourceWithAWSWebServiceResult(tokenRequest);
+ Aws::String tokenString = result.GetPayload();
+ Aws::String trimmedTokenString = StringUtils::Trim(tokenString.c_str());
+
+ if (result.GetResponseCode() == HttpResponseCode::BAD_REQUEST)
+ {
+ return {};
+ }
+ else if (result.GetResponseCode() != HttpResponseCode::OK || trimmedTokenString.empty())
+ {
+ m_tokenRequired = false;
+ AWS_LOGSTREAM_TRACE(m_logtag.c_str(), "Calling EC2MetadataService to get token failed, falling back to less secure way.");
+ return GetDefaultCredentials();
+ }
+ m_token = trimmedTokenString;
+ locker.unlock();
+ ss.str("");
+ ss << m_endpoint << EC2_SECURITY_CREDENTIALS_RESOURCE;
+ std::shared_ptr<HttpRequest> profileRequest(CreateHttpRequest(ss.str(), HttpMethod::HTTP_GET,
+ Aws::Utils::Stream::DefaultResponseStreamFactoryMethod));
+ profileRequest->SetHeaderValue(EC2_IMDS_TOKEN_HEADER, trimmedTokenString);
+ profileRequest->SetUserAgent(userAgentString);
+ Aws::String profileString = GetResourceWithAWSWebServiceResult(profileRequest).GetPayload();
+
+ Aws::String trimmedProfileString = StringUtils::Trim(profileString.c_str());
+ Aws::Vector<Aws::String> securityCredentials = StringUtils::Split(trimmedProfileString, '\n');
+
+ AWS_LOGSTREAM_DEBUG(m_logtag.c_str(), "Calling EC2MetadataService resource, " << EC2_SECURITY_CREDENTIALS_RESOURCE
+ << " with token returned profile string " << trimmedProfileString);
+ if (securityCredentials.size() == 0)
+ {
+ AWS_LOGSTREAM_WARN(m_logtag.c_str(), "Calling EC2Metadataservice to get profiles failed");
+ return {};
+ }
+
+ ss.str("");
+ ss << m_endpoint << EC2_SECURITY_CREDENTIALS_RESOURCE << "/" << securityCredentials[0];
+ std::shared_ptr<HttpRequest> credentialsRequest(CreateHttpRequest(ss.str(), HttpMethod::HTTP_GET,
+ Aws::Utils::Stream::DefaultResponseStreamFactoryMethod));
+ credentialsRequest->SetHeaderValue(EC2_IMDS_TOKEN_HEADER, trimmedTokenString);
+ credentialsRequest->SetUserAgent(userAgentString);
+ AWS_LOGSTREAM_DEBUG(m_logtag.c_str(), "Calling EC2MetadataService resource " << ss.str() << " with token.");
+ return GetResourceWithAWSWebServiceResult(credentialsRequest).GetPayload();
+ }
+
+ Aws::String EC2MetadataClient::GetCurrentRegion() const
{
+ if (!m_region.empty())
+ {
+ return m_region;
+ }
+
+ AWS_LOGSTREAM_TRACE(m_logtag.c_str(), "Getting current region for ec2 instance");
+
+ Aws::StringStream ss;
+ ss << m_endpoint << EC2_REGION_RESOURCE;
+ std::shared_ptr<HttpRequest> regionRequest(CreateHttpRequest(ss.str(), HttpMethod::HTTP_GET,
+ Aws::Utils::Stream::DefaultResponseStreamFactoryMethod));
+ {
+ std::lock_guard<std::recursive_mutex> locker(m_tokenMutex);
+ if (m_tokenRequired)
+ {
+ regionRequest->SetHeaderValue(EC2_IMDS_TOKEN_HEADER, m_token);
+ }
+ }
+ regionRequest->SetUserAgent(ComputeUserAgentString());
+ Aws::String azString = GetResourceWithAWSWebServiceResult(regionRequest).GetPayload();
+
+ if (azString.empty())
+ {
+ AWS_LOGSTREAM_INFO(m_logtag.c_str() ,
+ "Unable to pull region from instance metadata service ");
+ return {};
+ }
+
+ Aws::String trimmedAZString = StringUtils::Trim(azString.c_str());
+ AWS_LOGSTREAM_DEBUG(m_logtag.c_str(), "Calling EC2MetadataService resource "
+ << EC2_REGION_RESOURCE << " , returned credential string " << trimmedAZString);
+
+ Aws::String region;
+ region.reserve(trimmedAZString.length());
+
+ bool digitFound = false;
+ for (auto character : trimmedAZString)
+ {
+ if(digitFound && !isdigit(character))
+ {
+ break;
+ }
+ if (isdigit(character))
+ {
+ digitFound = true;
+ }
+
+ region.append(1, character);
+ }
+
+ AWS_LOGSTREAM_INFO(m_logtag.c_str(), "Detected current region as " << region);
+ m_region = region;
+ return region;
}
- EC2MetadataClient::~EC2MetadataClient()
- {
-
- }
-
- Aws::String EC2MetadataClient::GetResource(const char* resourcePath) const
- {
- return GetResource(m_endpoint.c_str(), resourcePath, nullptr/*authToken*/);
- }
-
- Aws::String EC2MetadataClient::GetDefaultCredentials() const
- {
- std::unique_lock<std::recursive_mutex> locker(m_tokenMutex);
- if (m_tokenRequired)
+ #ifdef _MSC_VER
+ // VS2015 compiler's bug, warning s_ec2metadataClient: symbol will be dynamically initialized (implementation limitation)
+ AWS_SUPPRESS_WARNING(4592,
+ static std::shared_ptr<EC2MetadataClient> s_ec2metadataClient(nullptr);
+ )
+ #else
+ static std::shared_ptr<EC2MetadataClient> s_ec2metadataClient(nullptr);
+ #endif
+
+ void InitEC2MetadataClient()
+ {
+ if (s_ec2metadataClient)
{
- return GetDefaultCredentialsSecurely();
+ return;
}
-
- AWS_LOGSTREAM_TRACE(m_logtag.c_str(), "Getting default credentials for ec2 instance");
- auto result = GetResourceWithAWSWebServiceResult(m_endpoint.c_str(), EC2_SECURITY_CREDENTIALS_RESOURCE, nullptr);
- Aws::String credentialsString = result.GetPayload();
- auto httpResponseCode = result.GetResponseCode();
-
- // Note, if service is insane, it might return 404 for our initial secure call,
- // then when we fall back to insecure call, it might return 401 ask for secure call,
- // Then, SDK might get into a recursive loop call situation between secure and insecure call.
- if (httpResponseCode == Http::HttpResponseCode::UNAUTHORIZED)
+ s_ec2metadataClient = Aws::MakeShared<EC2MetadataClient>(EC2_METADATA_CLIENT_LOG_TAG);
+ }
+
+ void CleanupEC2MetadataClient()
+ {
+ if (!s_ec2metadataClient)
{
- m_tokenRequired = true;
- return {};
- }
- locker.unlock();
-
- Aws::String trimmedCredentialsString = StringUtils::Trim(credentialsString.c_str());
- if (trimmedCredentialsString.empty()) return {};
-
- Aws::Vector<Aws::String> securityCredentials = StringUtils::Split(trimmedCredentialsString, '\n');
-
- AWS_LOGSTREAM_DEBUG(m_logtag.c_str(), "Calling EC2MetadataService resource, " << EC2_SECURITY_CREDENTIALS_RESOURCE
- << " returned credential string " << trimmedCredentialsString);
-
- if (securityCredentials.size() == 0)
- {
- AWS_LOGSTREAM_WARN(m_logtag.c_str(), "Initial call to ec2Metadataservice to get credentials failed");
- return {};
+ return;
}
+ s_ec2metadataClient = nullptr;
+ }
- Aws::StringStream ss;
- ss << EC2_SECURITY_CREDENTIALS_RESOURCE << "/" << securityCredentials[0];
- AWS_LOGSTREAM_DEBUG(m_logtag.c_str(), "Calling EC2MetadataService resource " << ss.str());
- return GetResource(ss.str().c_str());
- }
-
- Aws::String EC2MetadataClient::GetDefaultCredentialsSecurely() const
+ std::shared_ptr<EC2MetadataClient> GetEC2MetadataClient()
{
- std::unique_lock<std::recursive_mutex> locker(m_tokenMutex);
- if (!m_tokenRequired)
- {
- return GetDefaultCredentials();
- }
-
- Aws::StringStream ss;
- ss << m_endpoint << EC2_IMDS_TOKEN_RESOURCE;
- std::shared_ptr<HttpRequest> tokenRequest(CreateHttpRequest(ss.str(), HttpMethod::HTTP_PUT,
- Aws::Utils::Stream::DefaultResponseStreamFactoryMethod));
- tokenRequest->SetHeaderValue(EC2_IMDS_TOKEN_TTL_HEADER, EC2_IMDS_TOKEN_TTL_DEFAULT_VALUE);
- auto userAgentString = ComputeUserAgentString();
- tokenRequest->SetUserAgent(userAgentString);
- AWS_LOGSTREAM_TRACE(m_logtag.c_str(), "Calling EC2MetadataService to get token");
- auto result = GetResourceWithAWSWebServiceResult(tokenRequest);
- Aws::String tokenString = result.GetPayload();
- Aws::String trimmedTokenString = StringUtils::Trim(tokenString.c_str());
-
- if (result.GetResponseCode() == HttpResponseCode::BAD_REQUEST)
- {
- return {};
- }
- else if (result.GetResponseCode() != HttpResponseCode::OK || trimmedTokenString.empty())
- {
- m_tokenRequired = false;
- AWS_LOGSTREAM_TRACE(m_logtag.c_str(), "Calling EC2MetadataService to get token failed, falling back to less secure way.");
- return GetDefaultCredentials();
- }
- m_token = trimmedTokenString;
- locker.unlock();
- ss.str("");
- ss << m_endpoint << EC2_SECURITY_CREDENTIALS_RESOURCE;
- std::shared_ptr<HttpRequest> profileRequest(CreateHttpRequest(ss.str(), HttpMethod::HTTP_GET,
- Aws::Utils::Stream::DefaultResponseStreamFactoryMethod));
- profileRequest->SetHeaderValue(EC2_IMDS_TOKEN_HEADER, trimmedTokenString);
- profileRequest->SetUserAgent(userAgentString);
- Aws::String profileString = GetResourceWithAWSWebServiceResult(profileRequest).GetPayload();
-
- Aws::String trimmedProfileString = StringUtils::Trim(profileString.c_str());
- Aws::Vector<Aws::String> securityCredentials = StringUtils::Split(trimmedProfileString, '\n');
-
- AWS_LOGSTREAM_DEBUG(m_logtag.c_str(), "Calling EC2MetadataService resource, " << EC2_SECURITY_CREDENTIALS_RESOURCE
- << " with token returned profile string " << trimmedProfileString);
- if (securityCredentials.size() == 0)
- {
- AWS_LOGSTREAM_WARN(m_logtag.c_str(), "Calling EC2Metadataservice to get profiles failed");
- return {};
- }
-
- ss.str("");
- ss << m_endpoint << EC2_SECURITY_CREDENTIALS_RESOURCE << "/" << securityCredentials[0];
- std::shared_ptr<HttpRequest> credentialsRequest(CreateHttpRequest(ss.str(), HttpMethod::HTTP_GET,
- Aws::Utils::Stream::DefaultResponseStreamFactoryMethod));
- credentialsRequest->SetHeaderValue(EC2_IMDS_TOKEN_HEADER, trimmedTokenString);
- credentialsRequest->SetUserAgent(userAgentString);
- AWS_LOGSTREAM_DEBUG(m_logtag.c_str(), "Calling EC2MetadataService resource " << ss.str() << " with token.");
- return GetResourceWithAWSWebServiceResult(credentialsRequest).GetPayload();
+ return s_ec2metadataClient;
}
- Aws::String EC2MetadataClient::GetCurrentRegion() const
- {
- if (!m_region.empty())
- {
- return m_region;
- }
-
- AWS_LOGSTREAM_TRACE(m_logtag.c_str(), "Getting current region for ec2 instance");
-
- Aws::StringStream ss;
- ss << m_endpoint << EC2_REGION_RESOURCE;
- std::shared_ptr<HttpRequest> regionRequest(CreateHttpRequest(ss.str(), HttpMethod::HTTP_GET,
- Aws::Utils::Stream::DefaultResponseStreamFactoryMethod));
- {
- std::lock_guard<std::recursive_mutex> locker(m_tokenMutex);
- if (m_tokenRequired)
- {
- regionRequest->SetHeaderValue(EC2_IMDS_TOKEN_HEADER, m_token);
- }
- }
- regionRequest->SetUserAgent(ComputeUserAgentString());
- Aws::String azString = GetResourceWithAWSWebServiceResult(regionRequest).GetPayload();
-
- if (azString.empty())
- {
- AWS_LOGSTREAM_INFO(m_logtag.c_str() ,
- "Unable to pull region from instance metadata service ");
- return {};
- }
-
- Aws::String trimmedAZString = StringUtils::Trim(azString.c_str());
- AWS_LOGSTREAM_DEBUG(m_logtag.c_str(), "Calling EC2MetadataService resource "
- << EC2_REGION_RESOURCE << " , returned credential string " << trimmedAZString);
-
- Aws::String region;
- region.reserve(trimmedAZString.length());
-
- bool digitFound = false;
- for (auto character : trimmedAZString)
- {
- if(digitFound && !isdigit(character))
- {
- break;
- }
- if (isdigit(character))
- {
- digitFound = true;
- }
-
- region.append(1, character);
- }
-
- AWS_LOGSTREAM_INFO(m_logtag.c_str(), "Detected current region as " << region);
- m_region = region;
- return region;
- }
-
- #ifdef _MSC_VER
- // VS2015 compiler's bug, warning s_ec2metadataClient: symbol will be dynamically initialized (implementation limitation)
- AWS_SUPPRESS_WARNING(4592,
- static std::shared_ptr<EC2MetadataClient> s_ec2metadataClient(nullptr);
- )
- #else
- static std::shared_ptr<EC2MetadataClient> s_ec2metadataClient(nullptr);
- #endif
-
- void InitEC2MetadataClient()
- {
- if (s_ec2metadataClient)
- {
- return;
- }
- s_ec2metadataClient = Aws::MakeShared<EC2MetadataClient>(EC2_METADATA_CLIENT_LOG_TAG);
- }
-
- void CleanupEC2MetadataClient()
- {
- if (!s_ec2metadataClient)
- {
- return;
- }
- s_ec2metadataClient = nullptr;
- }
-
- std::shared_ptr<EC2MetadataClient> GetEC2MetadataClient()
- {
- return s_ec2metadataClient;
- }
-
-
- ECSCredentialsClient::ECSCredentialsClient(const char* resourcePath, const char* endpoint, const char* token)
- : AWSHttpResourceClient(ECS_CREDENTIALS_CLIENT_LOG_TAG),
- m_resourcePath(resourcePath), m_endpoint(endpoint), m_token(token)
+
+ ECSCredentialsClient::ECSCredentialsClient(const char* resourcePath, const char* endpoint, const char* token)
+ : AWSHttpResourceClient(ECS_CREDENTIALS_CLIENT_LOG_TAG),
+ m_resourcePath(resourcePath), m_endpoint(endpoint), m_token(token)
{
}
-
- ECSCredentialsClient::ECSCredentialsClient(const Aws::Client::ClientConfiguration& clientConfiguration, const char* resourcePath, const char* endpoint, const char* token)
- : AWSHttpResourceClient(clientConfiguration, ECS_CREDENTIALS_CLIENT_LOG_TAG),
- m_resourcePath(resourcePath), m_endpoint(endpoint), m_token(token)
+
+ ECSCredentialsClient::ECSCredentialsClient(const Aws::Client::ClientConfiguration& clientConfiguration, const char* resourcePath, const char* endpoint, const char* token)
+ : AWSHttpResourceClient(clientConfiguration, ECS_CREDENTIALS_CLIENT_LOG_TAG),
+ m_resourcePath(resourcePath), m_endpoint(endpoint), m_token(token)
{
}
- static const char STS_RESOURCE_CLIENT_LOG_TAG[] = "STSResourceClient";
- STSCredentialsClient::STSCredentialsClient(const Aws::Client::ClientConfiguration& clientConfiguration)
- : AWSHttpResourceClient(clientConfiguration, STS_RESOURCE_CLIENT_LOG_TAG)
- {
- SetErrorMarshaller(Aws::MakeUnique<Aws::Client::XmlErrorMarshaller>(STS_RESOURCE_CLIENT_LOG_TAG));
-
- Aws::StringStream ss;
- if (clientConfiguration.scheme == Aws::Http::Scheme::HTTP)
- {
- ss << "http://";
- }
- else
- {
- ss << "https://";
- }
-
- static const int CN_NORTH_1_HASH = Aws::Utils::HashingUtils::HashString(Aws::Region::CN_NORTH_1);
- static const int CN_NORTHWEST_1_HASH = Aws::Utils::HashingUtils::HashString(Aws::Region::CN_NORTHWEST_1);
- auto hash = Aws::Utils::HashingUtils::HashString(clientConfiguration.region.c_str());
-
- ss << "sts." << clientConfiguration.region << ".amazonaws.com";
- if (hash == CN_NORTH_1_HASH || hash == CN_NORTHWEST_1_HASH)
- {
- ss << ".cn";
- }
- m_endpoint = ss.str();
-
- AWS_LOGSTREAM_INFO(STS_RESOURCE_CLIENT_LOG_TAG, "Creating STS ResourceClient with endpoint: " << m_endpoint);
- }
-
- STSCredentialsClient::STSAssumeRoleWithWebIdentityResult STSCredentialsClient::GetAssumeRoleWithWebIdentityCredentials(const STSAssumeRoleWithWebIdentityRequest& request)
- {
- //Calculate query string
- Aws::StringStream ss;
- ss << "Action=AssumeRoleWithWebIdentity"
- << "&Version=2011-06-15"
- << "&RoleSessionName=" << Aws::Utils::StringUtils::URLEncode(request.roleSessionName.c_str())
- << "&RoleArn=" << Aws::Utils::StringUtils::URLEncode(request.roleArn.c_str())
- << "&WebIdentityToken=" << Aws::Utils::StringUtils::URLEncode(request.webIdentityToken.c_str());
-
- std::shared_ptr<HttpRequest> httpRequest(CreateHttpRequest(m_endpoint, HttpMethod::HTTP_POST,
- Aws::Utils::Stream::DefaultResponseStreamFactoryMethod));
-
- httpRequest->SetUserAgent(ComputeUserAgentString());
-
- std::shared_ptr<Aws::IOStream> body = Aws::MakeShared<Aws::StringStream>("STS_RESOURCE_CLIENT_LOG_TAG");
- *body << ss.str();
-
- httpRequest->AddContentBody(body);
- body->seekg(0, body->end);
- auto streamSize = body->tellg();
- body->seekg(0, body->beg);
- Aws::StringStream contentLength;
- contentLength << streamSize;
- httpRequest->SetContentLength(contentLength.str());
- httpRequest->SetContentType("application/x-www-form-urlencoded");
-
- Aws::String credentialsStr = GetResourceWithAWSWebServiceResult(httpRequest).GetPayload();
-
- //Parse credentials
- STSAssumeRoleWithWebIdentityResult result;
- if (credentialsStr.empty())
- {
- AWS_LOGSTREAM_WARN(STS_RESOURCE_CLIENT_LOG_TAG, "Get an empty credential from sts");
- return result;
- }
-
- const Utils::Xml::XmlDocument xmlDocument = XmlDocument::CreateFromXmlString(credentialsStr);
- XmlNode rootNode = xmlDocument.GetRootElement();
- XmlNode resultNode = rootNode;
- if (!rootNode.IsNull() && (rootNode.GetName() != "AssumeRoleWithWebIdentityResult"))
- {
- resultNode = rootNode.FirstChild("AssumeRoleWithWebIdentityResult");
- }
-
- if (!resultNode.IsNull())
- {
- XmlNode credentialsNode = resultNode.FirstChild("Credentials");
- if (!credentialsNode.IsNull())
- {
- XmlNode accessKeyIdNode = credentialsNode.FirstChild("AccessKeyId");
- if (!accessKeyIdNode.IsNull())
- {
- result.creds.SetAWSAccessKeyId(accessKeyIdNode.GetText());
- }
-
- XmlNode secretAccessKeyNode = credentialsNode.FirstChild("SecretAccessKey");
- if (!secretAccessKeyNode.IsNull())
- {
- result.creds.SetAWSSecretKey(secretAccessKeyNode.GetText());
- }
-
- XmlNode sessionTokenNode = credentialsNode.FirstChild("SessionToken");
- if (!sessionTokenNode.IsNull())
- {
- result.creds.SetSessionToken(sessionTokenNode.GetText());
- }
-
- XmlNode expirationNode = credentialsNode.FirstChild("Expiration");
- if (!expirationNode.IsNull())
- {
- result.creds.SetExpiration(DateTime(StringUtils::Trim(expirationNode.GetText().c_str()).c_str(), DateFormat::ISO_8601));
- }
- }
- }
- return result;
- }
- }
+ static const char STS_RESOURCE_CLIENT_LOG_TAG[] = "STSResourceClient";
+ STSCredentialsClient::STSCredentialsClient(const Aws::Client::ClientConfiguration& clientConfiguration)
+ : AWSHttpResourceClient(clientConfiguration, STS_RESOURCE_CLIENT_LOG_TAG)
+ {
+ SetErrorMarshaller(Aws::MakeUnique<Aws::Client::XmlErrorMarshaller>(STS_RESOURCE_CLIENT_LOG_TAG));
+
+ Aws::StringStream ss;
+ if (clientConfiguration.scheme == Aws::Http::Scheme::HTTP)
+ {
+ ss << "http://";
+ }
+ else
+ {
+ ss << "https://";
+ }
+
+ static const int CN_NORTH_1_HASH = Aws::Utils::HashingUtils::HashString(Aws::Region::CN_NORTH_1);
+ static const int CN_NORTHWEST_1_HASH = Aws::Utils::HashingUtils::HashString(Aws::Region::CN_NORTHWEST_1);
+ auto hash = Aws::Utils::HashingUtils::HashString(clientConfiguration.region.c_str());
+
+ ss << "sts." << clientConfiguration.region << ".amazonaws.com";
+ if (hash == CN_NORTH_1_HASH || hash == CN_NORTHWEST_1_HASH)
+ {
+ ss << ".cn";
+ }
+ m_endpoint = ss.str();
+
+ AWS_LOGSTREAM_INFO(STS_RESOURCE_CLIENT_LOG_TAG, "Creating STS ResourceClient with endpoint: " << m_endpoint);
+ }
+
+ STSCredentialsClient::STSAssumeRoleWithWebIdentityResult STSCredentialsClient::GetAssumeRoleWithWebIdentityCredentials(const STSAssumeRoleWithWebIdentityRequest& request)
+ {
+ //Calculate query string
+ Aws::StringStream ss;
+ ss << "Action=AssumeRoleWithWebIdentity"
+ << "&Version=2011-06-15"
+ << "&RoleSessionName=" << Aws::Utils::StringUtils::URLEncode(request.roleSessionName.c_str())
+ << "&RoleArn=" << Aws::Utils::StringUtils::URLEncode(request.roleArn.c_str())
+ << "&WebIdentityToken=" << Aws::Utils::StringUtils::URLEncode(request.webIdentityToken.c_str());
+
+ std::shared_ptr<HttpRequest> httpRequest(CreateHttpRequest(m_endpoint, HttpMethod::HTTP_POST,
+ Aws::Utils::Stream::DefaultResponseStreamFactoryMethod));
+
+ httpRequest->SetUserAgent(ComputeUserAgentString());
+
+ std::shared_ptr<Aws::IOStream> body = Aws::MakeShared<Aws::StringStream>("STS_RESOURCE_CLIENT_LOG_TAG");
+ *body << ss.str();
+
+ httpRequest->AddContentBody(body);
+ body->seekg(0, body->end);
+ auto streamSize = body->tellg();
+ body->seekg(0, body->beg);
+ Aws::StringStream contentLength;
+ contentLength << streamSize;
+ httpRequest->SetContentLength(contentLength.str());
+ httpRequest->SetContentType("application/x-www-form-urlencoded");
+
+ Aws::String credentialsStr = GetResourceWithAWSWebServiceResult(httpRequest).GetPayload();
+
+ //Parse credentials
+ STSAssumeRoleWithWebIdentityResult result;
+ if (credentialsStr.empty())
+ {
+ AWS_LOGSTREAM_WARN(STS_RESOURCE_CLIENT_LOG_TAG, "Get an empty credential from sts");
+ return result;
+ }
+
+ const Utils::Xml::XmlDocument xmlDocument = XmlDocument::CreateFromXmlString(credentialsStr);
+ XmlNode rootNode = xmlDocument.GetRootElement();
+ XmlNode resultNode = rootNode;
+ if (!rootNode.IsNull() && (rootNode.GetName() != "AssumeRoleWithWebIdentityResult"))
+ {
+ resultNode = rootNode.FirstChild("AssumeRoleWithWebIdentityResult");
+ }
+
+ if (!resultNode.IsNull())
+ {
+ XmlNode credentialsNode = resultNode.FirstChild("Credentials");
+ if (!credentialsNode.IsNull())
+ {
+ XmlNode accessKeyIdNode = credentialsNode.FirstChild("AccessKeyId");
+ if (!accessKeyIdNode.IsNull())
+ {
+ result.creds.SetAWSAccessKeyId(accessKeyIdNode.GetText());
+ }
+
+ XmlNode secretAccessKeyNode = credentialsNode.FirstChild("SecretAccessKey");
+ if (!secretAccessKeyNode.IsNull())
+ {
+ result.creds.SetAWSSecretKey(secretAccessKeyNode.GetText());
+ }
+
+ XmlNode sessionTokenNode = credentialsNode.FirstChild("SessionToken");
+ if (!sessionTokenNode.IsNull())
+ {
+ result.creds.SetSessionToken(sessionTokenNode.GetText());
+ }
+
+ XmlNode expirationNode = credentialsNode.FirstChild("Expiration");
+ if (!expirationNode.IsNull())
+ {
+ result.creds.SetExpiration(DateTime(StringUtils::Trim(expirationNode.GetText().c_str()).c_str(), DateFormat::ISO_8601));
+ }
+ }
+ }
+ return result;
+ }
+ }
}
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/monitoring/DefaultMonitoring.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/monitoring/DefaultMonitoring.cpp
index 4bd51be06f3..9953004bc3c 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/monitoring/DefaultMonitoring.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/monitoring/DefaultMonitoring.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/utils/memory/AWSMemory.h>
#include <aws/core/monitoring/DefaultMonitoring.h>
@@ -21,22 +21,22 @@ namespace Aws
{
static const char DEFAULT_MONITORING_ALLOC_TAG[] = "DefaultMonitoringAllocTag";
static const int CLIENT_ID_LENGTH_LIMIT = 256;
- static const int USER_AGENT_LENGTH_LIMIT = 256;
+ static const int USER_AGENT_LENGTH_LIMIT = 256;
static const int ERROR_MESSAGE_LENGTH_LIMIT = 512;
const char DEFAULT_MONITORING_CLIENT_ID[] = ""; // default to empty;
- const char DEFAULT_MONITORING_HOST[] = "127.0.0.1"; // default to loopback ip address instead of "localhost" based on design specification.
+ const char DEFAULT_MONITORING_HOST[] = "127.0.0.1"; // default to loopback ip address instead of "localhost" based on design specification.
unsigned short DEFAULT_MONITORING_PORT = 31000; //default to 31000;
bool DEFAULT_MONITORING_ENABLE = false; //default to false;
const int DefaultMonitoring::DEFAULT_MONITORING_VERSION = 1;
const char DefaultMonitoring::DEFAULT_CSM_CONFIG_ENABLED[] = "csm_enabled";
const char DefaultMonitoring::DEFAULT_CSM_CONFIG_CLIENT_ID[] = "csm_client_id";
- const char DefaultMonitoring::DEFAULT_CSM_CONFIG_HOST[] = "csm_host";
+ const char DefaultMonitoring::DEFAULT_CSM_CONFIG_HOST[] = "csm_host";
const char DefaultMonitoring::DEFAULT_CSM_CONFIG_PORT[] = "csm_port";
const char DefaultMonitoring::DEFAULT_CSM_ENVIRONMENT_VAR_ENABLED[] = "AWS_CSM_ENABLED";
const char DefaultMonitoring::DEFAULT_CSM_ENVIRONMENT_VAR_CLIENT_ID[] = "AWS_CSM_CLIENT_ID";
- const char DefaultMonitoring::DEFAULT_CSM_ENVIRONMENT_VAR_HOST[] = "AWS_CSM_HOST";
+ const char DefaultMonitoring::DEFAULT_CSM_ENVIRONMENT_VAR_HOST[] = "AWS_CSM_HOST";
const char DefaultMonitoring::DEFAULT_CSM_ENVIRONMENT_VAR_PORT[] = "AWS_CSM_PORT";
@@ -45,13 +45,13 @@ namespace Aws
Aws::Utils::DateTime apiCallStartTime;
Aws::Utils::DateTime attemptStartTime;
int retryCount = 0;
- bool lastAttemptSucceeded = false;
- bool lastErrorRetryable = false; //doesn't apply if last attempt succeeded.
+ bool lastAttemptSucceeded = false;
+ bool lastErrorRetryable = false; //doesn't apply if last attempt succeeded.
const Aws::Client::HttpResponseOutcome* outcome = nullptr;
};
- static inline void FillRequiredFieldsToJson(Json::JsonValue& json,
- const Aws::String& type,
+ static inline void FillRequiredFieldsToJson(Json::JsonValue& json,
+ const Aws::String& type,
const Aws::String& service,
const Aws::String& api,
const Aws::String& clientId,
@@ -65,17 +65,17 @@ namespace Aws
.WithString("ClientId", clientId.substr(0, CLIENT_ID_LENGTH_LIMIT))
.WithInt64("Timestamp", timestamp.Millis())
.WithInteger("Version", version)
- .WithString("UserAgent", userAgent.substr(0, USER_AGENT_LENGTH_LIMIT));
+ .WithString("UserAgent", userAgent.substr(0, USER_AGENT_LENGTH_LIMIT));
}
static inline void FillRequiredApiCallFieldsToJson(Json::JsonValue& json,
int attemptCount,
- int64_t apiCallLatency,
- bool maxRetriesExceeded)
+ int64_t apiCallLatency,
+ bool maxRetriesExceeded)
{
json.WithInteger("AttemptCount", attemptCount)
- .WithInt64("Latency", apiCallLatency)
- .WithInteger("MaxRetriesExceeded", maxRetriesExceeded ? 1 : 0);
+ .WithInt64("Latency", apiCallLatency)
+ .WithInteger("MaxRetriesExceeded", maxRetriesExceeded ? 1 : 0);
}
static inline void FillRequiredApiAttemptFieldsToJson(Json::JsonValue& json,
@@ -86,7 +86,7 @@ namespace Aws
.WithInt64("AttemptLatency", attemptLatency);
}
- static inline void ExportResponseHeaderToJson(Json::JsonValue& json, const Aws::Http::HeaderValueCollection& headers,
+ static inline void ExportResponseHeaderToJson(Json::JsonValue& json, const Aws::Http::HeaderValueCollection& headers,
const Aws::String& headerName, const Aws::String& targetName)
{
auto iter = headers.find(headerName);
@@ -105,17 +105,17 @@ namespace Aws
}
}
- static inline void FillOptionalApiCallFieldsToJson(Json::JsonValue& json,
+ static inline void FillOptionalApiCallFieldsToJson(Json::JsonValue& json,
const Aws::Http::HttpRequest* request,
const Aws::Client::HttpResponseOutcome& outcome)
- {
- if (!request->GetSigningRegion().empty())
- {
- json.WithString("Region", request->GetSigningRegion());
- }
+ {
+ if (!request->GetSigningRegion().empty())
+ {
+ json.WithString("Region", request->GetSigningRegion());
+ }
if (!outcome.IsSuccess())
{
- if (outcome.GetError().GetExceptionName().empty()) // Not Aws Exception
+ if (outcome.GetError().GetExceptionName().empty()) // Not Aws Exception
{
json.WithString("FinalSdkExceptionMessage", outcome.GetError().GetMessage().substr(0, ERROR_MESSAGE_LENGTH_LIMIT));
}
@@ -126,20 +126,20 @@ namespace Aws
}
json.WithInteger("FinalHttpStatusCode", static_cast<int>(outcome.GetError().GetResponseCode()));
}
- else
+ else
{
json.WithInteger("FinalHttpStatusCode", static_cast<int>(outcome.GetResult()->GetResponseCode()));
}
- }
-
+ }
+
static inline void FillOptionalApiAttemptFieldsToJson(Json::JsonValue& json,
- const Aws::Http::HttpRequest* request,
+ const Aws::Http::HttpRequest* request,
const Aws::Client::HttpResponseOutcome& outcome,
const CoreMetricsCollection& metricsFromCore)
{
/**
*No matter request succeeded or not, these fields should be included as long as their requirements
- *are met. We should be able to access response (so as to access original request) if the response has error.
+ *are met. We should be able to access response (so as to access original request) if the response has error.
*/
if (request->HasAwsSessionToken() && !request->GetAwsSessionToken().empty())
{
@@ -159,10 +159,10 @@ namespace Aws
ExportResponseHeaderToJson(json, headers, StringUtils::ToLower("x-amzn-RequestId"), "XAmznRequestId");
ExportResponseHeaderToJson(json, headers, StringUtils::ToLower("x-amz-request-id"), "XAmzRequestId");
ExportResponseHeaderToJson(json, headers, StringUtils::ToLower("x-amz-id-2"), "XAmzId2");
-
+
if (!outcome.IsSuccess())
{
- if (outcome.GetError().GetExceptionName().empty()) // Not Aws Exception
+ if (outcome.GetError().GetExceptionName().empty()) // Not Aws Exception
{
json.WithString("SdkExceptionMessage", outcome.GetError().GetMessage().substr(0, ERROR_MESSAGE_LENGTH_LIMIT));
}
@@ -173,7 +173,7 @@ namespace Aws
}
json.WithInteger("HttpStatusCode", static_cast<int>(outcome.GetError().GetResponseCode()));
}
- else
+ else
{
json.WithInteger("HttpStatusCode", static_cast<int>(outcome.GetResult()->GetResponseCode()));
}
@@ -189,8 +189,8 @@ namespace Aws
ExportHttpMetricsToJson(json, metricsFromCore.httpClientMetrics, HttpClientMetricsType::TcpLatency);
}
- DefaultMonitoring::DefaultMonitoring(const Aws::String& clientId, const Aws::String& host, unsigned short port):
- m_udp(host.c_str(), port), m_clientId(clientId)
+ DefaultMonitoring::DefaultMonitoring(const Aws::String& clientId, const Aws::String& host, unsigned short port):
+ m_udp(host.c_str(), port), m_clientId(clientId)
{
}
@@ -221,7 +221,7 @@ namespace Aws
CollectAndSendAttemptData(serviceName, requestName, request, outcome, metricsFromCore, context);
}
- void DefaultMonitoring::OnRequestRetry(const Aws::String& serviceName, const Aws::String& requestName,
+ void DefaultMonitoring::OnRequestRetry(const Aws::String& serviceName, const Aws::String& requestName,
const std::shared_ptr<const Aws::Http::HttpRequest>& request, void* context) const
{
AWS_UNREFERENCED_PARAM(request);
@@ -232,7 +232,7 @@ namespace Aws
AWS_LOGSTREAM_DEBUG(DEFAULT_MONITORING_ALLOC_TAG, "OnRequestRetry Service: " << serviceName << "Request: " << requestName << " RetryCnt:" << defaultContext->retryCount);
}
- void DefaultMonitoring::OnFinish(const Aws::String& serviceName, const Aws::String& requestName,
+ void DefaultMonitoring::OnFinish(const Aws::String& serviceName, const Aws::String& requestName,
const std::shared_ptr<const Aws::Http::HttpRequest>& request, void* context) const
{
AWS_UNREFERENCED_PARAM(request);
@@ -241,72 +241,72 @@ namespace Aws
DefaultContext* defaultContext = static_cast<DefaultContext*>(context);
Aws::Utils::Json::JsonValue json;
FillRequiredFieldsToJson(json, "ApiCall", serviceName, requestName, m_clientId, defaultContext->apiCallStartTime, DEFAULT_MONITORING_VERSION, request->GetUserAgent());
- FillRequiredApiCallFieldsToJson(json, defaultContext->retryCount + 1, (DateTime::Now() - defaultContext->apiCallStartTime).count(), (!defaultContext->lastAttemptSucceeded && defaultContext->lastErrorRetryable));
+ FillRequiredApiCallFieldsToJson(json, defaultContext->retryCount + 1, (DateTime::Now() - defaultContext->apiCallStartTime).count(), (!defaultContext->lastAttemptSucceeded && defaultContext->lastErrorRetryable));
FillOptionalApiCallFieldsToJson(json, request.get(), *(defaultContext->outcome));
Aws::String compactData = json.View().WriteCompact();
- m_udp.SendData(reinterpret_cast<const uint8_t*>(compactData.c_str()), static_cast<int>(compactData.size()));
+ m_udp.SendData(reinterpret_cast<const uint8_t*>(compactData.c_str()), static_cast<int>(compactData.size()));
AWS_LOGSTREAM_DEBUG(DEFAULT_MONITORING_ALLOC_TAG, "Send API Metrics: \n" << json.View().WriteReadable());
Aws::Delete(defaultContext);
}
void DefaultMonitoring::CollectAndSendAttemptData(const Aws::String& serviceName, const Aws::String& requestName,
- const std::shared_ptr<const Aws::Http::HttpRequest>& request, const Aws::Client::HttpResponseOutcome& outcome,
+ const std::shared_ptr<const Aws::Http::HttpRequest>& request, const Aws::Client::HttpResponseOutcome& outcome,
const CoreMetricsCollection& metricsFromCore, void* context) const
{
DefaultContext* defaultContext = static_cast<DefaultContext*>(context);
defaultContext->outcome = &outcome;
- defaultContext->lastAttemptSucceeded = outcome.IsSuccess() ? true : false;
- defaultContext->lastErrorRetryable = (!outcome.IsSuccess() && outcome.GetError().ShouldRetry()) ? true : false;
+ defaultContext->lastAttemptSucceeded = outcome.IsSuccess() ? true : false;
+ defaultContext->lastErrorRetryable = (!outcome.IsSuccess() && outcome.GetError().ShouldRetry()) ? true : false;
Aws::Utils::Json::JsonValue json;
FillRequiredFieldsToJson(json, "ApiCallAttempt", serviceName, requestName, m_clientId, defaultContext->attemptStartTime, DEFAULT_MONITORING_VERSION, request->GetUserAgent());
FillRequiredApiAttemptFieldsToJson(json, request->GetUri().GetAuthority(), (DateTime::Now() - defaultContext->attemptStartTime).count());
- FillOptionalApiAttemptFieldsToJson(json, request.get(), outcome, metricsFromCore);
+ FillOptionalApiAttemptFieldsToJson(json, request.get(), outcome, metricsFromCore);
Aws::String compactData = json.View().WriteCompact();
AWS_LOGSTREAM_DEBUG(DEFAULT_MONITORING_ALLOC_TAG, "Send Attempt Metrics: \n" << json.View().WriteReadable());
- m_udp.SendData(reinterpret_cast<const uint8_t*>(compactData.c_str()), static_cast<int>(compactData.size()));
+ m_udp.SendData(reinterpret_cast<const uint8_t*>(compactData.c_str()), static_cast<int>(compactData.size()));
}
Aws::UniquePtr<MonitoringInterface> DefaultMonitoringFactory::CreateMonitoringInstance() const
- {
+ {
Aws::String clientId(DEFAULT_MONITORING_CLIENT_ID); // default to empty
- Aws::String host(DEFAULT_MONITORING_HOST); // default to 127.0.0.1
+ Aws::String host(DEFAULT_MONITORING_HOST); // default to 127.0.0.1
unsigned short port = DEFAULT_MONITORING_PORT; // default to 31000
bool enable = DEFAULT_MONITORING_ENABLE; //default to false;
//check profile_config
- Aws::String tmpEnable = Aws::Config::GetCachedConfigValue(DefaultMonitoring::DEFAULT_CSM_CONFIG_ENABLED);
- Aws::String tmpClientId = Aws::Config::GetCachedConfigValue(DefaultMonitoring::DEFAULT_CSM_CONFIG_CLIENT_ID);
- Aws::String tmpHost = Aws::Config::GetCachedConfigValue(DefaultMonitoring::DEFAULT_CSM_CONFIG_HOST);
- Aws::String tmpPort = Aws::Config::GetCachedConfigValue(DefaultMonitoring::DEFAULT_CSM_CONFIG_PORT);
+ Aws::String tmpEnable = Aws::Config::GetCachedConfigValue(DefaultMonitoring::DEFAULT_CSM_CONFIG_ENABLED);
+ Aws::String tmpClientId = Aws::Config::GetCachedConfigValue(DefaultMonitoring::DEFAULT_CSM_CONFIG_CLIENT_ID);
+ Aws::String tmpHost = Aws::Config::GetCachedConfigValue(DefaultMonitoring::DEFAULT_CSM_CONFIG_HOST);
+ Aws::String tmpPort = Aws::Config::GetCachedConfigValue(DefaultMonitoring::DEFAULT_CSM_CONFIG_PORT);
+
+ if (!tmpEnable.empty())
+ {
+ enable = StringUtils::CaselessCompare(tmpEnable.c_str(), "true") ? true : false;
+ AWS_LOGSTREAM_DEBUG(DEFAULT_MONITORING_ALLOC_TAG, "Resolved csm_enabled from profile_config to be " << enable);
+ }
+ if (!tmpClientId.empty())
+ {
+ clientId = tmpClientId;
+ AWS_LOGSTREAM_DEBUG(DEFAULT_MONITORING_ALLOC_TAG, "Resolved csm_client_id from profile_config to be " << clientId);
+ }
- if (!tmpEnable.empty())
+ if (!tmpHost.empty())
{
- enable = StringUtils::CaselessCompare(tmpEnable.c_str(), "true") ? true : false;
- AWS_LOGSTREAM_DEBUG(DEFAULT_MONITORING_ALLOC_TAG, "Resolved csm_enabled from profile_config to be " << enable);
- }
- if (!tmpClientId.empty())
- {
- clientId = tmpClientId;
- AWS_LOGSTREAM_DEBUG(DEFAULT_MONITORING_ALLOC_TAG, "Resolved csm_client_id from profile_config to be " << clientId);
- }
-
- if (!tmpHost.empty())
- {
- host = tmpHost;
- AWS_LOGSTREAM_DEBUG(DEFAULT_MONITORING_ALLOC_TAG, "Resolved csm_host from profile_config to be " << host);
+ host = tmpHost;
+ AWS_LOGSTREAM_DEBUG(DEFAULT_MONITORING_ALLOC_TAG, "Resolved csm_host from profile_config to be " << host);
+ }
+
+ if (!tmpPort.empty())
+ {
+ port = static_cast<short>(StringUtils::ConvertToInt32(tmpPort.c_str()));
+ AWS_LOGSTREAM_DEBUG(DEFAULT_MONITORING_ALLOC_TAG, "Resolved csm_port from profile_config to be " << port);
}
- if (!tmpPort.empty())
- {
- port = static_cast<short>(StringUtils::ConvertToInt32(tmpPort.c_str()));
- AWS_LOGSTREAM_DEBUG(DEFAULT_MONITORING_ALLOC_TAG, "Resolved csm_port from profile_config to be " << port);
- }
-
// check environment variables
- tmpEnable = Aws::Environment::GetEnv(DefaultMonitoring::DEFAULT_CSM_ENVIRONMENT_VAR_ENABLED);
- tmpClientId = Aws::Environment::GetEnv(DefaultMonitoring::DEFAULT_CSM_ENVIRONMENT_VAR_CLIENT_ID);
- tmpHost = Aws::Environment::GetEnv(DefaultMonitoring::DEFAULT_CSM_ENVIRONMENT_VAR_HOST);
- tmpPort = Aws::Environment::GetEnv(DefaultMonitoring::DEFAULT_CSM_ENVIRONMENT_VAR_PORT);
+ tmpEnable = Aws::Environment::GetEnv(DefaultMonitoring::DEFAULT_CSM_ENVIRONMENT_VAR_ENABLED);
+ tmpClientId = Aws::Environment::GetEnv(DefaultMonitoring::DEFAULT_CSM_ENVIRONMENT_VAR_CLIENT_ID);
+ tmpHost = Aws::Environment::GetEnv(DefaultMonitoring::DEFAULT_CSM_ENVIRONMENT_VAR_HOST);
+ tmpPort = Aws::Environment::GetEnv(DefaultMonitoring::DEFAULT_CSM_ENVIRONMENT_VAR_PORT);
if (!tmpEnable.empty())
{
enable = StringUtils::CaselessCompare(tmpEnable.c_str(), "true") ? true : false;
@@ -318,11 +318,11 @@ namespace Aws
AWS_LOGSTREAM_DEBUG(DEFAULT_MONITORING_ALLOC_TAG, "Resolved AWS_CSM_CLIENT_ID from Environment variable to be " << clientId);
}
- if (!tmpHost.empty())
- {
- host = tmpHost;
- AWS_LOGSTREAM_DEBUG(DEFAULT_MONITORING_ALLOC_TAG, "Resolved AWS_CSM_HOST from Environment variable to be " << host);
- }
+ if (!tmpHost.empty())
+ {
+ host = tmpHost;
+ AWS_LOGSTREAM_DEBUG(DEFAULT_MONITORING_ALLOC_TAG, "Resolved AWS_CSM_HOST from Environment variable to be " << host);
+ }
if (!tmpPort.empty())
{
port = static_cast<unsigned short>(StringUtils::ConvertToInt32(tmpPort.c_str()));
@@ -333,7 +333,7 @@ namespace Aws
{
return nullptr;
}
- return Aws::MakeUnique<DefaultMonitoring>(DEFAULT_MONITORING_ALLOC_TAG, clientId, host, port);
+ return Aws::MakeUnique<DefaultMonitoring>(DEFAULT_MONITORING_ALLOC_TAG, clientId, host, port);
}
}
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/monitoring/HttpClientMetrics.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/monitoring/HttpClientMetrics.cpp
index 7207dc2bd86..f3ef5828671 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/monitoring/HttpClientMetrics.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/monitoring/HttpClientMetrics.cpp
@@ -1,6 +1,6 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/core/utils/HashingUtils.h>
@@ -10,28 +10,28 @@ namespace Aws
{
namespace Monitoring
{
- static const char HTTP_CLIENT_METRICS_DESTINATION_IP[] = "DestinationIp";
+ static const char HTTP_CLIENT_METRICS_DESTINATION_IP[] = "DestinationIp";
static const char HTTP_CLIENT_METRICS_ACQUIRE_CONNECTION_LATENCY[] = "AcquireConnectionLatency";
static const char HTTP_CLIENT_METRICS_CONNECTION_REUSED[] = "ConnectionReused";
static const char HTTP_CLIENT_METRICS_CONNECTION_LATENCY[] = "ConnectLatency";
static const char HTTP_CLIENT_METRICS_REQUEST_LATENCY[] = "RequestLatency";
static const char HTTP_CLIENT_METRICS_DNS_LATENCY[] = "DnsLatency";
- static const char HTTP_CLIENT_METRICS_TCP_LATENCY[] = "TcpLatency";
+ static const char HTTP_CLIENT_METRICS_TCP_LATENCY[] = "TcpLatency";
static const char HTTP_CLIENT_METRICS_SSL_LATENCY[] = "SslLatency";
static const char HTTP_CLIENT_METRICS_UNKNOWN[] = "Unknown";
using namespace Aws::Utils;
HttpClientMetricsType GetHttpClientMetricTypeByName(const Aws::String& name)
{
- static std::map<int, HttpClientMetricsType> metricsNameHashToType =
+ static std::map<int, HttpClientMetricsType> metricsNameHashToType =
{
- std::pair<int, HttpClientMetricsType>(HashingUtils::HashString(HTTP_CLIENT_METRICS_DESTINATION_IP), HttpClientMetricsType::DestinationIp),
+ std::pair<int, HttpClientMetricsType>(HashingUtils::HashString(HTTP_CLIENT_METRICS_DESTINATION_IP), HttpClientMetricsType::DestinationIp),
std::pair<int, HttpClientMetricsType>(HashingUtils::HashString(HTTP_CLIENT_METRICS_ACQUIRE_CONNECTION_LATENCY), HttpClientMetricsType::AcquireConnectionLatency),
std::pair<int, HttpClientMetricsType>(HashingUtils::HashString(HTTP_CLIENT_METRICS_CONNECTION_REUSED), HttpClientMetricsType::ConnectionReused),
std::pair<int, HttpClientMetricsType>(HashingUtils::HashString(HTTP_CLIENT_METRICS_CONNECTION_LATENCY), HttpClientMetricsType::ConnectLatency),
std::pair<int, HttpClientMetricsType>(HashingUtils::HashString(HTTP_CLIENT_METRICS_REQUEST_LATENCY), HttpClientMetricsType::RequestLatency),
std::pair<int, HttpClientMetricsType>(HashingUtils::HashString(HTTP_CLIENT_METRICS_DNS_LATENCY), HttpClientMetricsType::DnsLatency),
- std::pair<int, HttpClientMetricsType>(HashingUtils::HashString(HTTP_CLIENT_METRICS_TCP_LATENCY), HttpClientMetricsType::TcpLatency),
+ std::pair<int, HttpClientMetricsType>(HashingUtils::HashString(HTTP_CLIENT_METRICS_TCP_LATENCY), HttpClientMetricsType::TcpLatency),
std::pair<int, HttpClientMetricsType>(HashingUtils::HashString(HTTP_CLIENT_METRICS_SSL_LATENCY), HttpClientMetricsType::SslLatency)
};
@@ -46,15 +46,15 @@ namespace Aws
Aws::String GetHttpClientMetricNameByType(HttpClientMetricsType type)
{
- static std::map<int, std::string> metricsTypeToName =
+ static std::map<int, std::string> metricsTypeToName =
{
- std::pair<int, std::string>(static_cast<int>(HttpClientMetricsType::DestinationIp), HTTP_CLIENT_METRICS_DESTINATION_IP),
+ std::pair<int, std::string>(static_cast<int>(HttpClientMetricsType::DestinationIp), HTTP_CLIENT_METRICS_DESTINATION_IP),
std::pair<int, std::string>(static_cast<int>(HttpClientMetricsType::AcquireConnectionLatency), HTTP_CLIENT_METRICS_ACQUIRE_CONNECTION_LATENCY),
std::pair<int, std::string>(static_cast<int>(HttpClientMetricsType::ConnectionReused), HTTP_CLIENT_METRICS_CONNECTION_REUSED),
std::pair<int, std::string>(static_cast<int>(HttpClientMetricsType::ConnectLatency), HTTP_CLIENT_METRICS_CONNECTION_LATENCY),
std::pair<int, std::string>(static_cast<int>(HttpClientMetricsType::RequestLatency), HTTP_CLIENT_METRICS_REQUEST_LATENCY),
std::pair<int, std::string>(static_cast<int>(HttpClientMetricsType::DnsLatency), HTTP_CLIENT_METRICS_DNS_LATENCY),
- std::pair<int, std::string>(static_cast<int>(HttpClientMetricsType::TcpLatency), HTTP_CLIENT_METRICS_TCP_LATENCY),
+ std::pair<int, std::string>(static_cast<int>(HttpClientMetricsType::TcpLatency), HTTP_CLIENT_METRICS_TCP_LATENCY),
std::pair<int, std::string>(static_cast<int>(HttpClientMetricsType::SslLatency), HTTP_CLIENT_METRICS_SSL_LATENCY),
std::pair<int, std::string>(static_cast<int>(HttpClientMetricsType::Unknown), HTTP_CLIENT_METRICS_UNKNOWN)
};
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/monitoring/MonitoringManager.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/monitoring/MonitoringManager.cpp
index 4710a87709d..7a8d3adb41c 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/monitoring/MonitoringManager.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/monitoring/MonitoringManager.cpp
@@ -1,6 +1,6 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/core/utils/memory/AWSMemory.h>
@@ -23,7 +23,7 @@ namespace Aws
const char MonitoringTag[] = "MonitoringAllocTag";
/**
- * Global factory to create global metrics instance.
+ * Global factory to create global metrics instance.
*/
static Aws::UniquePtr<Monitors> s_monitors;
@@ -32,7 +32,7 @@ namespace Aws
assert(s_monitors);
Aws::Vector<void*> contexts;
contexts.reserve(s_monitors->size());
- for (const auto& interface: *s_monitors)
+ for (const auto& interface: *s_monitors)
{
contexts.emplace_back(interface->OnRequestStarted(serviceName, requestName, request));
}
@@ -63,7 +63,7 @@ namespace Aws
}
}
- void OnRequestRetry(const Aws::String& serviceName, const Aws::String& requestName,
+ void OnRequestRetry(const Aws::String& serviceName, const Aws::String& requestName,
const std::shared_ptr<const Aws::Http::HttpRequest>& request, const Aws::Vector<void*>& contexts)
{
assert(s_monitors);
@@ -75,7 +75,7 @@ namespace Aws
}
}
- void OnFinish(const Aws::String& serviceName, const Aws::String& requestName,
+ void OnFinish(const Aws::String& serviceName, const Aws::String& requestName,
const std::shared_ptr<const Aws::Http::HttpRequest>& request, const Aws::Vector<void*>& contexts)
{
assert(s_monitors);
@@ -124,6 +124,6 @@ namespace Aws
s_monitors = nullptr;
}
- } // namespace Monitoring
+ } // namespace Monitoring
} // namespace Aws
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/net/linux-shared/Net.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/net/linux-shared/Net.cpp
index d1495ef18dc..244df21945b 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/net/linux-shared/Net.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/net/linux-shared/Net.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/net/Net.h>
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/net/linux-shared/SimpleUDP.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/net/linux-shared/SimpleUDP.cpp
index f588b2bf119..d9e0c385fda 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/net/linux-shared/SimpleUDP.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/net/linux-shared/SimpleUDP.cpp
@@ -1,11 +1,11 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <sys/types.h>
#include <sys/socket.h>
-#include <netdb.h>
+#include <netdb.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <unistd.h>
@@ -20,117 +20,117 @@ namespace Aws
namespace Net
{
static const char ALLOC_TAG[] = "SimpleUDP";
- static const char IPV4_LOOP_BACK_ADDRESS[] = "127.0.0.1";
- static const char IPV6_LOOP_BACK_ADDRESS[] = "::1";
-
- static inline bool IsValidIPAddress(const char* ip, int addressFamily/*AF_INET or AF_INET6*/)
+ static const char IPV4_LOOP_BACK_ADDRESS[] = "127.0.0.1";
+ static const char IPV6_LOOP_BACK_ADDRESS[] = "::1";
+
+ static inline bool IsValidIPAddress(const char* ip, int addressFamily/*AF_INET or AF_INET6*/)
{
- char buffer[128];
- return inet_pton(addressFamily, ip, (void*)buffer) == 1 ?true :false;
+ char buffer[128];
+ return inet_pton(addressFamily, ip, (void*)buffer) == 1 ?true :false;
+ }
+
+ static bool GetASockAddrFromHostName(const char* hostName, void* sockAddrBuffer, size_t& addrLength, int& addressFamily)
+ {
+ struct addrinfo hints, *res;
+
+ memset(&hints, 0, sizeof(hints));
+
+ hints.ai_family = PF_UNSPEC;
+ hints.ai_socktype = SOCK_DGRAM;
+ if (getaddrinfo(hostName, nullptr, &hints, &res))
+ {
+ return false;
+ }
+
+ memcpy(sockAddrBuffer, res->ai_addr, res->ai_addrlen);
+ addrLength = res->ai_addrlen;
+ addressFamily = res->ai_family;
+ freeaddrinfo(res);
+ return true;
}
- static bool GetASockAddrFromHostName(const char* hostName, void* sockAddrBuffer, size_t& addrLength, int& addressFamily)
+ static sockaddr_in BuildAddrInfoIPV4(const char* hostIP, short port)
{
- struct addrinfo hints, *res;
-
- memset(&hints, 0, sizeof(hints));
-
- hints.ai_family = PF_UNSPEC;
- hints.ai_socktype = SOCK_DGRAM;
- if (getaddrinfo(hostName, nullptr, &hints, &res))
- {
- return false;
- }
-
- memcpy(sockAddrBuffer, res->ai_addr, res->ai_addrlen);
- addrLength = res->ai_addrlen;
- addressFamily = res->ai_family;
- freeaddrinfo(res);
- return true;
+#if (__GNUC__ == 4) && !defined(__clang__)
+ AWS_SUPPRESS_WARNING("-Wmissing-field-initializers",
+ sockaddr_in addrinfo {};
+ );
+#else
+ sockaddr_in addrinfo {};
+#endif
+ addrinfo.sin_family = AF_INET;
+ addrinfo.sin_port = htons(port);
+ inet_pton(AF_INET, hostIP, &addrinfo.sin_addr);
+ return addrinfo;
+ }
+
+ static sockaddr_in6 BuildAddrInfoIPV6(const char* hostIP, short port)
+ {
+#if (__GNUC__ == 4) && !defined(__clang__)
+ AWS_SUPPRESS_WARNING("-Wmissing-field-initializers",
+ sockaddr_in6 addrinfo {};
+ );
+#else
+ sockaddr_in6 addrinfo {};
+#endif
+ addrinfo.sin6_family = AF_INET6;
+ addrinfo.sin6_port = htons(port);
+ inet_pton(AF_INET6, hostIP, &addrinfo.sin6_addr);
+ return addrinfo;
}
- static sockaddr_in BuildAddrInfoIPV4(const char* hostIP, short port)
- {
-#if (__GNUC__ == 4) && !defined(__clang__)
- AWS_SUPPRESS_WARNING("-Wmissing-field-initializers",
- sockaddr_in addrinfo {};
- );
-#else
- sockaddr_in addrinfo {};
-#endif
- addrinfo.sin_family = AF_INET;
- addrinfo.sin_port = htons(port);
- inet_pton(AF_INET, hostIP, &addrinfo.sin_addr);
- return addrinfo;
- }
-
- static sockaddr_in6 BuildAddrInfoIPV6(const char* hostIP, short port)
- {
-#if (__GNUC__ == 4) && !defined(__clang__)
- AWS_SUPPRESS_WARNING("-Wmissing-field-initializers",
- sockaddr_in6 addrinfo {};
- );
-#else
- sockaddr_in6 addrinfo {};
-#endif
- addrinfo.sin6_family = AF_INET6;
- addrinfo.sin6_port = htons(port);
- inet_pton(AF_INET6, hostIP, &addrinfo.sin6_addr);
- return addrinfo;
- }
-
SimpleUDP::SimpleUDP(int addressFamily, size_t sendBufSize, size_t receiveBufSize, bool nonBlocking):
- m_addressFamily(addressFamily), m_connected(false), m_socket(-1), m_port(0)
+ m_addressFamily(addressFamily), m_connected(false), m_socket(-1), m_port(0)
{
CreateSocket(addressFamily, sendBufSize, receiveBufSize, nonBlocking);
}
SimpleUDP::SimpleUDP(bool IPV4, size_t sendBufSize, size_t receiveBufSize, bool nonBlocking) :
- m_addressFamily(IPV4 ? AF_INET : AF_INET6), m_connected(false), m_socket(-1), m_port(0)
+ m_addressFamily(IPV4 ? AF_INET : AF_INET6), m_connected(false), m_socket(-1), m_port(0)
+ {
+ CreateSocket(m_addressFamily, sendBufSize, receiveBufSize, nonBlocking);
+ }
+
+ SimpleUDP::SimpleUDP(const char* host, unsigned short port, size_t sendBufSize, size_t receiveBufSize, bool nonBlocking) :
+ m_addressFamily(AF_INET), m_connected(false), m_socket(-1), m_port(port)
{
+ if (IsValidIPAddress(host, AF_INET))
+ {
+ m_addressFamily = AF_INET;
+ m_hostIP = Aws::String(host);
+ }
+ else if (IsValidIPAddress(host, AF_INET6))
+ {
+ m_addressFamily = AF_INET6;
+ m_hostIP = Aws::String(host);
+ }
+ else
+ {
+ char sockAddrBuffer[100];
+ char hostBuffer[100];
+ size_t addrLength = 0;
+ if (GetASockAddrFromHostName(host, (void*)sockAddrBuffer, addrLength, m_addressFamily))
+ {
+ if (m_addressFamily == AF_INET)
+ {
+ struct sockaddr_in* sockaddr = reinterpret_cast<struct sockaddr_in*>(sockAddrBuffer);
+ inet_ntop(m_addressFamily, &(sockaddr->sin_addr), hostBuffer, sizeof(hostBuffer));
+ }
+ else
+ {
+ struct sockaddr_in6* sockaddr = reinterpret_cast<struct sockaddr_in6*>(sockAddrBuffer);
+ inet_ntop(m_addressFamily, &(sockaddr->sin6_addr), hostBuffer, sizeof(hostBuffer));
+ }
+ m_hostIP = Aws::String(hostBuffer);
+ }
+ else
+ {
+ AWS_LOGSTREAM_ERROR(ALLOC_TAG, "Can't retrieve a valid ip address based on provided host: " << host);
+ }
+ }
CreateSocket(m_addressFamily, sendBufSize, receiveBufSize, nonBlocking);
}
- SimpleUDP::SimpleUDP(const char* host, unsigned short port, size_t sendBufSize, size_t receiveBufSize, bool nonBlocking) :
- m_addressFamily(AF_INET), m_connected(false), m_socket(-1), m_port(port)
- {
- if (IsValidIPAddress(host, AF_INET))
- {
- m_addressFamily = AF_INET;
- m_hostIP = Aws::String(host);
- }
- else if (IsValidIPAddress(host, AF_INET6))
- {
- m_addressFamily = AF_INET6;
- m_hostIP = Aws::String(host);
- }
- else
- {
- char sockAddrBuffer[100];
- char hostBuffer[100];
- size_t addrLength = 0;
- if (GetASockAddrFromHostName(host, (void*)sockAddrBuffer, addrLength, m_addressFamily))
- {
- if (m_addressFamily == AF_INET)
- {
- struct sockaddr_in* sockaddr = reinterpret_cast<struct sockaddr_in*>(sockAddrBuffer);
- inet_ntop(m_addressFamily, &(sockaddr->sin_addr), hostBuffer, sizeof(hostBuffer));
- }
- else
- {
- struct sockaddr_in6* sockaddr = reinterpret_cast<struct sockaddr_in6*>(sockAddrBuffer);
- inet_ntop(m_addressFamily, &(sockaddr->sin6_addr), hostBuffer, sizeof(hostBuffer));
- }
- m_hostIP = Aws::String(hostBuffer);
- }
- else
- {
- AWS_LOGSTREAM_ERROR(ALLOC_TAG, "Can't retrieve a valid ip address based on provided host: " << host);
- }
- }
- CreateSocket(m_addressFamily, sendBufSize, receiveBufSize, nonBlocking);
- }
-
SimpleUDP::~SimpleUDP()
{
close(GetUnderlyingSocket());
@@ -184,35 +184,35 @@ namespace Aws
return ret;
}
- int SimpleUDP::ConnectToHost(const char* hostIP, unsigned short port) const
+ int SimpleUDP::ConnectToHost(const char* hostIP, unsigned short port) const
{
int ret;
if (m_addressFamily == AF_INET6)
{
- sockaddr_in6 addrinfo = BuildAddrInfoIPV6(hostIP, port);
+ sockaddr_in6 addrinfo = BuildAddrInfoIPV6(hostIP, port);
ret = connect(GetUnderlyingSocket(), reinterpret_cast<sockaddr*>(&addrinfo), sizeof(sockaddr_in6));
}
else
{
- sockaddr_in addrinfo = BuildAddrInfoIPV4(hostIP, port);
+ sockaddr_in addrinfo = BuildAddrInfoIPV4(hostIP, port);
ret = connect(GetUnderlyingSocket(), reinterpret_cast<sockaddr*>(&addrinfo), sizeof(sockaddr_in));
}
m_connected = ret ? false : true;
return ret;
}
- int SimpleUDP::ConnectToLocalHost(unsigned short port) const
- {
- if (m_addressFamily == AF_INET6)
- {
- return ConnectToHost(IPV6_LOOP_BACK_ADDRESS, port);
- }
- else
- {
- return ConnectToHost(IPV4_LOOP_BACK_ADDRESS, port);
- }
- }
-
+ int SimpleUDP::ConnectToLocalHost(unsigned short port) const
+ {
+ if (m_addressFamily == AF_INET6)
+ {
+ return ConnectToHost(IPV6_LOOP_BACK_ADDRESS, port);
+ }
+ else
+ {
+ return ConnectToHost(IPV4_LOOP_BACK_ADDRESS, port);
+ }
+ }
+
int SimpleUDP::Bind(const sockaddr* address, size_t addressLength) const
{
return bind(GetUnderlyingSocket(), address, static_cast<socklen_t>(addressLength));
@@ -222,22 +222,22 @@ namespace Aws
{
if (m_addressFamily == AF_INET6)
{
- sockaddr_in6 addrinfo = BuildAddrInfoIPV6(IPV6_LOOP_BACK_ADDRESS, port);
+ sockaddr_in6 addrinfo = BuildAddrInfoIPV6(IPV6_LOOP_BACK_ADDRESS, port);
return bind(GetUnderlyingSocket(), reinterpret_cast<sockaddr*>(&addrinfo), sizeof(sockaddr_in6));
}
else
{
- sockaddr_in addrinfo = BuildAddrInfoIPV4(IPV4_LOOP_BACK_ADDRESS, port);
+ sockaddr_in addrinfo = BuildAddrInfoIPV4(IPV4_LOOP_BACK_ADDRESS, port);
return bind(GetUnderlyingSocket(), reinterpret_cast<sockaddr*>(&addrinfo), sizeof(sockaddr_in));
}
}
int SimpleUDP::SendData(const uint8_t* data, size_t dataLen) const
{
- if (!m_connected)
- {
- ConnectToHost(m_hostIP.c_str(), m_port);
- }
+ if (!m_connected)
+ {
+ ConnectToHost(m_hostIP.c_str(), m_port);
+ }
return send(GetUnderlyingSocket(), data, dataLen, 0);
}
@@ -245,7 +245,7 @@ namespace Aws
{
if (m_connected)
{
- return send(GetUnderlyingSocket(), data, dataLen, 0);
+ return send(GetUnderlyingSocket(), data, dataLen, 0);
}
else
{
@@ -257,16 +257,16 @@ namespace Aws
{
if (m_connected)
{
- return send(GetUnderlyingSocket(), data, dataLen, 0);
+ return send(GetUnderlyingSocket(), data, dataLen, 0);
}
else if (m_addressFamily == AF_INET6)
{
- sockaddr_in6 addrinfo = BuildAddrInfoIPV6(IPV6_LOOP_BACK_ADDRESS, port);
+ sockaddr_in6 addrinfo = BuildAddrInfoIPV6(IPV6_LOOP_BACK_ADDRESS, port);
return sendto(GetUnderlyingSocket(), data, dataLen, 0, reinterpret_cast<sockaddr*>(&addrinfo), sizeof(sockaddr_in6));
}
else
{
- sockaddr_in addrinfo = BuildAddrInfoIPV4(IPV4_LOOP_BACK_ADDRESS, port);
+ sockaddr_in addrinfo = BuildAddrInfoIPV4(IPV4_LOOP_BACK_ADDRESS, port);
return sendto(GetUnderlyingSocket(), data, dataLen, 0, reinterpret_cast<sockaddr*>(&addrinfo), sizeof(sockaddr_in));
}
}
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/platform/linux-shared/Environment.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/platform/linux-shared/Environment.cpp
index facba6a7a77..ee627340bb5 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/platform/linux-shared/Environment.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/platform/linux-shared/Environment.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/platform/Environment.h>
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/platform/linux-shared/FileSystem.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/platform/linux-shared/FileSystem.cpp
index 447fd9bf091..c1ad818911d 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/platform/linux-shared/FileSystem.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/platform/linux-shared/FileSystem.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/platform/FileSystem.h>
#include <aws/core/platform/Environment.h>
@@ -9,7 +9,7 @@
#include <aws/core/utils/DateTime.h>
#include <aws/core/utils/logging/LogMacros.h>
#include <aws/core/utils/StringUtils.h>
-#include <aws/core/utils/UUID.h>
+#include <aws/core/utils/UUID.h>
#include <unistd.h>
#include <pwd.h>
@@ -19,9 +19,9 @@
#include <climits>
#include <cassert>
-#ifdef __APPLE__
-#include <mach-o/dyld.h>
-#endif
+#ifdef __APPLE__
+#include <mach-o/dyld.h>
+#endif
namespace Aws
{
namespace FileSystem
@@ -72,7 +72,7 @@ static const char* FILE_SYSTEM_UTILS_LOG_TAG = "FileSystemUtils";
{
Aws::String entryName = dirEntry->d_name;
if(entryName != ".." && entryName != ".")
- {
+ {
entry = ParseFileInfo(dirEntry, true);
invalidEntry = false;
}
@@ -117,9 +117,9 @@ static const char* FILE_SYSTEM_UTILS_LOG_TAG = "FileSystemUtils";
entry.path = m_directoryEntry.path;
entry.relativePath = m_directoryEntry.relativePath;
}
-
+
AWS_LOGSTREAM_TRACE(FILE_SYSTEM_UTILS_LOG_TAG, "Calling stat on path " << entry.path);
-
+
struct stat dirInfo;
if(!lstat(entry.path.c_str(), &dirInfo))
{
@@ -147,7 +147,7 @@ static const char* FILE_SYSTEM_UTILS_LOG_TAG = "FileSystemUtils";
AWS_LOGSTREAM_ERROR(FILE_SYSTEM_UTILS_LOG_TAG, "Failed to stat file path " << entry.path << " with error code " << errno);
}
- return entry;
+ return entry;
}
DIR* m_dir;
@@ -252,8 +252,8 @@ Aws::String CreateTempFilePath()
{
Aws::StringStream ss;
auto dt = Aws::Utils::DateTime::Now();
-
- ss << dt.ToGmtString("%Y%m%dT%H%M%S") << dt.Millis() << Aws::String(Aws::Utils::UUID::RandomUUID());
+
+ ss << dt.ToGmtString("%Y%m%dT%H%M%S") << dt.Millis() << Aws::String(Aws::Utils::UUID::RandomUUID());
Aws::String tempFile(ss.str());
AWS_LOGSTREAM_DEBUG(FILE_SYSTEM_UTILS_LOG_TAG, "CreateTempFilePath generated: " << tempFile);
@@ -264,22 +264,22 @@ Aws::String CreateTempFilePath()
Aws::String GetExecutableDirectory()
{
char dest[PATH_MAX];
- memset(dest, 0, PATH_MAX);
-#ifdef __APPLE__
- uint32_t destSize = PATH_MAX;
- if (_NSGetExecutablePath(dest, &destSize) == 0)
-#else
- size_t destSize = PATH_MAX;
- if (readlink("/proc/self/exe", dest, destSize))
-#endif
+ memset(dest, 0, PATH_MAX);
+#ifdef __APPLE__
+ uint32_t destSize = PATH_MAX;
+ if (_NSGetExecutablePath(dest, &destSize) == 0)
+#else
+ size_t destSize = PATH_MAX;
+ if (readlink("/proc/self/exe", dest, destSize))
+#endif
{
Aws::String executablePath(dest);
auto lastSlash = executablePath.find_last_of('/');
if(lastSlash != std::string::npos)
{
return executablePath.substr(0, lastSlash);
- }
- }
+ }
+ }
return "./";
}
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/platform/linux-shared/OSVersionInfo.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/platform/linux-shared/OSVersionInfo.cpp
index ed35c20fa08..040173a2e58 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/platform/linux-shared/OSVersionInfo.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/platform/linux-shared/OSVersionInfo.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/platform/OSVersionInfo.h>
#include <aws/core/utils/memory/stl/AWSStringStream.h>
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/platform/linux-shared/Security.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/platform/linux-shared/Security.cpp
index 15490f24f0e..286de1a9485 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/platform/linux-shared/Security.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/platform/linux-shared/Security.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/platform/Security.h>
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/platform/linux-shared/Time.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/platform/linux-shared/Time.cpp
index 8c8f3b82098..7a0d3d1c0ae 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/platform/linux-shared/Time.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/platform/linux-shared/Time.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/platform/Time.h>
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/ARN.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/ARN.cpp
index c4fce2ccacf..dac358c09de 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/ARN.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/ARN.cpp
@@ -1,46 +1,46 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
-
-#include <aws/core/utils/ARN.h>
-#include <aws/core/utils/StringUtils.h>
-#include <aws/core/utils/logging/LogMacros.h>
-
-namespace Aws
-{
- namespace Utils
- {
- ARN::ARN(const Aws::String& arnString)
- {
- m_valid = false;
-
- // An ARN can be identified as any string starting with arn: with 6 defined segments each separated by a :
- const auto result = StringUtils::Split(arnString, ':', StringUtils::SplitOptions::INCLUDE_EMPTY_ENTRIES);
-
- if (result.size() < 6)
- {
- return;
- }
-
- if (result[0] != "arn")
- {
- return;
- }
-
- m_arnString = arnString;
- m_partition = result[1];
- m_service = result[2];
- m_region = result[3];
- m_accountId = result[4];
- m_resource = result[5];
-
- for (size_t i = 6; i < result.size(); i++)
- {
- m_resource += ":" + result[i];
- }
-
- m_valid = true;
- }
- }
-} \ No newline at end of file
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
+
+#include <aws/core/utils/ARN.h>
+#include <aws/core/utils/StringUtils.h>
+#include <aws/core/utils/logging/LogMacros.h>
+
+namespace Aws
+{
+ namespace Utils
+ {
+ ARN::ARN(const Aws::String& arnString)
+ {
+ m_valid = false;
+
+ // An ARN can be identified as any string starting with arn: with 6 defined segments each separated by a :
+ const auto result = StringUtils::Split(arnString, ':', StringUtils::SplitOptions::INCLUDE_EMPTY_ENTRIES);
+
+ if (result.size() < 6)
+ {
+ return;
+ }
+
+ if (result[0] != "arn")
+ {
+ return;
+ }
+
+ m_arnString = arnString;
+ m_partition = result[1];
+ m_service = result[2];
+ m_region = result[3];
+ m_accountId = result[4];
+ m_resource = result[5];
+
+ for (size_t i = 6; i < result.size(); i++)
+ {
+ m_resource += ":" + result[i];
+ }
+
+ m_valid = true;
+ }
+ }
+} \ No newline at end of file
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/Array.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/Array.cpp
index ce9ad567031..43e78634218 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/Array.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/Array.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/utils/Array.h>
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/DNS.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/DNS.cpp
index 667f1819001..ce588150e2f 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/DNS.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/DNS.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/utils/DNS.h>
#include <aws/core/utils/StringUtils.h>
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/DateTimeCommon.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/DateTimeCommon.cpp
index 639688d2553..b690c90c2dd 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/DateTimeCommon.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/DateTimeCommon.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/utils/DateTime.h>
@@ -17,7 +17,7 @@ static const char* CLASS_TAG = "DateTime";
static const char* RFC822_DATE_FORMAT_STR_MINUS_Z = "%a, %d %b %Y %H:%M:%S";
static const char* RFC822_DATE_FORMAT_STR_WITH_Z = "%a, %d %b %Y %H:%M:%S %Z";
static const char* ISO_8601_LONG_DATE_FORMAT_STR = "%Y-%m-%dT%H:%M:%SZ";
-static const char* ISO_8601_LONG_BASIC_DATE_FORMAT_STR = "%Y%m%dT%H%M%SZ";
+static const char* ISO_8601_LONG_BASIC_DATE_FORMAT_STR = "%Y%m%dT%H%M%SZ";
using namespace Aws::Utils;
@@ -79,7 +79,7 @@ static int GetWeekDayNumberFromStr(const char* timeString, size_t startIndex, si
case 'n':
return 0;
default:
- return -1;
+ return -1;
}
default:
return -1;
@@ -210,7 +210,7 @@ static int GetMonthNumberFromStr(const char* timeString, size_t startIndex, size
return 2;
default:
return -1;
- }
+ }
default:
return -1;
}
@@ -376,8 +376,8 @@ static int GetMonthNumberFromStr(const char* timeString, size_t startIndex, size
return -1;
}
}
-// Ensure local classes with generic names have internal linkage
-namespace {
+// Ensure local classes with generic names have internal linkage
+namespace {
class DateParser
{
@@ -385,7 +385,7 @@ public:
DateParser(const char* toParse) : m_error(false), m_toParse(toParse), m_utcAssumed(true)
{
m_parsedTimestamp = CreateZeroedTm();
- memset(m_tz, 0, 7);
+ memset(m_tz, 0, 7);
}
virtual ~DateParser() = default;
@@ -401,8 +401,8 @@ protected:
const char* m_toParse;
std::tm m_parsedTimestamp;
bool m_utcAssumed;
- // The size should be at least one byte greater than the maximum possible size so that we could use the last char to indicate the end of the string.
- char m_tz[7];
+ // The size should be at least one byte greater than the maximum possible size so that we could use the last char to indicate the end of the string.
+ char m_tz[7];
};
static const int MAX_LEN = 100;
@@ -414,8 +414,8 @@ static const int MAX_LEN = 100;
class RFC822DateParser : public DateParser
{
public:
- RFC822DateParser(const char* toParse) : DateParser(toParse), m_state(0)
- {
+ RFC822DateParser(const char* toParse) : DateParser(toParse), m_state(0)
+ {
}
/**
@@ -423,13 +423,13 @@ public:
*/
void Parse() override
{
- size_t len = strlen(m_toParse);
+ size_t len = strlen(m_toParse);
//DOS check
if (len > MAX_LEN)
{
- AWS_LOGSTREAM_WARN(CLASS_TAG, "Incoming String to parse too long with length: " << len)
- m_error = true;
+ AWS_LOGSTREAM_WARN(CLASS_TAG, "Incoming String to parse too long with length: " << len)
+ m_error = true;
return;
}
@@ -445,7 +445,7 @@ public:
{
case 0:
if(c == ',')
- {
+ {
int weekNumber = GetWeekDayNumberFromStr(m_toParse, stateStartIndex, index + 1);
if (weekNumber > -1)
@@ -464,10 +464,10 @@ public:
m_error = true;
}
break;
- case 1:
+ case 1:
if (isspace(c))
{
- m_state = 2;
+ m_state = 2;
stateStartIndex = index + 1;
}
else
@@ -579,18 +579,18 @@ public:
}
break;
case 8:
- if ((isalnum(c) || c == '+' || c == '-') && (index - stateStartIndex < 5))
+ if ((isalnum(c) || c == '+' || c == '-') && (index - stateStartIndex < 5))
{
m_tz[index - stateStartIndex] = c;
- }
- else
- {
- m_error = true;
- }
+ }
+ else
+ {
+ m_error = true;
+ }
+ break;
+ default:
+ m_error = true;
break;
- default:
- m_error = true;
- break;
}
index++;
@@ -598,7 +598,7 @@ public:
if (m_tz[0] != 0)
{
- m_utcAssumed = IsUTCTimeZoneDesignator(m_tz);
+ m_utcAssumed = IsUTCTimeZoneDesignator(m_tz);
}
m_error = (m_error || m_state != finalState);
@@ -607,101 +607,101 @@ public:
int GetState() const { return m_state; }
private:
- //Detects whether or not the passed in timezone string is a UTC zone.
- static bool IsUTCTimeZoneDesignator(const char* str)
- {
- size_t len = strlen(str);
- if (len < 3)
- {
- return false;
- }
-
- int index = 0;
- char c = str[index];
- switch (c)
- {
- case 'U':
- case 'u':
- c = str[++index];
- switch(c)
- {
- case 'T':
- case 't':
- c = str[++index];
- switch(c)
- {
- case 'C':
- case 'c':
- return true;
- default:
- return false;
- }
-
- case 'C':
- case 'c':
- c = str[++index];
- switch (c)
- {
- case 'T':
- case 't':
- return true;
- default:
- return false;
- }
- default:
- return false;
- }
- case 'G':
- case 'g':
- c = str[++index];
- switch (c)
- {
- case 'M':
- case 'm':
- c = str[++index];
- switch (c)
- {
- case 'T':
- case 't':
- return true;
- default:
- return false;
- }
- default:
- return false;
- }
- case '+':
- case '-':
- c = str[++index];
- switch (c)
- {
- case '0':
- c = str[++index];
- switch (c)
- {
- case '0':
- c = str[++index];
- switch (c)
- {
- case '0':
- return true;
- default:
- return false;
- }
- default:
- return false;
- }
- default:
- return false;
- }
- case 'Z':
- return true;
- default:
- return false;
- }
-
- }
-
+ //Detects whether or not the passed in timezone string is a UTC zone.
+ static bool IsUTCTimeZoneDesignator(const char* str)
+ {
+ size_t len = strlen(str);
+ if (len < 3)
+ {
+ return false;
+ }
+
+ int index = 0;
+ char c = str[index];
+ switch (c)
+ {
+ case 'U':
+ case 'u':
+ c = str[++index];
+ switch(c)
+ {
+ case 'T':
+ case 't':
+ c = str[++index];
+ switch(c)
+ {
+ case 'C':
+ case 'c':
+ return true;
+ default:
+ return false;
+ }
+
+ case 'C':
+ case 'c':
+ c = str[++index];
+ switch (c)
+ {
+ case 'T':
+ case 't':
+ return true;
+ default:
+ return false;
+ }
+ default:
+ return false;
+ }
+ case 'G':
+ case 'g':
+ c = str[++index];
+ switch (c)
+ {
+ case 'M':
+ case 'm':
+ c = str[++index];
+ switch (c)
+ {
+ case 'T':
+ case 't':
+ return true;
+ default:
+ return false;
+ }
+ default:
+ return false;
+ }
+ case '+':
+ case '-':
+ c = str[++index];
+ switch (c)
+ {
+ case '0':
+ c = str[++index];
+ switch (c)
+ {
+ case '0':
+ c = str[++index];
+ switch (c)
+ {
+ case '0':
+ return true;
+ default:
+ return false;
+ }
+ default:
+ return false;
+ }
+ default:
+ return false;
+ }
+ case 'Z':
+ return true;
+ default:
+ return false;
+ }
+
+ }
+
int m_state;
};
@@ -724,7 +724,7 @@ public:
//DOS check
if (len > MAX_LEN)
{
- AWS_LOGSTREAM_WARN(CLASS_TAG, "Incoming String to parse too long with length: " << len)
+ AWS_LOGSTREAM_WARN(CLASS_TAG, "Incoming String to parse too long with length: " << len)
m_error = true;
return;
}
@@ -820,10 +820,10 @@ public:
break;
case 5:
- if ((c == 'Z' || c == '+' || c == '-' ) && (index - stateStartIndex == 2))
+ if ((c == 'Z' || c == '+' || c == '-' ) && (index - stateStartIndex == 2))
{
- m_tz[0] = c;
- m_state = 7;
+ m_tz[0] = c;
+ m_state = 7;
stateStartIndex = index + 1;
}
else if (c == '.' && index - stateStartIndex == 2)
@@ -842,10 +842,10 @@ public:
break;
case 6:
- if ((c == 'Z' || c == '+' || c == '-' ) && (index - stateStartIndex == 3))
+ if ((c == 'Z' || c == '+' || c == '-' ) && (index - stateStartIndex == 3))
{
- m_tz[0] = c;
- m_state = 7;
+ m_tz[0] = c;
+ m_state = 7;
stateStartIndex = index + 1;
}
else if(!isdigit(c))
@@ -853,263 +853,263 @@ public:
m_error = true;
}
break;
- case 7:
- if ((isdigit(c) || c == ':') && (index - stateStartIndex < 5))
- {
- m_tz[1 + index - stateStartIndex] = c;
- }
- else
- {
- m_error = true;
- }
- break;
- default:
- m_error = true;
- break;
+ case 7:
+ if ((isdigit(c) || c == ':') && (index - stateStartIndex < 5))
+ {
+ m_tz[1 + index - stateStartIndex] = c;
+ }
+ else
+ {
+ m_error = true;
+ }
+ break;
+ default:
+ m_error = true;
+ break;
}
index++;
}
- if (m_tz[0] != 0)
- {
- m_utcAssumed = IsUTCTimeZoneDesignator(m_tz);
- }
-
+ if (m_tz[0] != 0)
+ {
+ m_utcAssumed = IsUTCTimeZoneDesignator(m_tz);
+ }
+
m_error = (m_error || m_state != finalState);
}
-private:
- //Detects whether or not the passed in timezone string is a UTC zone.
- static bool IsUTCTimeZoneDesignator(const char* str)
- {
- size_t len = strlen(str);
-
- if (len > 0)
- {
- if (len == 1 && str[0] == 'Z')
- {
- return true;
- }
-
- if (len == 6 && str[0] == '+'
- && str[1] == '0'
- && str[2] == '0'
- && str[3] == ':'
- && str[4] == '0'
- && str[5] == '0')
- {
- return true;
- }
-
- return false;
- }
-
- return false;
- }
-
- int m_state;
-};
-
-class ISO_8601BasicDateParser : public DateParser
-{
-public:
- ISO_8601BasicDateParser(const char* stringToParse) : DateParser(stringToParse), m_state(0)
- {
- }
-
- //parses "%Y%m%dT%H%M%SZ or "%Y%m%dT%H%M%S000Z"
- void Parse() override
- {
- size_t len = strlen(m_toParse);
-
- //DOS check
- if (len > MAX_LEN)
- {
- AWS_LOGSTREAM_WARN(CLASS_TAG, "Incoming String to parse too long with length: " << len)
- m_error = true;
- return;
- }
-
- size_t index = 0;
- size_t stateStartIndex = 0;
- const int finalState = 7;
-
- while (m_state <= finalState && !m_error && index < len)
- {
- char c = m_toParse[index];
- switch (m_state)
- {
- // On year: %Y
- case 0:
- if (isdigit(c))
- {
- m_parsedTimestamp.tm_year = m_parsedTimestamp.tm_year * 10 + (c - '0');
- if (index - stateStartIndex == 3)
- {
- m_state = 1;
- stateStartIndex = index + 1;
- m_parsedTimestamp.tm_year -= 1900;
- }
- }
- else
- {
- m_error = true;
- }
- break;
- // On month: %m
- case 1:
- if (isdigit(c))
- {
- m_parsedTimestamp.tm_mon = m_parsedTimestamp.tm_mon * 10 + (c - '0');
- if (index - stateStartIndex == 1)
- {
- m_state = 2;
- stateStartIndex = index + 1;
- m_parsedTimestamp.tm_mon -= 1;
- }
- }
- else
- {
- m_error = true;
- }
- break;
- // On month day: %d
- case 2:
- if (c == 'T' && index - stateStartIndex == 2)
- {
- m_state = 3;
- stateStartIndex = index + 1;
- }
- else if (isdigit(c))
- {
- m_parsedTimestamp.tm_mday = m_parsedTimestamp.tm_mday * 10 + (c - '0');
- }
- else
- {
- m_error = true;
- }
- break;
- // On hour: %H
- case 3:
- if (isdigit(c))
- {
- m_parsedTimestamp.tm_hour = m_parsedTimestamp.tm_hour * 10 + (c - '0');
- if (index - stateStartIndex == 1)
- {
- m_state = 4;
- stateStartIndex = index + 1;
- }
- }
- else
- {
- m_error = true;
- }
- break;
- // On minute: %M
- case 4:
- if (isdigit(c))
- {
- m_parsedTimestamp.tm_min = m_parsedTimestamp.tm_min * 10 + (c - '0');
- if (index - stateStartIndex == 1)
- {
- m_state = 5;
- stateStartIndex = index + 1;
- }
- }
- else
- {
- m_error = true;
- }
- break;
- // On second: %S
- case 5:
- if (isdigit(c))
- {
- m_parsedTimestamp.tm_sec = m_parsedTimestamp.tm_sec * 10 + (c - '0');
- if (index - stateStartIndex == 1)
- {
- m_state = 6;
- stateStartIndex = index + 1;
- }
- }
- else
- {
- m_error = true;
- }
- break;
- // On TZ: Z or 000Z
- case 6:
- if ((c == 'Z' || c == '+' || c == '-' ) && (index - stateStartIndex == 0 || index - stateStartIndex == 3))
- {
- m_tz[0] = c;
- m_state = 7;
- stateStartIndex = index + 1;
- }
- else if (!isdigit(c) || index - stateStartIndex > 3)
- {
- m_error = true;
- }
- break;
- case 7:
- if ((isdigit(c) || c == ':') && (index - stateStartIndex < 5))
- {
- m_tz[1 + index - stateStartIndex] = c;
- }
- else
- {
- m_error = true;
- }
- break;
- default:
- m_error = true;
- break;
- }
- index++;
- }
-
- if (m_tz[0] != 0)
- {
- m_utcAssumed = IsUTCTimeZoneDesignator(m_tz);
- }
-
- m_error = (m_error || m_state != finalState);
- }
-
private:
- //Detects whether or not the passed in timezone string is a UTC zone.
- static bool IsUTCTimeZoneDesignator(const char* str)
- {
- size_t len = strlen(str);
-
- if (len > 0)
- {
- if (len == 1 && str[0] == 'Z')
- {
- return true;
- }
-
- if (len == 5 && str[0] == '+'
- && str[1] == '0'
- && str[2] == '0'
- && str[3] == '0'
- && str[4] == '0')
- {
- return true;
- }
-
- return false;
- }
-
- return false;
- }
-
+ //Detects whether or not the passed in timezone string is a UTC zone.
+ static bool IsUTCTimeZoneDesignator(const char* str)
+ {
+ size_t len = strlen(str);
+
+ if (len > 0)
+ {
+ if (len == 1 && str[0] == 'Z')
+ {
+ return true;
+ }
+
+ if (len == 6 && str[0] == '+'
+ && str[1] == '0'
+ && str[2] == '0'
+ && str[3] == ':'
+ && str[4] == '0'
+ && str[5] == '0')
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ return false;
+ }
+
int m_state;
};
-
-} // namespace
+
+class ISO_8601BasicDateParser : public DateParser
+{
+public:
+ ISO_8601BasicDateParser(const char* stringToParse) : DateParser(stringToParse), m_state(0)
+ {
+ }
+
+ //parses "%Y%m%dT%H%M%SZ or "%Y%m%dT%H%M%S000Z"
+ void Parse() override
+ {
+ size_t len = strlen(m_toParse);
+
+ //DOS check
+ if (len > MAX_LEN)
+ {
+ AWS_LOGSTREAM_WARN(CLASS_TAG, "Incoming String to parse too long with length: " << len)
+ m_error = true;
+ return;
+ }
+
+ size_t index = 0;
+ size_t stateStartIndex = 0;
+ const int finalState = 7;
+
+ while (m_state <= finalState && !m_error && index < len)
+ {
+ char c = m_toParse[index];
+ switch (m_state)
+ {
+ // On year: %Y
+ case 0:
+ if (isdigit(c))
+ {
+ m_parsedTimestamp.tm_year = m_parsedTimestamp.tm_year * 10 + (c - '0');
+ if (index - stateStartIndex == 3)
+ {
+ m_state = 1;
+ stateStartIndex = index + 1;
+ m_parsedTimestamp.tm_year -= 1900;
+ }
+ }
+ else
+ {
+ m_error = true;
+ }
+ break;
+ // On month: %m
+ case 1:
+ if (isdigit(c))
+ {
+ m_parsedTimestamp.tm_mon = m_parsedTimestamp.tm_mon * 10 + (c - '0');
+ if (index - stateStartIndex == 1)
+ {
+ m_state = 2;
+ stateStartIndex = index + 1;
+ m_parsedTimestamp.tm_mon -= 1;
+ }
+ }
+ else
+ {
+ m_error = true;
+ }
+ break;
+ // On month day: %d
+ case 2:
+ if (c == 'T' && index - stateStartIndex == 2)
+ {
+ m_state = 3;
+ stateStartIndex = index + 1;
+ }
+ else if (isdigit(c))
+ {
+ m_parsedTimestamp.tm_mday = m_parsedTimestamp.tm_mday * 10 + (c - '0');
+ }
+ else
+ {
+ m_error = true;
+ }
+ break;
+ // On hour: %H
+ case 3:
+ if (isdigit(c))
+ {
+ m_parsedTimestamp.tm_hour = m_parsedTimestamp.tm_hour * 10 + (c - '0');
+ if (index - stateStartIndex == 1)
+ {
+ m_state = 4;
+ stateStartIndex = index + 1;
+ }
+ }
+ else
+ {
+ m_error = true;
+ }
+ break;
+ // On minute: %M
+ case 4:
+ if (isdigit(c))
+ {
+ m_parsedTimestamp.tm_min = m_parsedTimestamp.tm_min * 10 + (c - '0');
+ if (index - stateStartIndex == 1)
+ {
+ m_state = 5;
+ stateStartIndex = index + 1;
+ }
+ }
+ else
+ {
+ m_error = true;
+ }
+ break;
+ // On second: %S
+ case 5:
+ if (isdigit(c))
+ {
+ m_parsedTimestamp.tm_sec = m_parsedTimestamp.tm_sec * 10 + (c - '0');
+ if (index - stateStartIndex == 1)
+ {
+ m_state = 6;
+ stateStartIndex = index + 1;
+ }
+ }
+ else
+ {
+ m_error = true;
+ }
+ break;
+ // On TZ: Z or 000Z
+ case 6:
+ if ((c == 'Z' || c == '+' || c == '-' ) && (index - stateStartIndex == 0 || index - stateStartIndex == 3))
+ {
+ m_tz[0] = c;
+ m_state = 7;
+ stateStartIndex = index + 1;
+ }
+ else if (!isdigit(c) || index - stateStartIndex > 3)
+ {
+ m_error = true;
+ }
+ break;
+ case 7:
+ if ((isdigit(c) || c == ':') && (index - stateStartIndex < 5))
+ {
+ m_tz[1 + index - stateStartIndex] = c;
+ }
+ else
+ {
+ m_error = true;
+ }
+ break;
+ default:
+ m_error = true;
+ break;
+ }
+ index++;
+ }
+
+ if (m_tz[0] != 0)
+ {
+ m_utcAssumed = IsUTCTimeZoneDesignator(m_tz);
+ }
+
+ m_error = (m_error || m_state != finalState);
+ }
+
+private:
+ //Detects whether or not the passed in timezone string is a UTC zone.
+ static bool IsUTCTimeZoneDesignator(const char* str)
+ {
+ size_t len = strlen(str);
+
+ if (len > 0)
+ {
+ if (len == 1 && str[0] == 'Z')
+ {
+ return true;
+ }
+
+ if (len == 5 && str[0] == '+'
+ && str[1] == '0'
+ && str[2] == '0'
+ && str[3] == '0'
+ && str[4] == '0')
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ return false;
+ }
+
+ int m_state;
+};
+
+} // namespace
DateTime::DateTime(const std::chrono::system_clock::time_point& timepointToAssign) : m_time(timepointToAssign), m_valid(true)
-{
+{
}
DateTime::DateTime(int64_t millisSinceEpoch) : m_valid(true)
@@ -1213,10 +1213,10 @@ Aws::String DateTime::ToLocalTimeString(DateFormat format) const
{
case DateFormat::ISO_8601:
return ToLocalTimeString(ISO_8601_LONG_DATE_FORMAT_STR);
- case DateFormat::ISO_8601_BASIC:
- return ToLocalTimeString(ISO_8601_LONG_BASIC_DATE_FORMAT_STR);
+ case DateFormat::ISO_8601_BASIC:
+ return ToLocalTimeString(ISO_8601_LONG_BASIC_DATE_FORMAT_STR);
case DateFormat::RFC822:
- return ToLocalTimeString(RFC822_DATE_FORMAT_STR_WITH_Z);
+ return ToLocalTimeString(RFC822_DATE_FORMAT_STR_WITH_Z);
default:
assert(0);
return "";
@@ -1238,11 +1238,11 @@ Aws::String DateTime::ToGmtString(DateFormat format) const
{
case DateFormat::ISO_8601:
return ToGmtString(ISO_8601_LONG_DATE_FORMAT_STR);
- case DateFormat::ISO_8601_BASIC:
- return ToGmtString(ISO_8601_LONG_BASIC_DATE_FORMAT_STR);
+ case DateFormat::ISO_8601_BASIC:
+ return ToGmtString(ISO_8601_LONG_BASIC_DATE_FORMAT_STR);
case DateFormat::RFC822:
{
- //Windows erroneously drops the local timezone in for %Z
+ //Windows erroneously drops the local timezone in for %Z
Aws::String rfc822GmtString = ToGmtString(RFC822_DATE_FORMAT_STR_MINUS_Z);
rfc822GmtString += " GMT";
return rfc822GmtString;
@@ -1254,7 +1254,7 @@ Aws::String DateTime::ToGmtString(DateFormat format) const
}
Aws::String DateTime::ToGmtString(const char* formatStr) const
-{
+{
struct tm gmtTimeStamp = ConvertTimestampToGmtStruct();
char formattedString[100];
@@ -1343,31 +1343,31 @@ Aws::String DateTime::CalculateGmtTimestampAsString(const char* formatStr)
return now.ToGmtString(formatStr);
}
-Aws::String DateTime::CalculateGmtTimeWithMsPrecision()
-{
- auto now = DateTime::Now();
- struct tm gmtTimeStamp = now.ConvertTimestampToGmtStruct();
-
- char formattedString[100];
- auto len = std::strftime(formattedString, sizeof(formattedString), "%Y-%m-%d %H:%M:%S", &gmtTimeStamp);
- if (len)
- {
- auto ms = now.Millis();
- ms = ms - ms / 1000 * 1000; // calculate the milliseconds as fraction.
- formattedString[len++] = '.';
- int divisor = 100;
- while(divisor)
- {
- auto digit = ms / divisor;
- formattedString[len++] = char('0' + digit);
- ms = ms - divisor * digit;
- divisor /= 10;
- }
- formattedString[len] = '\0';
- }
- return formattedString;
-}
-
+Aws::String DateTime::CalculateGmtTimeWithMsPrecision()
+{
+ auto now = DateTime::Now();
+ struct tm gmtTimeStamp = now.ConvertTimestampToGmtStruct();
+
+ char formattedString[100];
+ auto len = std::strftime(formattedString, sizeof(formattedString), "%Y-%m-%d %H:%M:%S", &gmtTimeStamp);
+ if (len)
+ {
+ auto ms = now.Millis();
+ ms = ms - ms / 1000 * 1000; // calculate the milliseconds as fraction.
+ formattedString[len++] = '.';
+ int divisor = 100;
+ while(divisor)
+ {
+ auto digit = ms / divisor;
+ formattedString[len++] = char('0' + digit);
+ ms = ms - divisor * digit;
+ divisor /= 10;
+ }
+ formattedString[len] = '\0';
+ }
+ return formattedString;
+}
+
int DateTime::CalculateCurrentHour()
{
return Now().GetHour(true);
@@ -1384,14 +1384,14 @@ std::chrono::milliseconds DateTime::Diff(const DateTime& a, const DateTime& b)
return std::chrono::duration_cast<std::chrono::milliseconds>(diff);
}
-std::chrono::milliseconds DateTime::operator-(const DateTime& other) const
+std::chrono::milliseconds DateTime::operator-(const DateTime& other) const
{
auto diff = this->m_time - other.m_time;
return std::chrono::duration_cast<std::chrono::milliseconds>(diff);
}
void DateTime::ConvertTimestampStringToTimePoint(const char* timestamp, DateFormat format)
-{
+{
std::tm timeStruct;
bool isUtc = true;
@@ -1413,17 +1413,17 @@ void DateTime::ConvertTimestampStringToTimePoint(const char* timestamp, DateForm
m_valid = parser.WasParseSuccessful();
isUtc = parser.ShouldIAssumeThisIsUTC();
timeStruct = parser.GetParsedTimestamp();
- break;
+ break;
+ }
+ case DateFormat::ISO_8601_BASIC:
+ {
+ ISO_8601BasicDateParser parser(timestamp);
+ parser.Parse();
+ m_valid = parser.WasParseSuccessful();
+ isUtc = parser.ShouldIAssumeThisIsUTC();
+ timeStruct = parser.GetParsedTimestamp();
+ break;
}
- case DateFormat::ISO_8601_BASIC:
- {
- ISO_8601BasicDateParser parser(timestamp);
- parser.Parse();
- m_valid = parser.WasParseSuccessful();
- isUtc = parser.ShouldIAssumeThisIsUTC();
- timeStruct = parser.GetParsedTimestamp();
- break;
- }
case DateFormat::AutoDetect:
{
RFC822DateParser rfcParser(timestamp);
@@ -1444,24 +1444,24 @@ void DateTime::ConvertTimestampStringToTimePoint(const char* timestamp, DateForm
timeStruct = isoParser.GetParsedTimestamp();
break;
}
- ISO_8601BasicDateParser isoBasicParser(timestamp);
- isoBasicParser.Parse();
- if (isoBasicParser.WasParseSuccessful())
- {
- m_valid = true;
- isUtc = isoBasicParser.ShouldIAssumeThisIsUTC();
- timeStruct = isoBasicParser.GetParsedTimestamp();
- break;
- }
+ ISO_8601BasicDateParser isoBasicParser(timestamp);
+ isoBasicParser.Parse();
+ if (isoBasicParser.WasParseSuccessful())
+ {
+ m_valid = true;
+ isUtc = isoBasicParser.ShouldIAssumeThisIsUTC();
+ timeStruct = isoBasicParser.GetParsedTimestamp();
+ break;
+ }
m_valid = false;
break;
}
- default:
+ default:
assert(0);
- }
-
+ }
+
if (m_valid)
- {
+ {
std::time_t tt;
if(isUtc)
{
@@ -1474,7 +1474,7 @@ void DateTime::ConvertTimestampStringToTimePoint(const char* timestamp, DateForm
tt = std::mktime(&timeStruct);
}
m_time = std::chrono::system_clock::from_time_t(tt);
- }
+ }
}
tm DateTime::GetTimeStruct(bool localTime) const
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/Directory.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/Directory.cpp
index 53df08a0df7..49ca56b280a 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/Directory.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/Directory.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/platform/FileSystem.h>
#include <aws/core/utils/memory/stl/AWSQueue.h>
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/EnumParseOverflowContainer.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/EnumParseOverflowContainer.cpp
index dda261995b6..eaeba1d9105 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/EnumParseOverflowContainer.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/EnumParseOverflowContainer.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/utils/EnumParseOverflowContainer.h>
#include <aws/core/utils/logging/LogMacros.h>
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/FileSystemUtils.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/FileSystemUtils.cpp
index 7ddb31c8291..c47f7509605 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/FileSystemUtils.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/FileSystemUtils.cpp
@@ -1,6 +1,6 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/core/utils/FileSystemUtils.h>
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/GetTheLights.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/GetTheLights.cpp
index d693ccedf00..6e78b546ab5 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/GetTheLights.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/GetTheLights.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/utils/GetTheLights.h>
#include <cassert>
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/HashingUtils.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/HashingUtils.cpp
index e077530c802..147bddf33e0 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/HashingUtils.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/HashingUtils.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/utils/logging/LogMacros.h>
#include <aws/core/utils/HashingUtils.h>
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/StringUtils.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/StringUtils.cpp
index 00c940a9bff..e1deb3f0462 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/StringUtils.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/StringUtils.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/utils/StringUtils.h>
@@ -75,56 +75,56 @@ bool StringUtils::CaselessCompare(const char* value1, const char* value2)
Aws::Vector<Aws::String> StringUtils::Split(const Aws::String& toSplit, char splitOn)
{
- return Split(toSplit, splitOn, SIZE_MAX, SplitOptions::NOT_SET);
+ return Split(toSplit, splitOn, SIZE_MAX, SplitOptions::NOT_SET);
+}
+
+Aws::Vector<Aws::String> StringUtils::Split(const Aws::String& toSplit, char splitOn, SplitOptions option)
+{
+ return Split(toSplit, splitOn, SIZE_MAX, option);
}
-Aws::Vector<Aws::String> StringUtils::Split(const Aws::String& toSplit, char splitOn, SplitOptions option)
-{
- return Split(toSplit, splitOn, SIZE_MAX, option);
-}
-
Aws::Vector<Aws::String> StringUtils::Split(const Aws::String& toSplit, char splitOn, size_t numOfTargetParts)
{
- return Split(toSplit, splitOn, numOfTargetParts, SplitOptions::NOT_SET);
-}
-
-Aws::Vector<Aws::String> StringUtils::Split(const Aws::String& toSplit, char splitOn, size_t numOfTargetParts, SplitOptions option)
-{
+ return Split(toSplit, splitOn, numOfTargetParts, SplitOptions::NOT_SET);
+}
+
+Aws::Vector<Aws::String> StringUtils::Split(const Aws::String& toSplit, char splitOn, size_t numOfTargetParts, SplitOptions option)
+{
Aws::Vector<Aws::String> returnValues;
Aws::StringStream input(toSplit);
Aws::String item;
while(returnValues.size() < numOfTargetParts - 1 && std::getline(input, item, splitOn))
{
- if (!item.empty() || option == SplitOptions::INCLUDE_EMPTY_ENTRIES)
+ if (!item.empty() || option == SplitOptions::INCLUDE_EMPTY_ENTRIES)
{
returnValues.emplace_back(std::move(item));
}
}
- if (std::getline(input, item, static_cast<char>(EOF)))
+ if (std::getline(input, item, static_cast<char>(EOF)))
{
- if (option != SplitOptions::INCLUDE_EMPTY_ENTRIES)
- {
- // Trim all leading delimiters.
- item.erase(item.begin(), std::find_if(item.begin(), item.end(), [splitOn](int ch) { return ch != splitOn; }));
- if (!item.empty())
- {
- returnValues.emplace_back(std::move(item));
- }
- }
- else
- {
- returnValues.emplace_back(std::move(item));
- }
-
+ if (option != SplitOptions::INCLUDE_EMPTY_ENTRIES)
+ {
+ // Trim all leading delimiters.
+ item.erase(item.begin(), std::find_if(item.begin(), item.end(), [splitOn](int ch) { return ch != splitOn; }));
+ if (!item.empty())
+ {
+ returnValues.emplace_back(std::move(item));
+ }
+ }
+ else
+ {
+ returnValues.emplace_back(std::move(item));
+ }
+
+ }
+ // To handle the case when there are trailing delimiters.
+ else if (!toSplit.empty() && toSplit.back() == splitOn && option == SplitOptions::INCLUDE_EMPTY_ENTRIES)
+ {
+ returnValues.emplace_back();
}
- // To handle the case when there are trailing delimiters.
- else if (!toSplit.empty() && toSplit.back() == splitOn && option == SplitOptions::INCLUDE_EMPTY_ENTRIES)
- {
- returnValues.emplace_back();
- }
-
+
return returnValues;
}
@@ -282,20 +282,20 @@ Aws::String StringUtils::URLDecode(const char* safe)
return unescaped;
}
-static bool IsSpace(int ch)
-{
- if (ch < -1 || ch > 255)
- {
- return false;
- }
-
- return ::isspace(ch) != 0;
-}
-
+static bool IsSpace(int ch)
+{
+ if (ch < -1 || ch > 255)
+ {
+ return false;
+ }
+
+ return ::isspace(ch) != 0;
+}
+
Aws::String StringUtils::LTrim(const char* source)
{
Aws::String copy(source);
- copy.erase(copy.begin(), std::find_if(copy.begin(), copy.end(), [](int ch) { return !IsSpace(ch); }));
+ copy.erase(copy.begin(), std::find_if(copy.begin(), copy.end(), [](int ch) { return !IsSpace(ch); }));
return copy;
}
@@ -303,7 +303,7 @@ Aws::String StringUtils::LTrim(const char* source)
Aws::String StringUtils::RTrim(const char* source)
{
Aws::String copy(source);
- copy.erase(std::find_if(copy.rbegin(), copy.rend(), [](int ch) { return !IsSpace(ch); }).base(), copy.end());
+ copy.erase(std::find_if(copy.rbegin(), copy.rend(), [](int ch) { return !IsSpace(ch); }).base(), copy.end());
return copy;
}
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/TempFile.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/TempFile.cpp
index 74f5d0327ec..7bc07266c98 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/TempFile.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/TempFile.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/utils/FileSystemUtils.h>
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/UUID.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/UUID.cpp
index 5fdd6d800af..862f3eacdd2 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/UUID.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/UUID.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/utils/UUID.h>
#include <aws/core/utils/HashingUtils.h>
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/base64/Base64.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/base64/Base64.cpp
index 9ea8afd0de2..2103d6d5a68 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/base64/Base64.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/base64/Base64.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/utils/base64/Base64.h>
#include <cstring>
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/Cipher.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/Cipher.cpp
index 03a518f0733..1c844273f4d 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/Cipher.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/Cipher.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/utils/crypto/Cipher.h>
#include <aws/core/utils/crypto/Factories.h>
@@ -27,31 +27,31 @@ namespace Aws
//swap byte ordering
template<class T>
typename std::enable_if<std::is_unsigned<T>::value, T>::type
- bswap(T i, T j = 0u, std::size_t n = 0u)
+ bswap(T i, T j = 0u, std::size_t n = 0u)
{
return n == sizeof(T) ? j :
bswap<T>(i >> CHAR_BIT, (j << CHAR_BIT) | (i & (T)(unsigned char)(-1)), n + 1);
}
CryptoBuffer IncrementCTRCounter(const CryptoBuffer& counter, uint32_t numberOfBlocks)
- {
+ {
// minium counter size is 12 bytes. This isn't a variable because some compilers
// are stupid and thing that variable is unused.
assert(counter.GetLength() >= 12);
- CryptoBuffer incrementedCounter(counter);
+ CryptoBuffer incrementedCounter(counter);
//get the last 4 bytes and manipulate them as an integer.
- uint32_t* ctrPtr = (uint32_t*)(incrementedCounter.GetUnderlyingData() + incrementedCounter.GetLength() - sizeof(int32_t));
+ uint32_t* ctrPtr = (uint32_t*)(incrementedCounter.GetUnderlyingData() + incrementedCounter.GetLength() - sizeof(int32_t));
if(IS_BIG_ENDIAN)
{
//you likely are not Big Endian, but
//if it's big endian, just go ahead and increment it... done
- *ctrPtr += numberOfBlocks;
+ *ctrPtr += numberOfBlocks;
}
else
{
- //otherwise, swap the byte ordering of the integer we loaded from the buffer (because it is backwards). However, the number of blocks is already properly
+ //otherwise, swap the byte ordering of the integer we loaded from the buffer (because it is backwards). However, the number of blocks is already properly
//aligned. Once we compute the new value, swap it back so that the mirroring operation goes back to the actual buffer.
*ctrPtr = bswap<uint32_t>(bswap<uint32_t>(*ctrPtr) + numberOfBlocks);
}
@@ -65,14 +65,14 @@ namespace Aws
CryptoBuffer bytes(lengthBytes);
size_t lengthToGenerate = ctrMode ? (3 * bytes.GetLength()) / 4 : bytes.GetLength();
-
+
rng->GetBytes(bytes.GetUnderlyingData(), lengthToGenerate);
if(!*rng)
{
AWS_LOGSTREAM_FATAL(LOG_TAG, "Random Number generation failed. Abort all crypto operations.");
assert(false);
- abort();
+ abort();
}
return bytes;
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/ContentCryptoMaterial.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/ContentCryptoMaterial.cpp
index 38542bef76f..3036bd70eb0 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/ContentCryptoMaterial.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/ContentCryptoMaterial.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/utils/crypto/ContentCryptoMaterial.h>
#include <aws/core/utils/crypto/Cipher.h>
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/ContentCryptoScheme.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/ContentCryptoScheme.cpp
index 7bd0fd8d750..f39a75df2c8 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/ContentCryptoScheme.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/ContentCryptoScheme.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/utils/crypto/ContentCryptoScheme.h>
#include <aws/core/utils/HashingUtils.h>
#include <aws/core/utils/EnumParseOverflowContainer.h>
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/CryptoBuf.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/CryptoBuf.cpp
index 9e000ad1b46..2b470976790 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/CryptoBuf.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/CryptoBuf.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/utils/crypto/CryptoBuf.h>
@@ -94,7 +94,7 @@ namespace Aws
if (cryptoBuffer.GetLength() && m_cipher)
{
CryptoBuffer putBackArea(m_putBack);
-
+
m_isBuf = CryptoBuffer({&putBackArea, &cryptoBuffer});
//in the very unlikely case that the cipher had less output than the source stream.
assert(seekTo <= index);
@@ -294,19 +294,19 @@ namespace Aws
if(cryptoBuf.GetLength())
{
//allow mid block decryption. We have to decrypt it, but we don't have to write it to the stream.
- //the assumption here is that tellp() will always be 0 or >= 16 bytes. The block offset should only
+ //the assumption here is that tellp() will always be 0 or >= 16 bytes. The block offset should only
//be the offset of the first block read.
- size_t len = cryptoBuf.GetLength();
- size_t blockOffset = m_stream.tellp() > m_blockOffset ? 0 : m_blockOffset;
- if (len > blockOffset)
- {
- m_stream.write(reinterpret_cast<char*>(cryptoBuf.GetUnderlyingData() + blockOffset), len - blockOffset);
- m_blockOffset = 0;
- }
- else
- {
- m_blockOffset -= static_cast<int16_t>(len);
- }
+ size_t len = cryptoBuf.GetLength();
+ size_t blockOffset = m_stream.tellp() > m_blockOffset ? 0 : m_blockOffset;
+ if (len > blockOffset)
+ {
+ m_stream.write(reinterpret_cast<char*>(cryptoBuf.GetUnderlyingData() + blockOffset), len - blockOffset);
+ m_blockOffset = 0;
+ }
+ else
+ {
+ m_blockOffset -= static_cast<int16_t>(len);
+ }
}
return true;
}
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/CryptoStream.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/CryptoStream.cpp
index 7d46b9d9eac..2d645f74278 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/CryptoStream.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/CryptoStream.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/utils/crypto/CryptoStream.h>
namespace Aws
@@ -44,7 +44,7 @@ namespace Aws
void SymmetricCryptoStream::Finalize()
{
- assert(m_cryptoBuf);
+ assert(m_cryptoBuf);
m_cryptoBuf->Finalize();
}
}
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/EncryptionMaterials.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/EncryptionMaterials.cpp
index 7ea98027ff9..d000c86baa4 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/EncryptionMaterials.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/EncryptionMaterials.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/utils/crypto/EncryptionMaterials.h>
namespace Aws
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/KeyWrapAlgorithm.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/KeyWrapAlgorithm.cpp
index 9b9b5b144fd..b9e098775c9 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/KeyWrapAlgorithm.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/KeyWrapAlgorithm.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/utils/crypto/KeyWrapAlgorithm.h>
#include <aws/core/utils/HashingUtils.h>
#include <aws/core/utils/EnumParseOverflowContainer.h>
@@ -18,9 +18,9 @@ namespace Aws
namespace KeyWrapAlgorithmMapper
{
static const int keyWrapAlgorithm_KMS_HASH = HashingUtils::HashString("kms");
- static const int keyWrapAlgorithm_KMS_CONTEXT_HASH = HashingUtils::HashString("kms+context");
+ static const int keyWrapAlgorithm_KMS_CONTEXT_HASH = HashingUtils::HashString("kms+context");
static const int keyWrapAlgorithm_KeyWrap_HASH = HashingUtils::HashString("AESWrap");
- static const int keyWrapAlgorithm_AES_GCM_HASH = HashingUtils::HashString("AES/GCM");
+ static const int keyWrapAlgorithm_AES_GCM_HASH = HashingUtils::HashString("AES/GCM");
KeyWrapAlgorithm GetKeyWrapAlgorithmForName(const Aws::String& name)
{
@@ -29,17 +29,17 @@ namespace Aws
{
return KeyWrapAlgorithm::KMS;
}
- else if (hashcode == keyWrapAlgorithm_KMS_CONTEXT_HASH)
- {
- return KeyWrapAlgorithm::KMS_CONTEXT;
- }
+ else if (hashcode == keyWrapAlgorithm_KMS_CONTEXT_HASH)
+ {
+ return KeyWrapAlgorithm::KMS_CONTEXT;
+ }
else if (hashcode == keyWrapAlgorithm_KeyWrap_HASH)
{
return KeyWrapAlgorithm::AES_KEY_WRAP;
- }
- else if (hashcode == keyWrapAlgorithm_AES_GCM_HASH)
- {
- return KeyWrapAlgorithm::AES_GCM;
+ }
+ else if (hashcode == keyWrapAlgorithm_AES_GCM_HASH)
+ {
+ return KeyWrapAlgorithm::AES_GCM;
}
assert(0);
return KeyWrapAlgorithm::NONE;
@@ -51,12 +51,12 @@ namespace Aws
{
case KeyWrapAlgorithm::KMS:
return "kms";
- case KeyWrapAlgorithm::KMS_CONTEXT:
- return "kms+context";
+ case KeyWrapAlgorithm::KMS_CONTEXT:
+ return "kms+context";
case KeyWrapAlgorithm::AES_KEY_WRAP:
return "AESWrap";
- case KeyWrapAlgorithm::AES_GCM:
- return "AES/GCM";
+ case KeyWrapAlgorithm::AES_GCM:
+ return "AES/GCM";
default:
assert(0);
}
@@ -65,4 +65,4 @@ namespace Aws
}//namespace KeyWrapAlgorithmMapper
}//namespace Crypto
}//namespace Utils
-}//namespace Aws
+}//namespace Aws
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/MD5.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/MD5.cpp
index 3a26004c795..bf14ace1ad3 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/MD5.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/MD5.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/utils/crypto/MD5.h>
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/Sha256.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/Sha256.cpp
index a9a36e6b3b8..178df00d37a 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/Sha256.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/Sha256.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/utils/crypto/Sha256.h>
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/Sha256HMAC.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/Sha256HMAC.cpp
index a1a362bb9c4..ecc1f065297 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/Sha256HMAC.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/Sha256HMAC.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/utils/crypto/Sha256HMAC.h>
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/factory/Factories.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/factory/Factories.cpp
index 220968cffc1..bff03822418 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/factory/Factories.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/factory/Factories.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/utils/crypto/Factories.h>
@@ -9,11 +9,11 @@
#include <aws/core/utils/crypto/HMAC.h>
#if ENABLE_BCRYPT_ENCRYPTION
- #error #include <aws/core/utils/crypto/bcrypt/CryptoImpl.h>
+ #error #include <aws/core/utils/crypto/bcrypt/CryptoImpl.h>
#elif ENABLE_OPENSSL_ENCRYPTION
#include <aws/core/utils/crypto/openssl/CryptoImpl.h>
#elif ENABLE_COMMONCRYPTO_ENCRYPTION
- #error #include <aws/core/utils/crypto/commoncrypto/CryptoImpl.h>
+ #error #include <aws/core/utils/crypto/commoncrypto/CryptoImpl.h>
#include <aws/core/utils/logging/LogMacros.h>
#else
// if you don't have any encryption you still need to pull in the interface definitions
@@ -29,60 +29,60 @@ using namespace Aws::Utils::Crypto;
static const char *s_allocationTag = "CryptoFactory";
-static std::shared_ptr<HashFactory>& GetMD5Factory()
-{
- static std::shared_ptr<HashFactory> s_MD5Factory(nullptr);
- return s_MD5Factory;
-}
-
-static std::shared_ptr<HashFactory>& GetSha256Factory()
-{
- static std::shared_ptr<HashFactory> s_Sha256Factory(nullptr);
- return s_Sha256Factory;
-}
-
-static std::shared_ptr<HMACFactory>& GetSha256HMACFactory()
-{
- static std::shared_ptr<HMACFactory> s_Sha256HMACFactory(nullptr);
- return s_Sha256HMACFactory;
-}
-
-static std::shared_ptr<SymmetricCipherFactory>& GetAES_CBCFactory()
-{
- static std::shared_ptr<SymmetricCipherFactory> s_AES_CBCFactory(nullptr);
- return s_AES_CBCFactory;
-}
-
-static std::shared_ptr<SymmetricCipherFactory>& GetAES_CTRFactory()
-{
- static std::shared_ptr<SymmetricCipherFactory> s_AES_CTRFactory(nullptr);
- return s_AES_CTRFactory;
-}
-
-static std::shared_ptr<SymmetricCipherFactory>& GetAES_GCMFactory()
-{
- static std::shared_ptr<SymmetricCipherFactory> s_AES_GCMFactory(nullptr);
- return s_AES_GCMFactory;
-}
-
-static std::shared_ptr<SymmetricCipherFactory>& GetAES_KeyWrapFactory()
-{
- static std::shared_ptr<SymmetricCipherFactory> s_AES_KeyWrapFactory(nullptr);
- return s_AES_KeyWrapFactory;
-}
-
-static std::shared_ptr<SecureRandomFactory>& GetSecureRandomFactory()
-{
- static std::shared_ptr<SecureRandomFactory> s_SecureRandomFactory(nullptr);
- return s_SecureRandomFactory;
-}
-
-static std::shared_ptr<SecureRandomBytes>& GetSecureRandom()
-{
- static std::shared_ptr<SecureRandomBytes> s_SecureRandom(nullptr);
- return s_SecureRandom;
-}
-
+static std::shared_ptr<HashFactory>& GetMD5Factory()
+{
+ static std::shared_ptr<HashFactory> s_MD5Factory(nullptr);
+ return s_MD5Factory;
+}
+
+static std::shared_ptr<HashFactory>& GetSha256Factory()
+{
+ static std::shared_ptr<HashFactory> s_Sha256Factory(nullptr);
+ return s_Sha256Factory;
+}
+
+static std::shared_ptr<HMACFactory>& GetSha256HMACFactory()
+{
+ static std::shared_ptr<HMACFactory> s_Sha256HMACFactory(nullptr);
+ return s_Sha256HMACFactory;
+}
+
+static std::shared_ptr<SymmetricCipherFactory>& GetAES_CBCFactory()
+{
+ static std::shared_ptr<SymmetricCipherFactory> s_AES_CBCFactory(nullptr);
+ return s_AES_CBCFactory;
+}
+
+static std::shared_ptr<SymmetricCipherFactory>& GetAES_CTRFactory()
+{
+ static std::shared_ptr<SymmetricCipherFactory> s_AES_CTRFactory(nullptr);
+ return s_AES_CTRFactory;
+}
+
+static std::shared_ptr<SymmetricCipherFactory>& GetAES_GCMFactory()
+{
+ static std::shared_ptr<SymmetricCipherFactory> s_AES_GCMFactory(nullptr);
+ return s_AES_GCMFactory;
+}
+
+static std::shared_ptr<SymmetricCipherFactory>& GetAES_KeyWrapFactory()
+{
+ static std::shared_ptr<SymmetricCipherFactory> s_AES_KeyWrapFactory(nullptr);
+ return s_AES_KeyWrapFactory;
+}
+
+static std::shared_ptr<SecureRandomFactory>& GetSecureRandomFactory()
+{
+ static std::shared_ptr<SecureRandomFactory> s_SecureRandomFactory(nullptr);
+ return s_SecureRandomFactory;
+}
+
+static std::shared_ptr<SecureRandomBytes>& GetSecureRandom()
+{
+ static std::shared_ptr<SecureRandomBytes> s_SecureRandom(nullptr);
+ return s_SecureRandom;
+}
+
static bool s_InitCleanupOpenSSLFlag(false);
class DefaultMD5Factory : public HashFactory
@@ -240,7 +240,7 @@ public:
/**
* Factory method. Returns cipher implementation. See the SymmetricCipher class for more details.
*/
- std::shared_ptr<SymmetricCipher> CreateImplementation(const CryptoBuffer& key, const CryptoBuffer& iv, const CryptoBuffer&, const CryptoBuffer&) const override
+ std::shared_ptr<SymmetricCipher> CreateImplementation(const CryptoBuffer& key, const CryptoBuffer& iv, const CryptoBuffer&, const CryptoBuffer&) const override
{
#if ENABLE_BCRYPT_ENCRYPTION
return Aws::MakeShared<AES_CBC_Cipher_BCrypt>(s_allocationTag, key, iv);
@@ -258,7 +258,7 @@ public:
/**
* Factory method. Returns cipher implementation. See the SymmetricCipher class for more details.
*/
- std::shared_ptr<SymmetricCipher> CreateImplementation(CryptoBuffer&& key, CryptoBuffer&& iv, CryptoBuffer&&, CryptoBuffer&&) const override
+ std::shared_ptr<SymmetricCipher> CreateImplementation(CryptoBuffer&& key, CryptoBuffer&& iv, CryptoBuffer&&, CryptoBuffer&&) const override
{
#if ENABLE_BCRYPT_ENCRYPTION
return Aws::MakeShared<AES_CBC_Cipher_BCrypt>(s_allocationTag, key, iv);
@@ -322,7 +322,7 @@ public:
/**
* Factory method. Returns cipher implementation. See the SymmetricCipher class for more details.
*/
- std::shared_ptr<SymmetricCipher> CreateImplementation(const CryptoBuffer& key, const CryptoBuffer& iv, const CryptoBuffer&, const CryptoBuffer&) const override
+ std::shared_ptr<SymmetricCipher> CreateImplementation(const CryptoBuffer& key, const CryptoBuffer& iv, const CryptoBuffer&, const CryptoBuffer&) const override
{
#if ENABLE_BCRYPT_ENCRYPTION
return Aws::MakeShared<AES_CTR_Cipher_BCrypt>(s_allocationTag, key, iv);
@@ -340,7 +340,7 @@ public:
/**
* Factory method. Returns cipher implementation. See the SymmetricCipher class for more details.
*/
- std::shared_ptr<SymmetricCipher> CreateImplementation(CryptoBuffer&& key, CryptoBuffer&& iv, CryptoBuffer&&, CryptoBuffer&&) const override
+ std::shared_ptr<SymmetricCipher> CreateImplementation(CryptoBuffer&& key, CryptoBuffer&& iv, CryptoBuffer&&, CryptoBuffer&&) const override
{
#if ENABLE_BCRYPT_ENCRYPTION
return Aws::MakeShared<AES_CTR_Cipher_BCrypt>(s_allocationTag, key, iv);
@@ -395,64 +395,64 @@ public:
#elif ENABLE_OPENSSL_ENCRYPTION
return Aws::MakeShared<AES_GCM_Cipher_OpenSSL>(s_allocationTag, key);
#elif ENABLE_COMMONCRYPTO_ENCRYPTION
- return Aws::MakeShared<AES_GCM_Cipher_CommonCrypto>(s_allocationTag, key);
-#else
+ return Aws::MakeShared<AES_GCM_Cipher_CommonCrypto>(s_allocationTag, key);
+#else
AWS_UNREFERENCED_PARAM(key);
-
+
return nullptr;
-#endif
- }
-
- std::shared_ptr<SymmetricCipher> CreateImplementation(const CryptoBuffer& key, const CryptoBuffer* aad) const override
- {
-#if ENABLE_BCRYPT_ENCRYPTION
- return Aws::MakeShared<AES_GCM_Cipher_BCrypt>(s_allocationTag, key, aad);
-#elif ENABLE_OPENSSL_ENCRYPTION
- return Aws::MakeShared<AES_GCM_Cipher_OpenSSL>(s_allocationTag, key, aad);
-#elif ENABLE_COMMONCRYPTO_ENCRYPTION
- return Aws::MakeShared<AES_GCM_Cipher_CommonCrypto>(s_allocationTag, key, aad);
+#endif
+ }
+
+ std::shared_ptr<SymmetricCipher> CreateImplementation(const CryptoBuffer& key, const CryptoBuffer* aad) const override
+ {
+#if ENABLE_BCRYPT_ENCRYPTION
+ return Aws::MakeShared<AES_GCM_Cipher_BCrypt>(s_allocationTag, key, aad);
+#elif ENABLE_OPENSSL_ENCRYPTION
+ return Aws::MakeShared<AES_GCM_Cipher_OpenSSL>(s_allocationTag, key, aad);
+#elif ENABLE_COMMONCRYPTO_ENCRYPTION
+ return Aws::MakeShared<AES_GCM_Cipher_CommonCrypto>(s_allocationTag, key, aad);
#else
AWS_UNREFERENCED_PARAM(key);
- AWS_UNREFERENCED_PARAM(aad);
+ AWS_UNREFERENCED_PARAM(aad);
return nullptr;
#endif
}
-
+
/**
* Factory method. Returns cipher implementation. See the SymmetricCipher class for more details.
*/
- std::shared_ptr<SymmetricCipher> CreateImplementation(const CryptoBuffer& key, const CryptoBuffer& iv, const CryptoBuffer& tag, const CryptoBuffer& aad) const override
+ std::shared_ptr<SymmetricCipher> CreateImplementation(const CryptoBuffer& key, const CryptoBuffer& iv, const CryptoBuffer& tag, const CryptoBuffer& aad) const override
{
#if ENABLE_BCRYPT_ENCRYPTION
- return Aws::MakeShared<AES_GCM_Cipher_BCrypt>(s_allocationTag, key, iv, tag, aad);
+ return Aws::MakeShared<AES_GCM_Cipher_BCrypt>(s_allocationTag, key, iv, tag, aad);
#elif ENABLE_OPENSSL_ENCRYPTION
- return Aws::MakeShared<AES_GCM_Cipher_OpenSSL>(s_allocationTag, key, iv, tag, aad);
+ return Aws::MakeShared<AES_GCM_Cipher_OpenSSL>(s_allocationTag, key, iv, tag, aad);
#elif ENABLE_COMMONCRYPTO_ENCRYPTION
- return Aws::MakeShared<AES_GCM_Cipher_CommonCrypto>(s_allocationTag, key, iv, tag, aad);
+ return Aws::MakeShared<AES_GCM_Cipher_CommonCrypto>(s_allocationTag, key, iv, tag, aad);
#else
AWS_UNREFERENCED_PARAM(key);
AWS_UNREFERENCED_PARAM(iv);
AWS_UNREFERENCED_PARAM(tag);
- AWS_UNREFERENCED_PARAM(aad);
+ AWS_UNREFERENCED_PARAM(aad);
return nullptr;
#endif
}
/**
* Factory method. Returns cipher implementation. See the SymmetricCipher class for more details.
*/
- std::shared_ptr<SymmetricCipher> CreateImplementation(CryptoBuffer&& key, CryptoBuffer&& iv, CryptoBuffer&& tag, CryptoBuffer&& aad) const override
+ std::shared_ptr<SymmetricCipher> CreateImplementation(CryptoBuffer&& key, CryptoBuffer&& iv, CryptoBuffer&& tag, CryptoBuffer&& aad) const override
{
#if ENABLE_BCRYPT_ENCRYPTION
- return Aws::MakeShared<AES_GCM_Cipher_BCrypt>(s_allocationTag, std::move(key), std::move(iv), std::move(tag), std::move(aad));
+ return Aws::MakeShared<AES_GCM_Cipher_BCrypt>(s_allocationTag, std::move(key), std::move(iv), std::move(tag), std::move(aad));
#elif ENABLE_OPENSSL_ENCRYPTION
- return Aws::MakeShared<AES_GCM_Cipher_OpenSSL>(s_allocationTag, std::move(key), std::move(iv), std::move(tag), std::move(aad));
+ return Aws::MakeShared<AES_GCM_Cipher_OpenSSL>(s_allocationTag, std::move(key), std::move(iv), std::move(tag), std::move(aad));
#elif ENABLE_COMMONCRYPTO_ENCRYPTION
- return Aws::MakeShared<AES_GCM_Cipher_CommonCrypto>(s_allocationTag, std::move(key), std::move(iv), std::move(tag), std::move(aad));
+ return Aws::MakeShared<AES_GCM_Cipher_CommonCrypto>(s_allocationTag, std::move(key), std::move(iv), std::move(tag), std::move(aad));
#else
AWS_UNREFERENCED_PARAM(key);
AWS_UNREFERENCED_PARAM(iv);
AWS_UNREFERENCED_PARAM(tag);
- AWS_UNREFERENCED_PARAM(aad);
+ AWS_UNREFERENCED_PARAM(aad);
return nullptr;
#endif
}
@@ -505,7 +505,7 @@ public:
/**
* Factory method. Returns cipher implementation. See the SymmetricCipher class for more details.
*/
- std::shared_ptr<SymmetricCipher> CreateImplementation(const CryptoBuffer& key, const CryptoBuffer& iv, const CryptoBuffer& tag, const CryptoBuffer&) const override
+ std::shared_ptr<SymmetricCipher> CreateImplementation(const CryptoBuffer& key, const CryptoBuffer& iv, const CryptoBuffer& tag, const CryptoBuffer&) const override
{
AWS_UNREFERENCED_PARAM(key);
AWS_UNREFERENCED_PARAM(iv);
@@ -515,7 +515,7 @@ public:
/**
* Factory method. Returns cipher implementation. See the SymmetricCipher class for more details.
*/
- std::shared_ptr<SymmetricCipher> CreateImplementation(CryptoBuffer&& key, CryptoBuffer&& iv, CryptoBuffer&& tag, CryptoBuffer&&) const override
+ std::shared_ptr<SymmetricCipher> CreateImplementation(CryptoBuffer&& key, CryptoBuffer&& iv, CryptoBuffer&& tag, CryptoBuffer&&) const override
{
AWS_UNREFERENCED_PARAM(key);
AWS_UNREFERENCED_PARAM(iv);
@@ -606,190 +606,190 @@ void Aws::Utils::Crypto::SetInitCleanupOpenSSLFlag(bool initCleanupFlag)
void Aws::Utils::Crypto::InitCrypto()
{
- if(GetMD5Factory())
+ if(GetMD5Factory())
{
- GetMD5Factory()->InitStaticState();
+ GetMD5Factory()->InitStaticState();
}
else
{
- GetMD5Factory() = Aws::MakeShared<DefaultMD5Factory>(s_allocationTag);
- GetMD5Factory()->InitStaticState();
+ GetMD5Factory() = Aws::MakeShared<DefaultMD5Factory>(s_allocationTag);
+ GetMD5Factory()->InitStaticState();
}
- if(GetSha256Factory())
+ if(GetSha256Factory())
{
- GetSha256Factory()->InitStaticState();
+ GetSha256Factory()->InitStaticState();
}
else
{
- GetSha256Factory() = Aws::MakeShared<DefaultSHA256Factory>(s_allocationTag);
- GetSha256Factory()->InitStaticState();
+ GetSha256Factory() = Aws::MakeShared<DefaultSHA256Factory>(s_allocationTag);
+ GetSha256Factory()->InitStaticState();
}
- if(GetSha256HMACFactory())
+ if(GetSha256HMACFactory())
{
- GetSha256HMACFactory()->InitStaticState();
+ GetSha256HMACFactory()->InitStaticState();
}
else
{
- GetSha256HMACFactory() = Aws::MakeShared<DefaultSHA256HmacFactory>(s_allocationTag);
- GetSha256HMACFactory()->InitStaticState();
+ GetSha256HMACFactory() = Aws::MakeShared<DefaultSHA256HmacFactory>(s_allocationTag);
+ GetSha256HMACFactory()->InitStaticState();
}
- if(GetAES_CBCFactory())
+ if(GetAES_CBCFactory())
{
- GetAES_CBCFactory()->InitStaticState();
+ GetAES_CBCFactory()->InitStaticState();
}
else
{
- GetAES_CBCFactory() = Aws::MakeShared<DefaultAES_CBCFactory>(s_allocationTag);
- GetAES_CBCFactory()->InitStaticState();
+ GetAES_CBCFactory() = Aws::MakeShared<DefaultAES_CBCFactory>(s_allocationTag);
+ GetAES_CBCFactory()->InitStaticState();
}
- if(GetAES_CTRFactory())
+ if(GetAES_CTRFactory())
{
- GetAES_CTRFactory()->InitStaticState();
+ GetAES_CTRFactory()->InitStaticState();
}
else
{
- GetAES_CTRFactory() = Aws::MakeShared<DefaultAES_CTRFactory>(s_allocationTag);
- GetAES_CTRFactory()->InitStaticState();
+ GetAES_CTRFactory() = Aws::MakeShared<DefaultAES_CTRFactory>(s_allocationTag);
+ GetAES_CTRFactory()->InitStaticState();
}
- if(GetAES_GCMFactory())
+ if(GetAES_GCMFactory())
{
- GetAES_GCMFactory()->InitStaticState();
+ GetAES_GCMFactory()->InitStaticState();
}
else
{
- GetAES_GCMFactory() = Aws::MakeShared<DefaultAES_GCMFactory>(s_allocationTag);
- GetAES_GCMFactory()->InitStaticState();
+ GetAES_GCMFactory() = Aws::MakeShared<DefaultAES_GCMFactory>(s_allocationTag);
+ GetAES_GCMFactory()->InitStaticState();
}
- if (!GetAES_KeyWrapFactory())
+ if (!GetAES_KeyWrapFactory())
{
- GetAES_KeyWrapFactory() = Aws::MakeShared<DefaultAES_KeyWrapFactory>(s_allocationTag);
+ GetAES_KeyWrapFactory() = Aws::MakeShared<DefaultAES_KeyWrapFactory>(s_allocationTag);
}
- GetAES_KeyWrapFactory()->InitStaticState();
+ GetAES_KeyWrapFactory()->InitStaticState();
- if(GetSecureRandomFactory())
+ if(GetSecureRandomFactory())
{
- GetSecureRandomFactory()->InitStaticState();
+ GetSecureRandomFactory()->InitStaticState();
}
else
{
- GetSecureRandomFactory() = Aws::MakeShared<DefaultSecureRandFactory>(s_allocationTag);
- GetSecureRandomFactory()->InitStaticState();
- }
-
- GetSecureRandom() = GetSecureRandomFactory()->CreateImplementation();
+ GetSecureRandomFactory() = Aws::MakeShared<DefaultSecureRandFactory>(s_allocationTag);
+ GetSecureRandomFactory()->InitStaticState();
+ }
+
+ GetSecureRandom() = GetSecureRandomFactory()->CreateImplementation();
}
void Aws::Utils::Crypto::CleanupCrypto()
{
- if(GetMD5Factory())
+ if(GetMD5Factory())
{
- GetMD5Factory()->CleanupStaticState();
- GetMD5Factory() = nullptr;
+ GetMD5Factory()->CleanupStaticState();
+ GetMD5Factory() = nullptr;
}
- if(GetSha256Factory())
+ if(GetSha256Factory())
{
- GetSha256Factory()->CleanupStaticState();
- GetSha256Factory() = nullptr;
+ GetSha256Factory()->CleanupStaticState();
+ GetSha256Factory() = nullptr;
}
- if(GetSha256HMACFactory())
+ if(GetSha256HMACFactory())
{
- GetSha256HMACFactory()->CleanupStaticState();
- GetSha256HMACFactory() = nullptr;
+ GetSha256HMACFactory()->CleanupStaticState();
+ GetSha256HMACFactory() = nullptr;
}
- if(GetAES_CBCFactory())
+ if(GetAES_CBCFactory())
{
- GetAES_CBCFactory()->CleanupStaticState();
- GetAES_CBCFactory() = nullptr;
+ GetAES_CBCFactory()->CleanupStaticState();
+ GetAES_CBCFactory() = nullptr;
}
- if(GetAES_CTRFactory())
+ if(GetAES_CTRFactory())
{
- GetAES_CTRFactory()->CleanupStaticState();
- GetAES_CTRFactory() = nullptr;
+ GetAES_CTRFactory()->CleanupStaticState();
+ GetAES_CTRFactory() = nullptr;
}
- if(GetAES_GCMFactory())
+ if(GetAES_GCMFactory())
{
- GetAES_GCMFactory()->CleanupStaticState();
- GetAES_GCMFactory() = nullptr;
+ GetAES_GCMFactory()->CleanupStaticState();
+ GetAES_GCMFactory() = nullptr;
}
- if(GetAES_KeyWrapFactory())
+ if(GetAES_KeyWrapFactory())
{
- GetAES_KeyWrapFactory()->CleanupStaticState();
- GetAES_KeyWrapFactory() = nullptr;
+ GetAES_KeyWrapFactory()->CleanupStaticState();
+ GetAES_KeyWrapFactory() = nullptr;
}
- if(GetSecureRandomFactory())
+ if(GetSecureRandomFactory())
{
- GetSecureRandom() = nullptr;
- GetSecureRandomFactory()->CleanupStaticState();
- GetSecureRandomFactory() = nullptr;
- }
+ GetSecureRandom() = nullptr;
+ GetSecureRandomFactory()->CleanupStaticState();
+ GetSecureRandomFactory() = nullptr;
+ }
}
void Aws::Utils::Crypto::SetMD5Factory(const std::shared_ptr<HashFactory>& factory)
{
- GetMD5Factory() = factory;
+ GetMD5Factory() = factory;
}
void Aws::Utils::Crypto::SetSha256Factory(const std::shared_ptr<HashFactory>& factory)
{
- GetSha256Factory() = factory;
+ GetSha256Factory() = factory;
}
void Aws::Utils::Crypto::SetSha256HMACFactory(const std::shared_ptr<HMACFactory>& factory)
{
- GetSha256HMACFactory() = factory;
+ GetSha256HMACFactory() = factory;
}
void Aws::Utils::Crypto::SetAES_CBCFactory(const std::shared_ptr<SymmetricCipherFactory>& factory)
{
- GetAES_CBCFactory() = factory;
+ GetAES_CBCFactory() = factory;
}
void Aws::Utils::Crypto::SetAES_CTRFactory(const std::shared_ptr<SymmetricCipherFactory>& factory)
{
- GetAES_CTRFactory() = factory;
+ GetAES_CTRFactory() = factory;
}
void Aws::Utils::Crypto::SetAES_GCMFactory(const std::shared_ptr<SymmetricCipherFactory>& factory)
{
- GetAES_GCMFactory() = factory;
+ GetAES_GCMFactory() = factory;
}
void Aws::Utils::Crypto::SetAES_KeyWrapFactory(const std::shared_ptr<SymmetricCipherFactory>& factory)
{
- GetAES_KeyWrapFactory() = factory;
+ GetAES_KeyWrapFactory() = factory;
}
void Aws::Utils::Crypto::SetSecureRandomFactory(const std::shared_ptr<SecureRandomFactory>& factory)
{
- GetSecureRandomFactory() = factory;
+ GetSecureRandomFactory() = factory;
}
std::shared_ptr<Hash> Aws::Utils::Crypto::CreateMD5Implementation()
{
- return GetMD5Factory()->CreateImplementation();
+ return GetMD5Factory()->CreateImplementation();
}
std::shared_ptr<Hash> Aws::Utils::Crypto::CreateSha256Implementation()
{
- return GetSha256Factory()->CreateImplementation();
+ return GetSha256Factory()->CreateImplementation();
}
std::shared_ptr<Aws::Utils::Crypto::HMAC> Aws::Utils::Crypto::CreateSha256HMACImplementation()
{
- return GetSha256HMACFactory()->CreateImplementation();
+ return GetSha256HMACFactory()->CreateImplementation();
}
#ifdef _WIN32
@@ -802,7 +802,7 @@ std::shared_ptr<SymmetricCipher> Aws::Utils::Crypto::CreateAES_CBCImplementation
#ifdef NO_SYMMETRIC_ENCRYPTION
return nullptr;
#endif
- return GetAES_CBCFactory()->CreateImplementation(key);
+ return GetAES_CBCFactory()->CreateImplementation(key);
}
std::shared_ptr<SymmetricCipher> Aws::Utils::Crypto::CreateAES_CBCImplementation(const CryptoBuffer& key, const CryptoBuffer& iv)
@@ -810,7 +810,7 @@ std::shared_ptr<SymmetricCipher> Aws::Utils::Crypto::CreateAES_CBCImplementation
#ifdef NO_SYMMETRIC_ENCRYPTION
return nullptr;
#endif
- return GetAES_CBCFactory()->CreateImplementation(key, iv);
+ return GetAES_CBCFactory()->CreateImplementation(key, iv);
}
std::shared_ptr<SymmetricCipher> Aws::Utils::Crypto::CreateAES_CBCImplementation(CryptoBuffer&& key, CryptoBuffer&& iv)
@@ -818,7 +818,7 @@ std::shared_ptr<SymmetricCipher> Aws::Utils::Crypto::CreateAES_CBCImplementation
#ifdef NO_SYMMETRIC_ENCRYPTION
return nullptr;
#endif
- return GetAES_CBCFactory()->CreateImplementation(std::move(key), std::move(iv));
+ return GetAES_CBCFactory()->CreateImplementation(std::move(key), std::move(iv));
}
std::shared_ptr<SymmetricCipher> Aws::Utils::Crypto::CreateAES_CTRImplementation(const CryptoBuffer& key)
@@ -826,7 +826,7 @@ std::shared_ptr<SymmetricCipher> Aws::Utils::Crypto::CreateAES_CTRImplementation
#ifdef NO_SYMMETRIC_ENCRYPTION
return nullptr;
#endif
- return GetAES_CTRFactory()->CreateImplementation(key);
+ return GetAES_CTRFactory()->CreateImplementation(key);
}
std::shared_ptr<SymmetricCipher> Aws::Utils::Crypto::CreateAES_CTRImplementation(const CryptoBuffer& key, const CryptoBuffer& iv)
@@ -834,7 +834,7 @@ std::shared_ptr<SymmetricCipher> Aws::Utils::Crypto::CreateAES_CTRImplementation
#ifdef NO_SYMMETRIC_ENCRYPTION
return nullptr;
#endif
- return GetAES_CTRFactory()->CreateImplementation(key, iv);
+ return GetAES_CTRFactory()->CreateImplementation(key, iv);
}
std::shared_ptr<SymmetricCipher> Aws::Utils::Crypto::CreateAES_CTRImplementation(CryptoBuffer&& key, CryptoBuffer&& iv)
@@ -842,7 +842,7 @@ std::shared_ptr<SymmetricCipher> Aws::Utils::Crypto::CreateAES_CTRImplementation
#ifdef NO_SYMMETRIC_ENCRYPTION
return nullptr;
#endif
- return GetAES_CTRFactory()->CreateImplementation(std::move(key), std::move(iv));
+ return GetAES_CTRFactory()->CreateImplementation(std::move(key), std::move(iv));
}
std::shared_ptr<SymmetricCipher> Aws::Utils::Crypto::CreateAES_GCMImplementation(const CryptoBuffer& key)
@@ -850,39 +850,39 @@ std::shared_ptr<SymmetricCipher> Aws::Utils::Crypto::CreateAES_GCMImplementation
#ifdef NO_SYMMETRIC_ENCRYPTION
return nullptr;
#endif
- return GetAES_GCMFactory()->CreateImplementation(key);
+ return GetAES_GCMFactory()->CreateImplementation(key);
+}
+
+std::shared_ptr<SymmetricCipher> Aws::Utils::Crypto::CreateAES_GCMImplementation(const CryptoBuffer& key, const CryptoBuffer* aad)
+{
+#ifdef NO_SYMMETRIC_ENCRYPTION
+ return nullptr;
+#endif
+ return GetAES_GCMFactory()->CreateImplementation(key, aad);
}
-std::shared_ptr<SymmetricCipher> Aws::Utils::Crypto::CreateAES_GCMImplementation(const CryptoBuffer& key, const CryptoBuffer* aad)
+std::shared_ptr<SymmetricCipher> Aws::Utils::Crypto::CreateAES_GCMImplementation(const CryptoBuffer& key, const CryptoBuffer& iv, const CryptoBuffer& tag, const CryptoBuffer& aad)
{
#ifdef NO_SYMMETRIC_ENCRYPTION
return nullptr;
#endif
- return GetAES_GCMFactory()->CreateImplementation(key, aad);
+ return GetAES_GCMFactory()->CreateImplementation(key, iv, tag, aad);
}
-std::shared_ptr<SymmetricCipher> Aws::Utils::Crypto::CreateAES_GCMImplementation(const CryptoBuffer& key, const CryptoBuffer& iv, const CryptoBuffer& tag, const CryptoBuffer& aad)
+std::shared_ptr<SymmetricCipher> Aws::Utils::Crypto::CreateAES_GCMImplementation(CryptoBuffer&& key, CryptoBuffer&& iv, CryptoBuffer&& tag, CryptoBuffer&& aad)
{
#ifdef NO_SYMMETRIC_ENCRYPTION
return nullptr;
#endif
- return GetAES_GCMFactory()->CreateImplementation(key, iv, tag, aad);
+ return GetAES_GCMFactory()->CreateImplementation(std::move(key), std::move(iv), std::move(tag), std::move(aad));
}
-std::shared_ptr<SymmetricCipher> Aws::Utils::Crypto::CreateAES_GCMImplementation(CryptoBuffer&& key, CryptoBuffer&& iv, CryptoBuffer&& tag, CryptoBuffer&& aad)
-{
-#ifdef NO_SYMMETRIC_ENCRYPTION
- return nullptr;
-#endif
- return GetAES_GCMFactory()->CreateImplementation(std::move(key), std::move(iv), std::move(tag), std::move(aad));
-}
-
std::shared_ptr<SymmetricCipher> Aws::Utils::Crypto::CreateAES_KeyWrapImplementation(const CryptoBuffer& key)
{
#ifdef NO_SYMMETRIC_ENCRYPTION
return nullptr;
#endif
- return GetAES_KeyWrapFactory()->CreateImplementation(key);
+ return GetAES_KeyWrapFactory()->CreateImplementation(key);
}
#ifdef _WIN32
@@ -891,5 +891,5 @@ std::shared_ptr<SymmetricCipher> Aws::Utils::Crypto::CreateAES_KeyWrapImplementa
std::shared_ptr<SecureRandomBytes> Aws::Utils::Crypto::CreateSecureRandomBytesImplementation()
{
- return GetSecureRandom();
+ return GetSecureRandom();
}
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/openssl/CryptoImpl.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/openssl/CryptoImpl.cpp
index b76930d1fca..911838864b3 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/openssl/CryptoImpl.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/openssl/CryptoImpl.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <cstring>
@@ -9,21 +9,21 @@
#include <aws/core/utils/crypto/openssl/CryptoImpl.h>
#include <aws/core/utils/Outcome.h>
#include <openssl/md5.h>
-
-#ifdef OPENSSL_IS_BORINGSSL
-#ifdef _MSC_VER
-AWS_SUPPRESS_WARNING_PUSH(4201)
-#else
-AWS_SUPPRESS_WARNING_PUSH("-Wpedantic")
-#endif
-#endif
-
+
+#ifdef OPENSSL_IS_BORINGSSL
+#ifdef _MSC_VER
+AWS_SUPPRESS_WARNING_PUSH(4201)
+#else
+AWS_SUPPRESS_WARNING_PUSH("-Wpedantic")
+#endif
+#endif
+
#include <openssl/sha.h>
-
-#ifdef OPENSSL_IS_BORINGSSL
-AWS_SUPPRESS_WARNING_POP
-#endif
-
+
+#ifdef OPENSSL_IS_BORINGSSL
+AWS_SUPPRESS_WARNING_POP
+#endif
+
#include <openssl/err.h>
#include <aws/core/utils/logging/LogMacros.h>
#include <thread>
@@ -41,7 +41,7 @@ namespace Aws
{
/**
* openssl with OPENSSL_VERSION_NUMBER < 0x10100003L made data type details unavailable
- * libressl use openssl with data type details available, but mandatorily set
+ * libressl use openssl with data type details available, but mandatorily set
* OPENSSL_VERSION_NUMBER = 0x20000000L, insane!
* https://github.com/aws/aws-sdk-cpp/pull/507/commits/2c99f1fe0c4b4683280caeb161538d4724d6a179
*/
@@ -60,14 +60,14 @@ namespace Aws
void init_static_state()
{
-#if OPENSSL_VERSION_LESS_1_1 || defined(OPENSSL_IS_BORINGSSL)
- ERR_load_crypto_strings();
-#else
- OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS /*options*/ ,NULL /* OpenSSL init settings*/ );
-#endif
-#if !defined(OPENSSL_IS_BORINGSSL)
+#if OPENSSL_VERSION_LESS_1_1 || defined(OPENSSL_IS_BORINGSSL)
+ ERR_load_crypto_strings();
+#else
+ OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS /*options*/ ,NULL /* OpenSSL init settings*/ );
+#endif
+#if !defined(OPENSSL_IS_BORINGSSL)
OPENSSL_add_all_algorithms_noconf();
-#endif
+#endif
#if OPENSSL_VERSION_LESS_1_1
if (!CRYPTO_get_locking_callback())
{
@@ -122,22 +122,22 @@ namespace Aws
#endif
}
- static const char* OPENSSL_LOG_TAG = "OpenSSLCipher";
-
+ static const char* OPENSSL_LOG_TAG = "OpenSSLCipher";
+
void SecureRandomBytes_OpenSSLImpl::GetBytes(unsigned char* buffer, size_t bufferSize)
{
- if (!bufferSize)
- {
- return;
- }
-
- if (!buffer)
- {
- AWS_LOGSTREAM_FATAL(OPENSSL_LOG_TAG, "Secure Random Bytes generator can't generate: " << bufferSize << " bytes with nullptr buffer.");
- assert(buffer);
- return;
- }
-
+ if (!bufferSize)
+ {
+ return;
+ }
+
+ if (!buffer)
+ {
+ AWS_LOGSTREAM_FATAL(OPENSSL_LOG_TAG, "Secure Random Bytes generator can't generate: " << bufferSize << " bytes with nullptr buffer.");
+ assert(buffer);
+ return;
+ }
+
int success = RAND_bytes(buffer, static_cast<int>(bufferSize));
if (success != 1)
{
@@ -145,22 +145,22 @@ namespace Aws
}
}
- class OpensslCtxRAIIGuard
+ class OpensslCtxRAIIGuard
{
- public:
- OpensslCtxRAIIGuard()
+ public:
+ OpensslCtxRAIIGuard()
{
m_ctx = EVP_MD_CTX_create();
assert(m_ctx != nullptr);
}
- ~OpensslCtxRAIIGuard()
+ ~OpensslCtxRAIIGuard()
{
EVP_MD_CTX_destroy(m_ctx);
m_ctx = nullptr;
}
- EVP_MD_CTX* getResource()
+ EVP_MD_CTX* getResource()
{
return m_ctx;
}
@@ -172,9 +172,9 @@ namespace Aws
{
OpensslCtxRAIIGuard guard;
auto ctx = guard.getResource();
-#if !defined(OPENSSL_IS_BORINGSSL)
+#if !defined(OPENSSL_IS_BORINGSSL)
EVP_MD_CTX_set_flags(ctx, EVP_MD_CTX_FLAG_NON_FIPS_ALLOW);
-#endif
+#endif
EVP_DigestInit_ex(ctx, EVP_md5(), nullptr);
EVP_DigestUpdate(ctx, str.c_str(), str.size());
@@ -188,9 +188,9 @@ namespace Aws
{
OpensslCtxRAIIGuard guard;
auto ctx = guard.getResource();
-#if !defined(OPENSSL_IS_BORINGSSL)
+#if !defined(OPENSSL_IS_BORINGSSL)
EVP_MD_CTX_set_flags(ctx, EVP_MD_CTX_FLAG_NON_FIPS_ALLOW);
-#endif
+#endif
EVP_DigestInit_ex(ctx, EVP_md5(), nullptr);
auto currentPos = stream.tellg();
@@ -304,7 +304,7 @@ namespace Aws
unsigned int length = SHA256_DIGEST_LENGTH;
ByteBuffer digest(length);
memset(digest.GetUnderlyingData(), 0, length);
-
+
HMACRAIIGuard guard;
HMAC_CTX* m_ctx = guard.getResource();
@@ -381,11 +381,11 @@ namespace Aws
void OpenSSLCipher::Init()
{
- if (m_failure)
- {
- return;
- }
-
+ if (m_failure)
+ {
+ return;
+ }
+
if (!m_encryptor_ctx)
{
// EVP_CIPHER_CTX_init() will be called inside EVP_CIPHER_CTX_new().
@@ -406,7 +406,7 @@ namespace Aws
{ // _init is the same as _reset after openssl 1.1
EVP_CIPHER_CTX_init(m_decryptor_ctx);
}
- m_emptyPlaintext = false;
+ m_emptyPlaintext = false;
}
CryptoBuffer OpenSSLCipher::EncryptBuffer(const CryptoBuffer& unEncryptedData)
@@ -440,7 +440,7 @@ namespace Aws
{
if (m_failure)
{
- AWS_LOGSTREAM_FATAL(OPENSSL_LOG_TAG, "Cipher not properly initialized for encryption finalization. Aborting");
+ AWS_LOGSTREAM_FATAL(OPENSSL_LOG_TAG, "Cipher not properly initialized for encryption finalization. Aborting");
return CryptoBuffer();
}
@@ -475,10 +475,10 @@ namespace Aws
return CryptoBuffer();
}
- if (lengthWritten == 0)
- {
- m_emptyPlaintext = true;
- }
+ if (lengthWritten == 0)
+ {
+ m_emptyPlaintext = true;
+ }
if (static_cast<size_t>(lengthWritten) < decryptedText.GetLength())
{
return CryptoBuffer(decryptedText.GetUnderlyingData(), static_cast<size_t>(lengthWritten));
@@ -490,18 +490,18 @@ namespace Aws
{
if (m_failure)
{
- AWS_LOGSTREAM_FATAL(OPENSSL_LOG_TAG, "Cipher not properly initialized for decryption finalization. Aborting");
+ AWS_LOGSTREAM_FATAL(OPENSSL_LOG_TAG, "Cipher not properly initialized for decryption finalization. Aborting");
return CryptoBuffer();
}
CryptoBuffer finalBlock(GetBlockSizeBytes());
int writtenSize = static_cast<int>(finalBlock.GetLength());
- int ret = EVP_DecryptFinal_ex(m_decryptor_ctx, finalBlock.GetUnderlyingData(), &writtenSize);
-#if OPENSSL_VERSION_NUMBER > 0x1010104fL //1.1.1d
- if (ret <= 0)
-#else
- if (ret <= 0 && !m_emptyPlaintext) // see details why making exception for empty string at: https://github.com/aws/aws-sdk-cpp/issues/1413
-#endif
+ int ret = EVP_DecryptFinal_ex(m_decryptor_ctx, finalBlock.GetUnderlyingData(), &writtenSize);
+#if OPENSSL_VERSION_NUMBER > 0x1010104fL //1.1.1d
+ if (ret <= 0)
+#else
+ if (ret <= 0 && !m_emptyPlaintext) // see details why making exception for empty string at: https://github.com/aws/aws-sdk-cpp/issues/1413
+#endif
{
m_failure = true;
LogErrors();
@@ -519,18 +519,18 @@ namespace Aws
void OpenSSLCipher::Cleanup()
{
m_failure = false;
- if (m_encryptor_ctx) EVP_CIPHER_CTX_cleanup(m_encryptor_ctx);
- if (m_decryptor_ctx) EVP_CIPHER_CTX_cleanup(m_decryptor_ctx);
- }
+ if (m_encryptor_ctx) EVP_CIPHER_CTX_cleanup(m_encryptor_ctx);
+ if (m_decryptor_ctx) EVP_CIPHER_CTX_cleanup(m_decryptor_ctx);
+ }
- bool OpenSSLCipher::CheckKeyAndIVLength(size_t expectedKeyLength, size_t expectedIVLength)
- {
- if (!m_failure && ((m_key.GetLength() != expectedKeyLength) || m_initializationVector.GetLength() != expectedIVLength))
- {
- AWS_LOGSTREAM_ERROR(OPENSSL_LOG_TAG, "Expected Key size is: " << expectedKeyLength << " and expected IV size is: " << expectedIVLength);
- m_failure = true;
- }
- return !m_failure;
+ bool OpenSSLCipher::CheckKeyAndIVLength(size_t expectedKeyLength, size_t expectedIVLength)
+ {
+ if (!m_failure && ((m_key.GetLength() != expectedKeyLength) || m_initializationVector.GetLength() != expectedIVLength))
+ {
+ AWS_LOGSTREAM_ERROR(OPENSSL_LOG_TAG, "Expected Key size is: " << expectedKeyLength << " and expected IV size is: " << expectedIVLength);
+ m_failure = true;
+ }
+ return !m_failure;
}
size_t AES_CBC_Cipher_OpenSSL::BlockSizeBytes = 16;
@@ -557,11 +557,11 @@ namespace Aws
void AES_CBC_Cipher_OpenSSL::InitCipher()
{
- if (m_failure || !CheckKeyAndIVLength(KeyLengthBits/8, BlockSizeBytes))
- {
- return;
- }
-
+ if (m_failure || !CheckKeyAndIVLength(KeyLengthBits/8, BlockSizeBytes))
+ {
+ return;
+ }
+
if (!EVP_EncryptInit_ex(m_encryptor_ctx, EVP_aes_256_cbc(), nullptr, m_key.GetUnderlyingData(),
m_initializationVector.GetUnderlyingData()) ||
!EVP_DecryptInit_ex(m_decryptor_ctx, EVP_aes_256_cbc(), nullptr, m_key.GetUnderlyingData(),
@@ -582,12 +582,12 @@ namespace Aws
return KeyLengthBits;
}
- void AES_CBC_Cipher_OpenSSL::Reset()
- {
- OpenSSLCipher::Reset();
- InitCipher();
- }
-
+ void AES_CBC_Cipher_OpenSSL::Reset()
+ {
+ OpenSSLCipher::Reset();
+ InitCipher();
+ }
+
size_t AES_CTR_Cipher_OpenSSL::BlockSizeBytes = 16;
size_t AES_CTR_Cipher_OpenSSL::KeyLengthBits = 256;
static const char* CTR_LOG_TAG = "AES_CTR_Cipher_OpenSSL";
@@ -613,11 +613,11 @@ namespace Aws
void AES_CTR_Cipher_OpenSSL::InitCipher()
{
- if (m_failure || !CheckKeyAndIVLength(KeyLengthBits/8, BlockSizeBytes))
- {
- return;
- }
-
+ if (m_failure || !CheckKeyAndIVLength(KeyLengthBits/8, BlockSizeBytes))
+ {
+ return;
+ }
+
if (!(EVP_EncryptInit_ex(m_encryptor_ctx, EVP_aes_256_ctr(), nullptr, m_key.GetUnderlyingData(),
m_initializationVector.GetUnderlyingData())
&& EVP_CIPHER_CTX_set_padding(m_encryptor_ctx, 0)) ||
@@ -640,12 +640,12 @@ namespace Aws
return KeyLengthBits;
}
- void AES_CTR_Cipher_OpenSSL::Reset()
- {
- OpenSSLCipher::Reset();
- InitCipher();
- }
-
+ void AES_CTR_Cipher_OpenSSL::Reset()
+ {
+ OpenSSLCipher::Reset();
+ InitCipher();
+ }
+
size_t AES_GCM_Cipher_OpenSSL::BlockSizeBytes = 16;
size_t AES_GCM_Cipher_OpenSSL::KeyLengthBits = 256;
size_t AES_GCM_Cipher_OpenSSL::IVLengthBytes = 12;
@@ -653,62 +653,62 @@ namespace Aws
static const char* GCM_LOG_TAG = "AES_GCM_Cipher_OpenSSL";
- AES_GCM_Cipher_OpenSSL::AES_GCM_Cipher_OpenSSL(const CryptoBuffer& key)
- : OpenSSLCipher(key, IVLengthBytes)
+ AES_GCM_Cipher_OpenSSL::AES_GCM_Cipher_OpenSSL(const CryptoBuffer& key)
+ : OpenSSLCipher(key, IVLengthBytes)
+ {
+ InitCipher();
+ }
+
+ AES_GCM_Cipher_OpenSSL::AES_GCM_Cipher_OpenSSL(const CryptoBuffer& key, const CryptoBuffer* aad)
+ : OpenSSLCipher(key, IVLengthBytes), m_aad(*aad)
{
InitCipher();
}
- AES_GCM_Cipher_OpenSSL::AES_GCM_Cipher_OpenSSL(const CryptoBuffer& key, const CryptoBuffer* aad)
- : OpenSSLCipher(key, IVLengthBytes), m_aad(*aad)
- {
- InitCipher();
- }
-
AES_GCM_Cipher_OpenSSL::AES_GCM_Cipher_OpenSSL(CryptoBuffer&& key, CryptoBuffer&& initializationVector,
- CryptoBuffer&& tag, CryptoBuffer&& aad) :
- OpenSSLCipher(std::move(key), std::move(initializationVector), std::move(tag)), m_aad(std::move(aad))
+ CryptoBuffer&& tag, CryptoBuffer&& aad) :
+ OpenSSLCipher(std::move(key), std::move(initializationVector), std::move(tag)), m_aad(std::move(aad))
{
InitCipher();
}
- AES_GCM_Cipher_OpenSSL::AES_GCM_Cipher_OpenSSL(const CryptoBuffer& key, const CryptoBuffer& initializationVector,
- const CryptoBuffer& tag, const CryptoBuffer& aad) :
- OpenSSLCipher(key, initializationVector, tag), m_aad(std::move(aad))
+ AES_GCM_Cipher_OpenSSL::AES_GCM_Cipher_OpenSSL(const CryptoBuffer& key, const CryptoBuffer& initializationVector,
+ const CryptoBuffer& tag, const CryptoBuffer& aad) :
+ OpenSSLCipher(key, initializationVector, tag), m_aad(std::move(aad))
{
InitCipher();
}
CryptoBuffer AES_GCM_Cipher_OpenSSL::FinalizeEncryption()
{
- if (m_failure)
- {
- AWS_LOGSTREAM_FATAL(GCM_LOG_TAG, "Cipher not properly initialized for encryption finalization. Aborting");
- return CryptoBuffer();
- }
-
- int writtenSize = 0;
- CryptoBuffer finalBlock(GetBlockSizeBytes());
- EVP_EncryptFinal_ex(m_encryptor_ctx, finalBlock.GetUnderlyingData(), &writtenSize);
-
+ if (m_failure)
+ {
+ AWS_LOGSTREAM_FATAL(GCM_LOG_TAG, "Cipher not properly initialized for encryption finalization. Aborting");
+ return CryptoBuffer();
+ }
+
+ int writtenSize = 0;
+ CryptoBuffer finalBlock(GetBlockSizeBytes());
+ EVP_EncryptFinal_ex(m_encryptor_ctx, finalBlock.GetUnderlyingData(), &writtenSize);
+
m_tag = CryptoBuffer(TagLengthBytes);
- if (!EVP_CIPHER_CTX_ctrl(m_encryptor_ctx, EVP_CTRL_GCM_GET_TAG, static_cast<int>(m_tag.GetLength()),
+ if (!EVP_CIPHER_CTX_ctrl(m_encryptor_ctx, EVP_CTRL_GCM_GET_TAG, static_cast<int>(m_tag.GetLength()),
m_tag.GetUnderlyingData()))
{
m_failure = true;
LogErrors(GCM_LOG_TAG);
}
- return CryptoBuffer();
+ return CryptoBuffer();
}
void AES_GCM_Cipher_OpenSSL::InitCipher()
{
- if (m_failure || !CheckKeyAndIVLength(KeyLengthBits/8, IVLengthBytes))
- {
- return;
- }
-
+ if (m_failure || !CheckKeyAndIVLength(KeyLengthBits/8, IVLengthBytes))
+ {
+ return;
+ }
+
if (!(EVP_EncryptInit_ex(m_encryptor_ctx, EVP_aes_256_gcm(), nullptr, nullptr, nullptr) &&
EVP_EncryptInit_ex(m_encryptor_ctx, nullptr, nullptr, m_key.GetUnderlyingData(),
m_initializationVector.GetUnderlyingData()) &&
@@ -723,29 +723,29 @@ namespace Aws
return;
}
- if (m_aad.GetLength() > 0)
- {
- int outLen = 0;
- if(!EVP_EncryptUpdate(m_encryptor_ctx, nullptr, &outLen, m_aad.GetUnderlyingData(), m_aad.GetLength())
- || !EVP_DecryptUpdate(m_decryptor_ctx, nullptr, &outLen, m_aad.GetUnderlyingData(), m_aad.GetLength()))
- {
- m_failure = true;
- LogErrors(GCM_LOG_TAG);
- return;
- }
- }
-
+ if (m_aad.GetLength() > 0)
+ {
+ int outLen = 0;
+ if(!EVP_EncryptUpdate(m_encryptor_ctx, nullptr, &outLen, m_aad.GetUnderlyingData(), m_aad.GetLength())
+ || !EVP_DecryptUpdate(m_decryptor_ctx, nullptr, &outLen, m_aad.GetUnderlyingData(), m_aad.GetLength()))
+ {
+ m_failure = true;
+ LogErrors(GCM_LOG_TAG);
+ return;
+ }
+ }
+
//tag should always be set in GCM decrypt mode
if (m_tag.GetLength() > 0)
{
if (m_tag.GetLength() < TagLengthBytes)
{
- AWS_LOGSTREAM_ERROR(GCM_LOG_TAG, "Illegal attempt to decrypt an AES GCM payload without a valid tag set: tag length=" << m_tag.GetLength());
+ AWS_LOGSTREAM_ERROR(GCM_LOG_TAG, "Illegal attempt to decrypt an AES GCM payload without a valid tag set: tag length=" << m_tag.GetLength());
m_failure = true;
return;
}
- if (!EVP_CIPHER_CTX_ctrl(m_decryptor_ctx, EVP_CTRL_GCM_SET_TAG, static_cast<int>(m_tag.GetLength()), m_tag.GetUnderlyingData()))
+ if (!EVP_CIPHER_CTX_ctrl(m_decryptor_ctx, EVP_CTRL_GCM_SET_TAG, static_cast<int>(m_tag.GetLength()), m_tag.GetUnderlyingData()))
{
m_failure = true;
LogErrors(GCM_LOG_TAG);
@@ -768,12 +768,12 @@ namespace Aws
return TagLengthBytes;
}
- void AES_GCM_Cipher_OpenSSL::Reset()
- {
- OpenSSLCipher::Reset();
- InitCipher();
- }
-
+ void AES_GCM_Cipher_OpenSSL::Reset()
+ {
+ OpenSSLCipher::Reset();
+ InitCipher();
+ }
+
size_t AES_KeyWrap_Cipher_OpenSSL::KeyLengthBits = 256;
size_t AES_KeyWrap_Cipher_OpenSSL::BlockSizeBytes = 8;
static const unsigned char INTEGRITY_VALUE = 0xA6;
@@ -788,10 +788,10 @@ namespace Aws
CryptoBuffer AES_KeyWrap_Cipher_OpenSSL::EncryptBuffer(const CryptoBuffer& plainText)
{
- if (!m_failure)
- {
- m_workingKeyBuffer = CryptoBuffer({&m_workingKeyBuffer, (CryptoBuffer*) &plainText});
- }
+ if (!m_failure)
+ {
+ m_workingKeyBuffer = CryptoBuffer({&m_workingKeyBuffer, (CryptoBuffer*) &plainText});
+ }
return CryptoBuffer();
}
@@ -811,7 +811,7 @@ namespace Aws
}
//the following is an in place implementation of
- //RFC 3394 using the alternate in-place implementation.
+ //RFC 3394 using the alternate in-place implementation.
//we use one in-place buffer instead of the copy at the end.
//the one letter variable names are meant to directly reflect the variables in the RFC
CryptoBuffer cipherText(m_workingKeyBuffer.GetLength() + BlockSizeBytes);
@@ -869,10 +869,10 @@ namespace Aws
CryptoBuffer AES_KeyWrap_Cipher_OpenSSL::DecryptBuffer(const CryptoBuffer& cipherText)
{
- if (!m_failure)
- {
- m_workingKeyBuffer = CryptoBuffer({&m_workingKeyBuffer, (CryptoBuffer*)&cipherText});
- }
+ if (!m_failure)
+ {
+ m_workingKeyBuffer = CryptoBuffer({&m_workingKeyBuffer, (CryptoBuffer*)&cipherText});
+ }
return CryptoBuffer();
}
@@ -961,11 +961,11 @@ namespace Aws
void AES_KeyWrap_Cipher_OpenSSL::InitCipher()
{
- if (m_failure || !CheckKeyAndIVLength(KeyLengthBits/8, 0))
- {
- return;
- }
-
+ if (m_failure || !CheckKeyAndIVLength(KeyLengthBits/8, 0))
+ {
+ return;
+ }
+
if (!(EVP_EncryptInit_ex(m_encryptor_ctx, EVP_aes_256_ecb(), nullptr, m_key.GetUnderlyingData(), nullptr) &&
EVP_CIPHER_CTX_set_padding(m_encryptor_ctx, 0)) ||
!(EVP_DecryptInit_ex(m_decryptor_ctx, EVP_aes_256_ecb(), nullptr, m_key.GetUnderlyingData(), nullptr) &&
@@ -975,13 +975,13 @@ namespace Aws
LogErrors(KEY_WRAP_TAG);
}
}
-
- void AES_KeyWrap_Cipher_OpenSSL::Reset()
- {
- m_workingKeyBuffer = CryptoBuffer();
- OpenSSLCipher::Reset();
- InitCipher();
- }
+
+ void AES_KeyWrap_Cipher_OpenSSL::Reset()
+ {
+ m_workingKeyBuffer = CryptoBuffer();
+ OpenSSLCipher::Reset();
+ InitCipher();
+ }
}
}
}
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventDecoderStream.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventDecoderStream.cpp
index 16fc5e69d6c..5ecd2d0444e 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventDecoderStream.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventDecoderStream.cpp
@@ -1,22 +1,22 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
-#include <aws/core/utils/event/EventDecoderStream.h>
-#include <iostream>
-
-namespace Aws
-{
- namespace Utils
- {
- namespace Event
- {
- EventDecoderStream::EventDecoderStream(EventStreamDecoder& decoder, size_t bufferSize) :
- Aws::IOStream(&m_eventStreamBuf),
- m_eventStreamBuf(decoder, bufferSize)
-
- {
- }
- }
- }
-}
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
+#include <aws/core/utils/event/EventDecoderStream.h>
+#include <iostream>
+
+namespace Aws
+{
+ namespace Utils
+ {
+ namespace Event
+ {
+ EventDecoderStream::EventDecoderStream(EventStreamDecoder& decoder, size_t bufferSize) :
+ Aws::IOStream(&m_eventStreamBuf),
+ m_eventStreamBuf(decoder, bufferSize)
+
+ {
+ }
+ }
+ }
+}
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventEncoderStream.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventEncoderStream.cpp
index 08b791ed566..f8640f0e8c2 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventEncoderStream.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventEncoderStream.cpp
@@ -1,28 +1,28 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
-#include <aws/core/utils/event/EventEncoderStream.h>
-#include <iostream>
-
-namespace Aws
-{
- namespace Utils
- {
- namespace Event
- {
- EventEncoderStream::EventEncoderStream(size_t bufferSize) :
- Aws::IOStream(&m_streambuf),
- m_streambuf(bufferSize)
- {
- }
-
- EventEncoderStream& EventEncoderStream::WriteEvent(const Aws::Utils::Event::Message& msg)
- {
- auto bits = m_encoder.EncodeAndSign(msg);
- write(reinterpret_cast<char*>(bits.data()), bits.size());
- return *this;
- }
- }
- }
-}
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
+#include <aws/core/utils/event/EventEncoderStream.h>
+#include <iostream>
+
+namespace Aws
+{
+ namespace Utils
+ {
+ namespace Event
+ {
+ EventEncoderStream::EventEncoderStream(size_t bufferSize) :
+ Aws::IOStream(&m_streambuf),
+ m_streambuf(bufferSize)
+ {
+ }
+
+ EventEncoderStream& EventEncoderStream::WriteEvent(const Aws::Utils::Event::Message& msg)
+ {
+ auto bits = m_encoder.EncodeAndSign(msg);
+ write(reinterpret_cast<char*>(bits.data()), bits.size());
+ return *this;
+ }
+ }
+ }
+}
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventHeader.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventHeader.cpp
index b79dd2b4a55..c3c989bedbb 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventHeader.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventHeader.cpp
@@ -1,6 +1,6 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/core/utils/event/EventHeader.h>
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventMessage.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventMessage.cpp
index ed21d7d7d68..de8b904775b 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventMessage.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventMessage.cpp
@@ -1,6 +1,6 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/core/utils/event/EventMessage.h>
@@ -19,16 +19,16 @@ namespace Aws
const char MESSAGE_TYPE_HEADER[] = ":message-type";
const char ERROR_CODE_HEADER[] = ":error-code";
const char ERROR_MESSAGE_HEADER[] = ":error-message";
- const char EXCEPTION_TYPE_HEADER[] = ":exception-type";
+ const char EXCEPTION_TYPE_HEADER[] = ":exception-type";
static const int EVENT_HASH = HashingUtils::HashString("event");
static const int ERROR_HASH = HashingUtils::HashString("error");
- static const int EXCEPTION_HASH = HashingUtils::HashString("exception");
+ static const int EXCEPTION_HASH = HashingUtils::HashString("exception");
+
+ static const int CONTENT_TYPE_APPLICATION_OCTET_STREAM_HASH = HashingUtils::HashString("application/octet-stream");
+ static const int CONTENT_TYPE_APPLICATION_JSON_HASH = HashingUtils::HashString("application/json");
+ static const int CONTENT_TYPE_TEXT_PLAIN_HASH = HashingUtils::HashString("text/plain");
- static const int CONTENT_TYPE_APPLICATION_OCTET_STREAM_HASH = HashingUtils::HashString("application/octet-stream");
- static const int CONTENT_TYPE_APPLICATION_JSON_HASH = HashingUtils::HashString("application/json");
- static const int CONTENT_TYPE_TEXT_PLAIN_HASH = HashingUtils::HashString("text/plain");
-
Message::MessageType Message::GetMessageTypeForName(const Aws::String& name)
{
int hashCode = Aws::Utils::HashingUtils::HashString(name.c_str());
@@ -40,10 +40,10 @@ namespace Aws
{
return MessageType::REQUEST_LEVEL_ERROR;
}
- else if (hashCode == EXCEPTION_HASH)
- {
- return MessageType::REQUEST_LEVEL_EXCEPTION;
- }
+ else if (hashCode == EXCEPTION_HASH)
+ {
+ return MessageType::REQUEST_LEVEL_EXCEPTION;
+ }
else
{
return MessageType::UNKNOWN;
@@ -58,49 +58,49 @@ namespace Aws
return "event";
case MessageType::REQUEST_LEVEL_ERROR:
return "error";
- case MessageType::REQUEST_LEVEL_EXCEPTION:
- return "exception";
+ case MessageType::REQUEST_LEVEL_EXCEPTION:
+ return "exception";
+ default:
+ return "unknown";
+ }
+ }
+
+ Message::ContentType Message::GetContentTypeForName(const Aws::String& name)
+ {
+ int hashCode = Aws::Utils::HashingUtils::HashString(name.c_str());
+ if (hashCode == CONTENT_TYPE_APPLICATION_OCTET_STREAM_HASH)
+ {
+ return ContentType::APPLICATION_OCTET_STREAM;
+ }
+ else if (hashCode == CONTENT_TYPE_APPLICATION_JSON_HASH)
+ {
+ return ContentType::APPLICATION_JSON;
+ }
+ else if (hashCode == CONTENT_TYPE_TEXT_PLAIN_HASH)
+ {
+ return ContentType::TEXT_PLAIN;
+ }
+ else
+ {
+ return ContentType::UNKNOWN;
+ }
+ }
+
+ Aws::String Message::GetNameForContentType(ContentType value)
+ {
+ switch (value)
+ {
+ case ContentType::APPLICATION_OCTET_STREAM:
+ return "application/octet-stream";
+ case ContentType::APPLICATION_JSON:
+ return "application/json";
+ case ContentType::TEXT_PLAIN:
+ return "text/plain";
default:
return "unknown";
}
}
- Message::ContentType Message::GetContentTypeForName(const Aws::String& name)
- {
- int hashCode = Aws::Utils::HashingUtils::HashString(name.c_str());
- if (hashCode == CONTENT_TYPE_APPLICATION_OCTET_STREAM_HASH)
- {
- return ContentType::APPLICATION_OCTET_STREAM;
- }
- else if (hashCode == CONTENT_TYPE_APPLICATION_JSON_HASH)
- {
- return ContentType::APPLICATION_JSON;
- }
- else if (hashCode == CONTENT_TYPE_TEXT_PLAIN_HASH)
- {
- return ContentType::TEXT_PLAIN;
- }
- else
- {
- return ContentType::UNKNOWN;
- }
- }
-
- Aws::String Message::GetNameForContentType(ContentType value)
- {
- switch (value)
- {
- case ContentType::APPLICATION_OCTET_STREAM:
- return "application/octet-stream";
- case ContentType::APPLICATION_JSON:
- return "application/json";
- case ContentType::TEXT_PLAIN:
- return "text/plain";
- default:
- return "unknown";
- }
- }
-
void Message::Reset()
{
m_totalLength = 0;
@@ -111,21 +111,21 @@ namespace Aws
m_eventPayload.clear();
}
- void Message::WriteEventPayload(const unsigned char* data, size_t length)
- {
- std::copy(data, data + length, std::back_inserter(m_eventPayload));
- }
-
+ void Message::WriteEventPayload(const unsigned char* data, size_t length)
+ {
+ std::copy(data, data + length, std::back_inserter(m_eventPayload));
+ }
+
void Message::WriteEventPayload(const Aws::Vector<unsigned char>& bits)
{
std::copy(bits.cbegin(), bits.cend(), std::back_inserter(m_eventPayload));
}
- void Message::WriteEventPayload(const Aws::String& bits)
- {
- std::copy(bits.cbegin(), bits.cend(), std::back_inserter(m_eventPayload));
- }
-
+ void Message::WriteEventPayload(const Aws::String& bits)
+ {
+ std::copy(bits.cbegin(), bits.cend(), std::back_inserter(m_eventPayload));
+ }
+
} // namespace Event
} // namespace Utils
} // namespace Aws
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventStreamBuf.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventStreamBuf.cpp
index 4c52368e07b..6a1766bb9f4 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventStreamBuf.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventStreamBuf.cpp
@@ -1,6 +1,6 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/core/utils/event/EventStreamBuf.h>
#include <cassert>
@@ -11,8 +11,8 @@ namespace Aws
{
namespace Event
{
- const size_t DEFAULT_BUF_SIZE = 1024;
-
+ const size_t DEFAULT_BUF_SIZE = 1024;
+
EventStreamBuf::EventStreamBuf(EventStreamDecoder& decoder, size_t bufferLength) :
m_byteBuffer(bufferLength),
m_bufferLength(bufferLength),
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventStreamDecoder.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventStreamDecoder.cpp
index d0474f77eb3..f70a6c88f61 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventStreamDecoder.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventStreamDecoder.cpp
@@ -1,6 +1,6 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/common/common.h>
@@ -9,7 +9,7 @@
#include <aws/core/utils/event/EventStreamDecoder.h>
#include <aws/core/utils/logging/LogMacros.h>
#include <aws/core/utils/UnreferencedParam.h>
-#include <aws/core/utils/memory/AWSMemory.h>
+#include <aws/core/utils/memory/AWSMemory.h>
namespace Aws
{
@@ -21,8 +21,8 @@ namespace Aws
EventStreamDecoder::EventStreamDecoder(EventStreamHandler* handler) : m_eventStreamHandler(handler)
{
- aws_event_stream_streaming_decoder_init(&m_decoder,
- get_aws_allocator(),
+ aws_event_stream_streaming_decoder_init(&m_decoder,
+ get_aws_allocator(),
onPayloadSegment,
onPreludeReceived,
onHeaderReceived,
@@ -53,7 +53,7 @@ namespace Aws
void EventStreamDecoder::ResetEventStreamHandler(EventStreamHandler* handler)
{
- aws_event_stream_streaming_decoder_init(&m_decoder, get_aws_allocator(),
+ aws_event_stream_streaming_decoder_init(&m_decoder, get_aws_allocator(),
onPayloadSegment,
onPreludeReceived,
onHeaderReceived,
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventStreamEncoder.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventStreamEncoder.cpp
index 5380a793e1c..ef7104e839c 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventStreamEncoder.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventStreamEncoder.cpp
@@ -1,6 +1,6 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/core/utils/event/EventHeader.h>
@@ -9,7 +9,7 @@
#include <aws/core/utils/logging/LogMacros.h>
#include <aws/core/auth/AWSAuthSigner.h>
#include <aws/common/byte_order.h>
-#include <aws/core/utils/memory/AWSMemory.h>
+#include <aws/core/utils/memory/AWSMemory.h>
#include <cassert>
@@ -23,7 +23,7 @@ namespace Aws
static void EncodeHeaders(const Aws::Utils::Event::Message& msg, aws_array_list* headers)
{
- aws_array_list_init_dynamic(headers, get_aws_allocator(), msg.GetEventHeaders().size(), sizeof(aws_event_stream_header_value_pair));
+ aws_array_list_init_dynamic(headers, get_aws_allocator(), msg.GetEventHeaders().size(), sizeof(aws_event_stream_header_value_pair));
for (auto&& header : msg.GetEventHeaders())
{
const uint8_t headerKeyLen = static_cast<uint8_t>(header.first.length());
@@ -37,18 +37,18 @@ namespace Aws
aws_event_stream_add_bool_header(headers, header.first.c_str(), headerKeyLen, header.second.GetEventHeaderValueAsByte());
break;
case EventHeaderValue::EventHeaderType::INT16:
- aws_event_stream_add_int16_header(headers, header.first.c_str(), headerKeyLen, header.second.GetEventHeaderValueAsInt16());
+ aws_event_stream_add_int16_header(headers, header.first.c_str(), headerKeyLen, header.second.GetEventHeaderValueAsInt16());
break;
case EventHeaderValue::EventHeaderType::INT32:
- aws_event_stream_add_int32_header(headers, header.first.c_str(), headerKeyLen, header.second.GetEventHeaderValueAsInt32());
+ aws_event_stream_add_int32_header(headers, header.first.c_str(), headerKeyLen, header.second.GetEventHeaderValueAsInt32());
break;
case EventHeaderValue::EventHeaderType::INT64:
- aws_event_stream_add_int64_header(headers, header.first.c_str(), headerKeyLen, header.second.GetEventHeaderValueAsInt64());
+ aws_event_stream_add_int64_header(headers, header.first.c_str(), headerKeyLen, header.second.GetEventHeaderValueAsInt64());
break;
case EventHeaderValue::EventHeaderType::BYTE_BUF:
{
const auto& bytes = header.second.GetEventHeaderValueAsBytebuf();
- aws_event_stream_add_bytebuf_header(headers, header.first.c_str(), headerKeyLen, bytes.GetUnderlyingData(), static_cast<uint16_t>(bytes.GetLength()), 1 /*copy*/);
+ aws_event_stream_add_bytebuf_header(headers, header.first.c_str(), headerKeyLen, bytes.GetUnderlyingData(), static_cast<uint16_t>(bytes.GetLength()), 1 /*copy*/);
}
break;
case EventHeaderValue::EventHeaderType::STRING:
@@ -58,7 +58,7 @@ namespace Aws
}
break;
case EventHeaderValue::EventHeaderType::TIMESTAMP:
- aws_event_stream_add_timestamp_header(headers, header.first.c_str(), headerKeyLen, header.second.GetEventHeaderValueAsTimestamp());
+ aws_event_stream_add_timestamp_header(headers, header.first.c_str(), headerKeyLen, header.second.GetEventHeaderValueAsTimestamp());
break;
case EventHeaderValue::EventHeaderType::UUID:
{
@@ -104,16 +104,16 @@ namespace Aws
payload.allocator = nullptr;
aws_event_stream_message encoded;
- if(aws_event_stream_message_init(&encoded, get_aws_allocator(), &headers, &payload) == AWS_OP_ERR)
+ if(aws_event_stream_message_init(&encoded, get_aws_allocator(), &headers, &payload) == AWS_OP_ERR)
{
- AWS_LOGSTREAM_ERROR(TAG, "Error creating event-stream message from payload.");
- aws_event_stream_headers_list_cleanup(&headers);
+ AWS_LOGSTREAM_ERROR(TAG, "Error creating event-stream message from payload.");
+ aws_event_stream_headers_list_cleanup(&headers);
// GCC 4.9.4 issues a warning with -Wextra if we simply do
// return {};
aws_event_stream_message empty{nullptr, nullptr, 0};
return empty;
}
- aws_event_stream_headers_list_cleanup(&headers);
+ aws_event_stream_headers_list_cleanup(&headers);
return encoded;
}
@@ -143,16 +143,16 @@ namespace Aws
payload.allocator = nullptr;
aws_event_stream_message signedmsg;
- if(aws_event_stream_message_init(&signedmsg, get_aws_allocator(), &headers, &payload))
+ if(aws_event_stream_message_init(&signedmsg, get_aws_allocator(), &headers, &payload))
{
- AWS_LOGSTREAM_ERROR(TAG, "Error creating event-stream message from payload.");
- aws_event_stream_headers_list_cleanup(&headers);
+ AWS_LOGSTREAM_ERROR(TAG, "Error creating event-stream message from payload.");
+ aws_event_stream_headers_list_cleanup(&headers);
// GCC 4.9.4 issues a warning with -Wextra if we simply do
// return {};
aws_event_stream_message empty{nullptr, nullptr, 0};
return empty;
}
- aws_event_stream_headers_list_cleanup(&headers);
+ aws_event_stream_headers_list_cleanup(&headers);
return signedmsg;
}
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventStreamErrors.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventStreamErrors.cpp
index c8736b8ffab..836d0b47c55 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventStreamErrors.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventStreamErrors.cpp
@@ -1,6 +1,6 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/core/client/AWSError.h>
#include <aws/core/utils/HashingUtils.h>
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/json/JsonSerializer.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/json/JsonSerializer.cpp
index 3a4b34fa38d..9b785d19950 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/json/JsonSerializer.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/json/JsonSerializer.cpp
@@ -1,14 +1,14 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/utils/json/JsonSerializer.h>
#include <iterator>
#include <algorithm>
#include <aws/core/utils/memory/stl/AWSStringStream.h>
-#include <aws/core/utils/StringUtils.h>
+#include <aws/core/utils/StringUtils.h>
using namespace Aws::Utils;
using namespace Aws::Utils::Json;
@@ -186,26 +186,26 @@ JsonValue& JsonValue::AsInteger(int value)
JsonValue& JsonValue::WithInt64(const char* key, long long value)
{
- if (!m_value)
- {
- m_value = cJSON_CreateObject();
- }
-
- const auto val = cJSON_CreateInt64(value);
- AddOrReplace(m_value, key, val);
- return *this;
+ if (!m_value)
+ {
+ m_value = cJSON_CreateObject();
+ }
+
+ const auto val = cJSON_CreateInt64(value);
+ AddOrReplace(m_value, key, val);
+ return *this;
}
JsonValue& JsonValue::WithInt64(const Aws::String& key, long long value)
{
- return WithInt64(key.c_str(), value);
+ return WithInt64(key.c_str(), value);
}
JsonValue& JsonValue::AsInt64(long long value)
{
- Destroy();
- m_value = cJSON_CreateInt64(value);
- return *this;
+ Destroy();
+ m_value = cJSON_CreateInt64(value);
+ return *this;
}
JsonValue& JsonValue::WithDouble(const char* key, double value)
@@ -449,30 +449,30 @@ int JsonView::AsInteger() const
int64_t JsonView::GetInt64(const Aws::String& key) const
{
- assert(m_value);
- auto item = cJSON_GetObjectItemCaseSensitive(m_value, key.c_str());
- assert(item);
- if (item->valuestring)
- {
- return Aws::Utils::StringUtils::ConvertToInt64(item->valuestring);
- }
- else
- {
- return static_cast<int64_t>(item->valuedouble);
- }
+ assert(m_value);
+ auto item = cJSON_GetObjectItemCaseSensitive(m_value, key.c_str());
+ assert(item);
+ if (item->valuestring)
+ {
+ return Aws::Utils::StringUtils::ConvertToInt64(item->valuestring);
+ }
+ else
+ {
+ return static_cast<int64_t>(item->valuedouble);
+ }
}
int64_t JsonView::AsInt64() const
{
assert(cJSON_IsNumber(m_value));
- if (m_value->valuestring)
- {
- return Aws::Utils::StringUtils::ConvertToInt64(m_value->valuestring);
- }
- else
- {
- return static_cast<int64_t>(m_value->valuedouble);
- }
+ if (m_value->valuestring)
+ {
+ return Aws::Utils::StringUtils::ConvertToInt64(m_value->valuestring);
+ }
+ else
+ {
+ return static_cast<int64_t>(m_value->valuedouble);
+ }
}
double JsonView::GetDouble(const Aws::String& key) const
@@ -498,7 +498,7 @@ JsonView JsonView::GetObject(const Aws::String& key) const
JsonView JsonView::AsObject() const
{
- assert(cJSON_IsObject(m_value) || cJSON_IsNull(m_value));
+ assert(cJSON_IsObject(m_value) || cJSON_IsNull(m_value));
return m_value;
}
@@ -592,11 +592,11 @@ bool JsonView::IsIntegerType() const
return false;
}
- if (m_value->valuestring)
- {
- Aws::String valueString = m_value->valuestring;
- return std::all_of(valueString.begin(), valueString.end(), [](unsigned char c){ return ::isdigit(c) || c == '+' || c == '-'; });
- }
+ if (m_value->valuestring)
+ {
+ Aws::String valueString = m_value->valuestring;
+ return std::all_of(valueString.begin(), valueString.end(), [](unsigned char c){ return ::isdigit(c) || c == '+' || c == '-'; });
+ }
return m_value->valuedouble == static_cast<long long>(m_value->valuedouble);
}
@@ -607,11 +607,11 @@ bool JsonView::IsFloatingPointType() const
return false;
}
- if (m_value->valuestring)
- {
- Aws::String valueString = m_value->valuestring;
- return std::any_of(valueString.begin(), valueString.end(), [](unsigned char c){ return !::isdigit(c) && c != '+' && c != '-'; });
- }
+ if (m_value->valuestring)
+ {
+ Aws::String valueString = m_value->valuestring;
+ return std::any_of(valueString.begin(), valueString.end(), [](unsigned char c){ return !::isdigit(c) && c != '+' && c != '-'; });
+ }
return m_value->valuedouble != static_cast<long long>(m_value->valuedouble);
}
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/logging/AWSLogging.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/logging/AWSLogging.cpp
index c872c1cf64a..fc1b9fcc2ea 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/logging/AWSLogging.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/logging/AWSLogging.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/utils/logging/AWSLogging.h>
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/logging/ConsoleLogSystem.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/logging/ConsoleLogSystem.cpp
index c166c6dfcaf..dec7cef82fa 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/logging/ConsoleLogSystem.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/logging/ConsoleLogSystem.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/utils/logging/ConsoleLogSystem.h>
@@ -15,8 +15,8 @@ void ConsoleLogSystem::ProcessFormattedStatement(Aws::String&& statement)
{
std::cout << statement;
}
-
-void ConsoleLogSystem::Flush()
-{
- std::cout.flush();
-}
+
+void ConsoleLogSystem::Flush()
+{
+ std::cout.flush();
+}
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/logging/DefaultLogSystem.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/logging/DefaultLogSystem.cpp
index 21cbf2e0dd9..7286bb63788 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/logging/DefaultLogSystem.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/logging/DefaultLogSystem.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/utils/logging/DefaultLogSystem.h>
@@ -17,7 +17,7 @@ using namespace Aws::Utils::Logging;
static const char* AllocationTag = "DefaultLogSystem";
static const int BUFFERED_MSG_COUNT = 100;
-static std::shared_ptr<Aws::OFStream> MakeDefaultLogFile(const Aws::String& filenamePrefix)
+static std::shared_ptr<Aws::OFStream> MakeDefaultLogFile(const Aws::String& filenamePrefix)
{
Aws::String newFileName = filenamePrefix + DateTime::CalculateGmtTimestampAsString("%Y-%m-%d-%H") + ".log";
return Aws::MakeShared<Aws::OFStream>(AllocationTag, newFileName.c_str(), Aws::OFStream::out | Aws::OFStream::app);
@@ -32,7 +32,7 @@ static void LogThread(DefaultLogSystem::LogSynchronizationData* syncData, const
for(;;)
{
std::unique_lock<std::mutex> locker(syncData->m_logQueueMutex);
- syncData->m_queueSignal.wait(locker, [&](){ return syncData->m_stopLogging == true || syncData->m_queuedLogMessages.size() > 0; } );
+ syncData->m_queueSignal.wait(locker, [&](){ return syncData->m_stopLogging == true || syncData->m_queuedLogMessages.size() > 0; } );
if (syncData->m_stopLogging && syncData->m_queuedLogMessages.size() == 0)
{
@@ -87,7 +87,7 @@ DefaultLogSystem::~DefaultLogSystem()
{
{
std::lock_guard<std::mutex> locker(m_syncData.m_logQueueMutex);
- m_syncData.m_stopLogging = true;
+ m_syncData.m_stopLogging = true;
}
m_syncData.m_queueSignal.notify_one();
@@ -110,8 +110,8 @@ void DefaultLogSystem::ProcessFormattedStatement(Aws::String&& statement)
}
}
-void DefaultLogSystem::Flush()
-{
- m_syncData.m_queueSignal.notify_one();
-}
-
+void DefaultLogSystem::Flush()
+{
+ m_syncData.m_queueSignal.notify_one();
+}
+
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/logging/FormattedLogSystem.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/logging/FormattedLogSystem.cpp
index ba5d759e025..41c4d7e09c5 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/logging/FormattedLogSystem.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/logging/FormattedLogSystem.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/utils/logging/FormattedLogSystem.h>
@@ -52,7 +52,7 @@ static Aws::String CreateLogPrefixLine(LogLevel logLevel, const char* tag)
break;
}
- ss << DateTime::Now().CalculateGmtTimeWithMsPrecision() << " " << tag << " [" << std::this_thread::get_id() << "] ";
+ ss << DateTime::Now().CalculateGmtTimeWithMsPrecision() << " " << tag << " [" << std::this_thread::get_id() << "] ";
return ss.str();
}
@@ -95,5 +95,5 @@ void FormattedLogSystem::Log(LogLevel logLevel, const char* tag, const char* for
void FormattedLogSystem::LogStream(LogLevel logLevel, const char* tag, const Aws::OStringStream &message_stream)
{
- ProcessFormattedStatement(CreateLogPrefixLine(logLevel, tag) + message_stream.str() + "\n");
+ ProcessFormattedStatement(CreateLogPrefixLine(logLevel, tag) + message_stream.str() + "\n");
}
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/logging/LogLevel.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/logging/LogLevel.cpp
index 1a83275cd2e..9ff1bf3126f 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/logging/LogLevel.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/logging/LogLevel.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/utils/logging/LogLevel.h>
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/memory/AWSMemory.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/memory/AWSMemory.cpp
index 0b6d273f21f..96d339d385a 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/memory/AWSMemory.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/memory/AWSMemory.cpp
@@ -1,12 +1,12 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/utils/memory/AWSMemory.h>
#include <aws/core/utils/memory/MemorySystemInterface.h>
-#include <aws/common/common.h>
+#include <aws/common/common.h>
#include <atomic>
@@ -98,37 +98,37 @@ void Free(void* memoryPtr)
}
}
-static void* MemAcquire(aws_allocator* allocator, size_t size)
-{
- (void)allocator; // unused;
- return Aws::Malloc("MemAcquire", size);
-}
-
-static void MemRelease(aws_allocator* allocator, void* ptr)
-{
- (void)allocator; // unused;
- return Aws::Free(ptr);
-}
-
-static aws_allocator create_aws_allocator()
-{
-#if (__GNUC__ == 4) && !defined(__clang__)
- AWS_SUPPRESS_WARNING("-Wmissing-field-initializers", aws_allocator wrapper{};);
-#else
- aws_allocator wrapper{};
-#endif
- wrapper.mem_acquire = MemAcquire;
- wrapper.mem_release = MemRelease;
- wrapper.mem_realloc = nullptr;
- return wrapper;
-}
-
-aws_allocator* get_aws_allocator()
-{
- static aws_allocator wrapper = create_aws_allocator();
- return &wrapper;
-}
-
+static void* MemAcquire(aws_allocator* allocator, size_t size)
+{
+ (void)allocator; // unused;
+ return Aws::Malloc("MemAcquire", size);
+}
+
+static void MemRelease(aws_allocator* allocator, void* ptr)
+{
+ (void)allocator; // unused;
+ return Aws::Free(ptr);
+}
+
+static aws_allocator create_aws_allocator()
+{
+#if (__GNUC__ == 4) && !defined(__clang__)
+ AWS_SUPPRESS_WARNING("-Wmissing-field-initializers", aws_allocator wrapper{};);
+#else
+ aws_allocator wrapper{};
+#endif
+ wrapper.mem_acquire = MemAcquire;
+ wrapper.mem_release = MemRelease;
+ wrapper.mem_realloc = nullptr;
+ return wrapper;
+}
+
+aws_allocator* get_aws_allocator()
+{
+ static aws_allocator wrapper = create_aws_allocator();
+ return &wrapper;
+}
+
} // namespace Aws
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/memory/stl/SimpleStringStream.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/memory/stl/SimpleStringStream.cpp
index 945c345c63b..46627498729 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/memory/stl/SimpleStringStream.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/memory/stl/SimpleStringStream.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/utils/memory/stl/SimpleStringStream.h>
@@ -20,7 +20,7 @@ SimpleStringStream::SimpleStringStream(const Aws::String& value) :
{
}
-void SimpleStringStream::str(const Aws::String& value)
+void SimpleStringStream::str(const Aws::String& value)
{
m_streamBuffer.str(value);
}
@@ -39,7 +39,7 @@ SimpleIStringStream::SimpleIStringStream(const Aws::String& value) :
{
}
-void SimpleIStringStream::str(const Aws::String& value)
+void SimpleIStringStream::str(const Aws::String& value)
{
m_streamBuffer.str(value);
}
@@ -58,9 +58,9 @@ SimpleOStringStream::SimpleOStringStream(const Aws::String& value) :
{
}
-void SimpleOStringStream::str(const Aws::String& value)
+void SimpleOStringStream::str(const Aws::String& value)
{
m_streamBuffer.str(value);
}
-} // namespace Aws
+} // namespace Aws
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/stream/ConcurrentStreamBuf.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/stream/ConcurrentStreamBuf.cpp
index bbfc27da99a..3f59dbe96d4 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/stream/ConcurrentStreamBuf.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/stream/ConcurrentStreamBuf.cpp
@@ -1,6 +1,6 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/core/utils/stream/ConcurrentStreamBuf.h>
#include <aws/core/utils/logging/LogMacros.h>
@@ -42,11 +42,11 @@ namespace Aws
// scope the lock
{
std::unique_lock<std::mutex> lock(m_lock);
- m_signal.wait(lock, [this, bitslen]{ return m_eof || bitslen <= (m_backbuf.capacity() - m_backbuf.size()); });
- if (m_eof)
- {
- return;
- }
+ m_signal.wait(lock, [this, bitslen]{ return m_eof || bitslen <= (m_backbuf.capacity() - m_backbuf.size()); });
+ if (m_eof)
+ {
+ return;
+ }
std::copy(pbase(), pptr(), std::back_inserter(m_backbuf));
}
m_signal.notify_one();
@@ -104,16 +104,16 @@ namespace Aws
}
FlushPutArea();
- {
- std::unique_lock<std::mutex> lock(m_lock);
- if (m_eof)
- {
- return eof;
- }
- *pptr() = static_cast<char>(ch);
- pbump(1);
- return ch;
- }
+ {
+ std::unique_lock<std::mutex> lock(m_lock);
+ if (m_eof)
+ {
+ return eof;
+ }
+ *pptr() = static_cast<char>(ch);
+ pbump(1);
+ return ch;
+ }
}
int ConcurrentStreamBuf::sync()
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/stream/PreallocatedStreamBuf.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/stream/PreallocatedStreamBuf.cpp
index 94f23c3f2f2..f656fc86138 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/stream/PreallocatedStreamBuf.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/stream/PreallocatedStreamBuf.cpp
@@ -1,8 +1,8 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/utils/stream/PreallocatedStreamBuf.h>
#include <cassert>
@@ -13,7 +13,7 @@ namespace Aws
{
namespace Stream
{
- PreallocatedStreamBuf::PreallocatedStreamBuf(unsigned char* buffer, uint64_t lengthToRead) :
+ PreallocatedStreamBuf::PreallocatedStreamBuf(unsigned char* buffer, uint64_t lengthToRead) :
m_underlyingBuffer(buffer), m_lengthToRead(lengthToRead)
{
char* end = reinterpret_cast<char*>(m_underlyingBuffer + m_lengthToRead);
@@ -36,11 +36,11 @@ namespace Aws
{
if(which == std::ios_base::in)
{
- return seekpos((gptr() - reinterpret_cast<char*>(m_underlyingBuffer)) + off, which);
+ return seekpos((gptr() - reinterpret_cast<char*>(m_underlyingBuffer)) + off, which);
}
else
{
- return seekpos((pptr() - reinterpret_cast<char*>(m_underlyingBuffer)) + off, which);
+ return seekpos((pptr() - reinterpret_cast<char*>(m_underlyingBuffer)) + off, which);
}
}
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/stream/ResponseStream.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/stream/ResponseStream.cpp
index b31b20fcb29..6d1f90ed124 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/stream/ResponseStream.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/stream/ResponseStream.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/utils/stream/ResponseStream.h>
#include <aws/core/utils/memory/stl/AWSStringStream.h>
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/stream/SimpleStreamBuf.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/stream/SimpleStreamBuf.cpp
index b70968cbb40..6e429947445 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/stream/SimpleStreamBuf.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/stream/SimpleStreamBuf.cpp
@@ -1,8 +1,8 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/utils/stream/SimpleStreamBuf.h>
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/threading/Executor.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/threading/Executor.cpp
index 6b9a979a05d..4a3c4209c41 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/threading/Executor.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/threading/Executor.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/utils/threading/Executor.h>
#include <aws/core/utils/threading/ThreadTask.h>
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/threading/ReaderWriterLock.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/threading/ReaderWriterLock.cpp
index a7846cddaff..ddb5860563d 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/threading/ReaderWriterLock.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/threading/ReaderWriterLock.cpp
@@ -1,6 +1,6 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/core/utils/threading/ReaderWriterLock.h>
@@ -10,7 +10,7 @@
using namespace Aws::Utils::Threading;
-static const int64_t MaxReaders = (std::numeric_limits<std::int32_t>::max)();
+static const int64_t MaxReaders = (std::numeric_limits<std::int32_t>::max)();
ReaderWriterLock::ReaderWriterLock() :
m_readers(0),
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/threading/Semaphore.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/threading/Semaphore.cpp
index 74a0bc2c08c..86dabc9acf4 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/threading/Semaphore.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/threading/Semaphore.cpp
@@ -1,6 +1,6 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/core/utils/threading/Semaphore.h>
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/threading/ThreadTask.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/threading/ThreadTask.cpp
index 7120275542f..a899fe045d7 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/threading/ThreadTask.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/threading/ThreadTask.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/utils/threading/ThreadTask.h>
#include <aws/core/utils/threading/Executor.h>
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/xml/XmlSerializer.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/xml/XmlSerializer.cpp
index 9c8c54c2779..c06befaf9b0 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/xml/XmlSerializer.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/xml/XmlSerializer.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/utils/xml/XmlSerializer.h>
@@ -56,8 +56,8 @@ void XmlNode::SetName(const Aws::String& name)
const Aws::String XmlNode::GetAttributeValue(const Aws::String& name) const
{
- auto pointer = m_node->ToElement()->Attribute(name.c_str(), nullptr);
- return pointer ? pointer : "";
+ auto pointer = m_node->ToElement()->Attribute(name.c_str(), nullptr);
+ return pointer ? pointer : "";
}
void XmlNode::SetAttributeValue(const Aws::String& name, const Aws::String& value)
@@ -158,106 +158,106 @@ static const char* XML_SERIALIZER_ALLOCATION_TAG = "XmlDocument";
XmlDocument::XmlDocument()
{
- m_doc = nullptr;
+ m_doc = nullptr;
}
-XmlDocument::XmlDocument(const XmlDocument& doc)
-{
- if (doc.m_doc == nullptr)
- {
- m_doc = nullptr;
- }
- else
- {
- InitDoc();
- doc.m_doc->DeepCopy(m_doc);
- }
-}
-
-XmlDocument::XmlDocument(XmlDocument&& doc) : m_doc{ doc.m_doc } // take the innards
+XmlDocument::XmlDocument(const XmlDocument& doc)
+{
+ if (doc.m_doc == nullptr)
+ {
+ m_doc = nullptr;
+ }
+ else
+ {
+ InitDoc();
+ doc.m_doc->DeepCopy(m_doc);
+ }
+}
+
+XmlDocument::XmlDocument(XmlDocument&& doc) : m_doc{ doc.m_doc } // take the innards
{
doc.m_doc = nullptr; // leave nothing behind
}
-XmlDocument& XmlDocument::operator=(const XmlDocument& other)
-{
- if (this == &other)
- {
- return *this;
- }
-
- if (other.m_doc == nullptr)
- {
- if (m_doc != nullptr)
- {
- m_doc->Clear();
- m_doc = nullptr;
- }
- }
- else
- {
- if (m_doc == nullptr)
- {
- InitDoc();
- }
- else
- {
- m_doc->Clear();
- }
- other.m_doc->DeepCopy(m_doc);
- }
-
- return *this;
-}
-
-XmlDocument& XmlDocument::operator=(XmlDocument&& other)
-{
- if (this == &other)
- {
- return *this;
- }
-
- std::swap(m_doc, other.m_doc);
- return *this;
-}
-
+XmlDocument& XmlDocument::operator=(const XmlDocument& other)
+{
+ if (this == &other)
+ {
+ return *this;
+ }
+
+ if (other.m_doc == nullptr)
+ {
+ if (m_doc != nullptr)
+ {
+ m_doc->Clear();
+ m_doc = nullptr;
+ }
+ }
+ else
+ {
+ if (m_doc == nullptr)
+ {
+ InitDoc();
+ }
+ else
+ {
+ m_doc->Clear();
+ }
+ other.m_doc->DeepCopy(m_doc);
+ }
+
+ return *this;
+}
+
+XmlDocument& XmlDocument::operator=(XmlDocument&& other)
+{
+ if (this == &other)
+ {
+ return *this;
+ }
+
+ std::swap(m_doc, other.m_doc);
+ return *this;
+}
+
XmlDocument::~XmlDocument()
{
- if (m_doc)
- {
- Aws::Delete(m_doc);
- }
+ if (m_doc)
+ {
+ Aws::Delete(m_doc);
+ }
+}
+
+void XmlDocument::InitDoc()
+{
+ m_doc = Aws::New<Aws::External::tinyxml2::XMLDocument>(XML_SERIALIZER_ALLOCATION_TAG, true, Aws::External::tinyxml2::Whitespace::PRESERVE_WHITESPACE);
}
-void XmlDocument::InitDoc()
-{
- m_doc = Aws::New<Aws::External::tinyxml2::XMLDocument>(XML_SERIALIZER_ALLOCATION_TAG, true, Aws::External::tinyxml2::Whitespace::PRESERVE_WHITESPACE);
-}
-
XmlNode XmlDocument::GetRootElement() const
{
- if (m_doc)
- {
- return XmlNode(m_doc->FirstChildElement(), *this);
- }
- else
- {
- return XmlNode(nullptr, *this);
- }
-
+ if (m_doc)
+ {
+ return XmlNode(m_doc->FirstChildElement(), *this);
+ }
+ else
+ {
+ return XmlNode(nullptr, *this);
+ }
+
}
bool XmlDocument::WasParseSuccessful() const
{
- if (m_doc)
- {
- return !m_doc->Error();
- }
- else
- {
- return true;
- }
-
+ if (m_doc)
+ {
+ return !m_doc->Error();
+ }
+ else
+ {
+ return true;
+ }
+
}
Aws::String XmlDocument::GetErrorMessage() const
@@ -267,8 +267,8 @@ Aws::String XmlDocument::GetErrorMessage() const
Aws::String XmlDocument::ConvertToString() const
{
- if (!m_doc) return "";
-
+ if (!m_doc) return "";
+
Aws::External::tinyxml2::XMLPrinter printer;
printer.PushHeader(false, true);
m_doc->Accept(&printer);
@@ -285,7 +285,7 @@ XmlDocument XmlDocument::CreateFromXmlStream(Aws::IOStream& xmlStream)
XmlDocument XmlDocument::CreateFromXmlString(const Aws::String& xmlText)
{
XmlDocument xmlDocument;
- xmlDocument.InitDoc();
+ xmlDocument.InitDoc();
xmlDocument.m_doc->Parse(xmlText.c_str(), xmlText.size());
return xmlDocument;
}
@@ -293,7 +293,7 @@ XmlDocument XmlDocument::CreateFromXmlString(const Aws::String& xmlText)
XmlDocument XmlDocument::CreateWithRootNode(const Aws::String& rootNodeName)
{
XmlDocument xmlDocument;
- xmlDocument.InitDoc();
+ xmlDocument.InitDoc();
Aws::External::tinyxml2::XMLElement* rootNode = xmlDocument.m_doc->NewElement(rootNodeName.c_str());
xmlDocument.m_doc->LinkEndChild(rootNode);