diff options
author | Ilnur Khuziev <ilnur.khuziev@yandex.ru> | 2022-02-10 16:46:13 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:13 +0300 |
commit | 736dcd8ca259457a136f2f9f9168c44643914323 (patch) | |
tree | ddd46a036d68bfa83aa11b892f31243ea6b068a1 /library/cpp/string_utils/url/url.h | |
parent | 9bf2fa2b060c9881d3135c2208c624a1dd546ecc (diff) | |
download | ydb-736dcd8ca259457a136f2f9f9168c44643914323.tar.gz |
Restoring authorship annotation for Ilnur Khuziev <ilnur.khuziev@yandex.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/string_utils/url/url.h')
-rw-r--r-- | library/cpp/string_utils/url/url.h | 94 |
1 files changed, 47 insertions, 47 deletions
diff --git a/library/cpp/string_utils/url/url.h b/library/cpp/string_utils/url/url.h index 84137ccc57..64e82485a1 100644 --- a/library/cpp/string_utils/url/url.h +++ b/library/cpp/string_utils/url/url.h @@ -23,39 +23,39 @@ namespace NUrl { } // namespace NUrl -Y_PURE_FUNCTION -size_t GetHttpPrefixSize(const char* url, bool ignorehttps = false) noexcept; -Y_PURE_FUNCTION -size_t GetHttpPrefixSize(const wchar16* url, bool ignorehttps = false) noexcept; +Y_PURE_FUNCTION +size_t GetHttpPrefixSize(const char* url, bool ignorehttps = false) noexcept; +Y_PURE_FUNCTION +size_t GetHttpPrefixSize(const wchar16* url, bool ignorehttps = false) noexcept; -Y_PURE_FUNCTION -size_t GetHttpPrefixSize(const TStringBuf url, bool ignorehttps = false) noexcept; - -Y_PURE_FUNCTION -size_t GetHttpPrefixSize(const TWtringBuf url, bool ignorehttps = false) noexcept; +Y_PURE_FUNCTION +size_t GetHttpPrefixSize(const TStringBuf url, bool ignorehttps = false) noexcept; +Y_PURE_FUNCTION +size_t GetHttpPrefixSize(const TWtringBuf url, bool ignorehttps = false) noexcept; + /** BEWARE of TStringBuf! You can not use operator ~ or c_str() like in TString !!!!!!!!!!!! */ -Y_PURE_FUNCTION -size_t GetSchemePrefixSize(const TStringBuf url) noexcept; +Y_PURE_FUNCTION +size_t GetSchemePrefixSize(const TStringBuf url) noexcept; -Y_PURE_FUNCTION -TStringBuf GetSchemePrefix(const TStringBuf url) noexcept; +Y_PURE_FUNCTION +TStringBuf GetSchemePrefix(const TStringBuf url) noexcept; //! removes protocol prefixes 'http://' and 'https://' from given URL //! @note if URL has no prefix or some other prefix the function does nothing //! @param url URL from which the prefix should be removed //! @param ignorehttps if true, leaves https:// //! @return a new URL without protocol prefix -Y_PURE_FUNCTION -TStringBuf CutHttpPrefix(const TStringBuf url, bool ignorehttps = false) noexcept; - -Y_PURE_FUNCTION -TWtringBuf CutHttpPrefix(const TWtringBuf url, bool ignorehttps = false) noexcept; +Y_PURE_FUNCTION +TStringBuf CutHttpPrefix(const TStringBuf url, bool ignorehttps = false) noexcept; -Y_PURE_FUNCTION -TStringBuf CutSchemePrefix(const TStringBuf url) noexcept; +Y_PURE_FUNCTION +TWtringBuf CutHttpPrefix(const TWtringBuf url, bool ignorehttps = false) noexcept; +Y_PURE_FUNCTION +TStringBuf CutSchemePrefix(const TStringBuf url) noexcept; + //! adds specified scheme prefix if URL has no scheme //! @note if URL has scheme prefix already the function returns unchanged URL TString AddSchemePrefix(const TString& url, const TStringBuf scheme); @@ -63,15 +63,15 @@ TString AddSchemePrefix(const TString& url, const TStringBuf scheme); //! Same as `AddSchemePrefix(url, "http")`. TString AddSchemePrefix(const TString& url); -Y_PURE_FUNCTION -TStringBuf GetHost(const TStringBuf url) noexcept; - -Y_PURE_FUNCTION -TStringBuf GetHostAndPort(const TStringBuf url) noexcept; - -Y_PURE_FUNCTION -TStringBuf GetSchemeHostAndPort(const TStringBuf url, bool trimHttp = true, bool trimDefaultPort = true) noexcept; +Y_PURE_FUNCTION +TStringBuf GetHost(const TStringBuf url) noexcept; +Y_PURE_FUNCTION +TStringBuf GetHostAndPort(const TStringBuf url) noexcept; + +Y_PURE_FUNCTION +TStringBuf GetSchemeHostAndPort(const TStringBuf url, bool trimHttp = true, bool trimDefaultPort = true) noexcept; + /** * Splits URL to host and path * @@ -123,25 +123,25 @@ bool TryGetSchemeHostAndPort(const TStringBuf url, TStringBuf& scheme, TStringBu */ void GetSchemeHostAndPort(const TStringBuf url, TStringBuf& scheme, TStringBuf& host, ui16& port); -Y_PURE_FUNCTION -TStringBuf GetPathAndQuery(const TStringBuf url, bool trimFragment = true) noexcept; +Y_PURE_FUNCTION +TStringBuf GetPathAndQuery(const TStringBuf url, bool trimFragment = true) noexcept; /** * Extracts host from url and cuts http(https) protocol prefix and port if any. * @param[in] url any URL * @return host without port and http(https) prefix. */ -Y_PURE_FUNCTION -TStringBuf GetOnlyHost(const TStringBuf url) noexcept; - -Y_PURE_FUNCTION -TStringBuf GetParentDomain(const TStringBuf host, size_t level) noexcept; // ("www.ya.ru", 2) -> "ya.ru" - -Y_PURE_FUNCTION -TStringBuf GetZone(const TStringBuf host) noexcept; - -Y_PURE_FUNCTION -TStringBuf CutWWWPrefix(const TStringBuf url) noexcept; - +Y_PURE_FUNCTION +TStringBuf GetOnlyHost(const TStringBuf url) noexcept; + +Y_PURE_FUNCTION +TStringBuf GetParentDomain(const TStringBuf host, size_t level) noexcept; // ("www.ya.ru", 2) -> "ya.ru" + +Y_PURE_FUNCTION +TStringBuf GetZone(const TStringBuf host) noexcept; + +Y_PURE_FUNCTION +TStringBuf CutWWWPrefix(const TStringBuf url) noexcept; + Y_PURE_FUNCTION TStringBuf CutWWWNumberedPrefix(const TStringBuf url) noexcept; @@ -153,17 +153,17 @@ TStringBuf CutWWWNumberedPrefix(const TStringBuf url) noexcept; * @param[in] url any URL * @return url without 'm.' or 'M.' prefix. */ -Y_PURE_FUNCTION +Y_PURE_FUNCTION TStringBuf CutMPrefix(const TStringBuf url) noexcept; Y_PURE_FUNCTION -TStringBuf GetDomain(const TStringBuf host) noexcept; // should not be used - +TStringBuf GetDomain(const TStringBuf host) noexcept; // should not be used + size_t NormalizeUrlName(char* dest, const TStringBuf source, size_t dest_size); size_t NormalizeHostName(char* dest, const TStringBuf source, size_t dest_size, ui16 defport = 80); -Y_PURE_FUNCTION -TStringBuf RemoveFinalSlash(TStringBuf str) noexcept; +Y_PURE_FUNCTION +TStringBuf RemoveFinalSlash(TStringBuf str) noexcept; TStringBuf CutUrlPrefixes(TStringBuf url) noexcept; bool DoesUrlPathStartWithToken(TStringBuf url, const TStringBuf& token) noexcept; |