diff options
author | denplusplus <denplusplus@yandex-team.ru> | 2022-02-10 16:47:34 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:47:34 +0300 |
commit | addb3626ed629a8c7d9c8c30e87365b478a8c266 (patch) | |
tree | c0748b5dcbade83af788c0abfa89c0383d6b779c /library/cpp/string_utils/url/url.cpp | |
parent | 57c20d143e8a438cd76b9fdc3ca2e8ee3ac1f32a (diff) | |
download | ydb-addb3626ed629a8c7d9c8c30e87365b478a8c266.tar.gz |
Restoring authorship annotation for <denplusplus@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/string_utils/url/url.cpp')
-rw-r--r-- | library/cpp/string_utils/url/url.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/library/cpp/string_utils/url/url.cpp b/library/cpp/string_utils/url/url.cpp index 1a7a0f6ed7..85f4ac5d69 100644 --- a/library/cpp/string_utils/url/url.cpp +++ b/library/cpp/string_utils/url/url.cpp @@ -51,7 +51,7 @@ namespace { if (!ignorehttps && urlSize.Has(8) && Compare1Case2(url, httpsPrefix, 8) == 0) return 8; return 0; - } + } template <typename T> inline T CutHttpPrefixImpl(const T& url, bool ignorehttps) { @@ -255,14 +255,14 @@ TStringBuf GetDomain(const TStringBuf host) noexcept { if (*c == '.') { if (wasPoint) { ++c; - break; + break; } - wasPoint = true; - } - } + wasPoint = true; + } + } return TStringBuf(c, host.end()); -} - +} + TStringBuf GetParentDomain(const TStringBuf host, size_t level) noexcept { size_t pos = host.size(); for (size_t i = 0; i < level; ++i) { @@ -275,8 +275,8 @@ TStringBuf GetParentDomain(const TStringBuf host, size_t level) noexcept { TStringBuf GetZone(const TStringBuf host) noexcept { return GetParentDomain(host, 1); -} - +} + TStringBuf CutWWWPrefix(const TStringBuf url) noexcept { if (url.size() >= 4 && url[3] == '.' && !strnicmp(url.data(), "www", 3)) return url.substr(4); @@ -342,8 +342,8 @@ static inline int x2c(unsigned char* x) { return X(x[0]) * 16 + X(x[1]); } -#undef X - +#undef X + static inline int Unescape(char* str) { char *to, *from; int dlen = 0; |