diff options
author | manavrion <manavrion@yandex-team.ru> | 2022-02-10 16:49:16 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:16 +0300 |
commit | 109de9f4c31b6caaa736ce29a61fce05851e7c02 (patch) | |
tree | e509d6d1d860cb27318781b452060fd9ce9b74a1 /library/cpp/string_utils/url | |
parent | 5ba59e58ca0ed3be83efee8a12c92725dfc5f051 (diff) | |
download | ydb-109de9f4c31b6caaa736ce29a61fce05851e7c02.tar.gz |
Restoring authorship annotation for <manavrion@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/string_utils/url')
-rw-r--r-- | library/cpp/string_utils/url/url.cpp | 30 | ||||
-rw-r--r-- | library/cpp/string_utils/url/url.h | 44 |
2 files changed, 37 insertions, 37 deletions
diff --git a/library/cpp/string_utils/url/url.cpp b/library/cpp/string_utils/url/url.cpp index 85f4ac5d69..ffd610d21e 100644 --- a/library/cpp/string_utils/url/url.cpp +++ b/library/cpp/string_utils/url/url.cpp @@ -62,17 +62,17 @@ namespace { } } -namespace NUrl { - - TSplitUrlToHostAndPathResult SplitUrlToHostAndPath(const TStringBuf url) { - TStringBuf host = GetSchemeHostAndPort(url, /*trimHttp=*/false, /*trimDefaultPort=*/false); - TStringBuf path = url; - path.SkipPrefix(host); - return {host, path}; - } - -} // namespace NUrl - +namespace NUrl { + + TSplitUrlToHostAndPathResult SplitUrlToHostAndPath(const TStringBuf url) { + TStringBuf host = GetSchemeHostAndPort(url, /*trimHttp=*/false, /*trimDefaultPort=*/false); + TStringBuf path = url; + path.SkipPrefix(host); + return {host, path}; + } + +} // namespace NUrl + size_t GetHttpPrefixSize(const char* url, bool ignorehttps) noexcept { return GetHttpPrefixSizeImpl<char>(url, TUncheckedSize(), ignorehttps); } @@ -183,13 +183,13 @@ TStringBuf GetSchemeHostAndPort(const TStringBuf url, bool trimHttp, bool trimDe } void SplitUrlToHostAndPath(const TStringBuf url, TStringBuf& host, TStringBuf& path) { - auto [hostBuf, pathBuf] = NUrl::SplitUrlToHostAndPath(url); - host = hostBuf; - path = pathBuf; + auto [hostBuf, pathBuf] = NUrl::SplitUrlToHostAndPath(url); + host = hostBuf; + path = pathBuf; } void SplitUrlToHostAndPath(const TStringBuf url, TString& host, TString& path) { - auto [hostBuf, pathBuf] = NUrl::SplitUrlToHostAndPath(url); + auto [hostBuf, pathBuf] = NUrl::SplitUrlToHostAndPath(url); host = hostBuf; path = pathBuf; } diff --git a/library/cpp/string_utils/url/url.h b/library/cpp/string_utils/url/url.h index 84137ccc57..ab8924cdc2 100644 --- a/library/cpp/string_utils/url/url.h +++ b/library/cpp/string_utils/url/url.h @@ -1,28 +1,28 @@ #pragma once #include <util/generic/fwd.h> -#include <util/generic/strbuf.h> - -namespace NUrl { - - /** - * Splits URL to host and path - * Example: - * auto [host, path] = SplitUrlToHostAndPath(url); - * - * @param[in] url any URL - * @param[out] <host, path> parsed host and path - */ - struct TSplitUrlToHostAndPathResult { - TStringBuf host; - TStringBuf path; - }; - - Y_PURE_FUNCTION - TSplitUrlToHostAndPathResult SplitUrlToHostAndPath(const TStringBuf url); - -} // namespace NUrl - +#include <util/generic/strbuf.h> + +namespace NUrl { + + /** + * Splits URL to host and path + * Example: + * auto [host, path] = SplitUrlToHostAndPath(url); + * + * @param[in] url any URL + * @param[out] <host, path> parsed host and path + */ + struct TSplitUrlToHostAndPathResult { + TStringBuf host; + TStringBuf path; + }; + + Y_PURE_FUNCTION + TSplitUrlToHostAndPathResult SplitUrlToHostAndPath(const TStringBuf url); + +} // namespace NUrl + Y_PURE_FUNCTION size_t GetHttpPrefixSize(const char* url, bool ignorehttps = false) noexcept; Y_PURE_FUNCTION |