diff options
author | nalpp <nalpp@yandex-team.ru> | 2022-02-10 16:46:46 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:46 +0300 |
commit | 30d1ef3941e0dc835be7609de5ebee66958f215a (patch) | |
tree | 49e222ea1c5804306084bb3ae065bb702625360f /contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/DNS.cpp | |
parent | 87f3eb38999df2d3c1cb77f8ffb9c52ec9c516fb (diff) | |
download | ydb-30d1ef3941e0dc835be7609de5ebee66958f215a.tar.gz |
Restoring authorship annotation for <nalpp@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/DNS.cpp')
-rw-r--r-- | contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/DNS.cpp | 70 |
1 files changed, 35 insertions, 35 deletions
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 66cc081b77..ce588150e2 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 @@ -2,43 +2,43 @@ * 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/DNS.h> #include <aws/core/utils/StringUtils.h> - -namespace Aws -{ - namespace Utils - { - bool IsValidDnsLabel(const Aws::String& label) - { - // Valid DNS hostnames are composed of valid DNS labels separated by a period. - // Valid DNS labels are characterized by the following: - // 1- Only contains alphanumeric characters and/or dashes - // 2- Cannot start or end with a dash - // 3- Have a maximum length of 63 characters (the entirety of the domain name should be less than 255 bytes) - - if (label.empty()) - return false; - - if (label.size() > 63) - return false; - + +namespace Aws +{ + namespace Utils + { + bool IsValidDnsLabel(const Aws::String& label) + { + // Valid DNS hostnames are composed of valid DNS labels separated by a period. + // Valid DNS labels are characterized by the following: + // 1- Only contains alphanumeric characters and/or dashes + // 2- Cannot start or end with a dash + // 3- Have a maximum length of 63 characters (the entirety of the domain name should be less than 255 bytes) + + if (label.empty()) + return false; + + if (label.size() > 63) + return false; + if (!StringUtils::IsAlnum(label.front())) - return false; // '-' is not acceptable as the first character - + return false; // '-' is not acceptable as the first character + if (!StringUtils::IsAlnum(label.back())) - return false; // '-' is not acceptable as the last character - - for (size_t i = 1, e = label.size() - 1; i < e; ++i) - { - auto c = label[i]; + return false; // '-' is not acceptable as the last character + + for (size_t i = 1, e = label.size() - 1; i < e; ++i) + { + auto c = label[i]; if (c != '-' && !StringUtils::IsAlnum(c)) - return false; - } - - return true; - } + return false; + } + + return true; + } bool IsValidHost(const Aws::String& host) { @@ -51,5 +51,5 @@ namespace Aws return !std::any_of(labels.begin(), labels.end(), [](const Aws::String& label){ return !IsValidDnsLabel(label); }); } - } -} + } +} |