aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/string_utils/url/url.h
diff options
context:
space:
mode:
authorswarmer <swarmer@yandex-team.com>2024-09-16 20:56:18 +0300
committerswarmer <swarmer@yandex-team.com>2024-09-16 21:13:10 +0300
commit701f0ceecf624ac39ed167f69657ffc90a7f821b (patch)
treeb9ead9e39fa629c5dff08b931d08410968458522 /library/cpp/string_utils/url/url.h
parent571ed30daf84e8c684f6ad0b07d7dfc74c951a4f (diff)
downloadydb-701f0ceecf624ac39ed167f69657ffc90a7f821b.tar.gz
check lifetime bounds in the url library
commit_hash:a13b2b608cf10b63726c06e1ece6405e92c41377
Diffstat (limited to 'library/cpp/string_utils/url/url.h')
-rw-r--r--library/cpp/string_utils/url/url.h48
1 files changed, 24 insertions, 24 deletions
diff --git a/library/cpp/string_utils/url/url.h b/library/cpp/string_utils/url/url.h
index 9b73233078..5e707756c3 100644
--- a/library/cpp/string_utils/url/url.h
+++ b/library/cpp/string_utils/url/url.h
@@ -19,12 +19,12 @@ namespace NUrl {
};
Y_PURE_FUNCTION
- TSplitUrlToHostAndPathResult SplitUrlToHostAndPath(const TStringBuf url);
+ TSplitUrlToHostAndPathResult SplitUrlToHostAndPath(const TStringBuf url Y_LIFETIME_BOUND);
- bool HasLowerHost(const TStringBuf &url);
- TStringBuf CutHttpWwwPrefixes(const TStringBuf &url);
- TString MakeLowerHost(const TStringBuf &url, size_t shift = 0);
- TString MakeNormalized(const TStringBuf &url);
+ bool HasLowerHost(const TStringBuf url);
+ TStringBuf CutHttpWwwPrefixes(const TStringBuf url Y_LIFETIME_BOUND);
+ TString MakeLowerHost(const TStringBuf url, size_t shift = 0);
+ TString MakeNormalized(const TStringBuf url);
} // namespace NUrl
@@ -45,7 +45,7 @@ Y_PURE_FUNCTION
size_t GetSchemePrefixSize(const TStringBuf url) noexcept;
Y_PURE_FUNCTION
-TStringBuf GetSchemePrefix(const TStringBuf url) noexcept;
+TStringBuf GetSchemePrefix(const TStringBuf url Y_LIFETIME_BOUND) noexcept;
//! removes protocol prefixes 'http://' and 'https://' from given URL
//! @note if URL has no prefix or some other prefix the function does nothing
@@ -53,13 +53,13 @@ TStringBuf GetSchemePrefix(const TStringBuf url) noexcept;
//! @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;
+TStringBuf CutHttpPrefix(const TStringBuf url Y_LIFETIME_BOUND, bool ignorehttps = false) noexcept;
Y_PURE_FUNCTION
-TWtringBuf CutHttpPrefix(const TWtringBuf url, bool ignorehttps = false) noexcept;
+TWtringBuf CutHttpPrefix(const TWtringBuf url Y_LIFETIME_BOUND, bool ignorehttps = false) noexcept;
Y_PURE_FUNCTION
-TStringBuf CutSchemePrefix(const TStringBuf url) noexcept;
+TStringBuf CutSchemePrefix(const TStringBuf url Y_LIFETIME_BOUND) noexcept;
//! adds specified scheme prefix if URL has no scheme
//! @note if URL has scheme prefix already the function returns unchanged URL
@@ -69,16 +69,16 @@ TString AddSchemePrefix(const TString& url, const TStringBuf scheme);
TString AddSchemePrefix(const TString& url);
Y_PURE_FUNCTION
-TStringBuf GetHost(const TStringBuf url) noexcept;
+TStringBuf GetHost(const TStringBuf url Y_LIFETIME_BOUND) noexcept;
Y_PURE_FUNCTION
-TStringBuf GetHostAndPort(const TStringBuf url) noexcept;
+TStringBuf GetHostAndPort(const TStringBuf url Y_LIFETIME_BOUND) noexcept;
Y_PURE_FUNCTION
-TStringBuf GetSchemeHost(const TStringBuf url, bool trimHttp = true) noexcept;
+TStringBuf GetSchemeHost(const TStringBuf url Y_LIFETIME_BOUND, bool trimHttp = true) noexcept;
Y_PURE_FUNCTION
-TStringBuf GetSchemeHostAndPort(const TStringBuf url, bool trimHttp = true, bool trimDefaultPort = true) noexcept;
+TStringBuf GetSchemeHostAndPort(const TStringBuf url Y_LIFETIME_BOUND, bool trimHttp = true, bool trimDefaultPort = true) noexcept;
/**
* Splits URL to host and path
@@ -132,26 +132,26 @@ 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;
+TStringBuf GetPathAndQuery(const TStringBuf url Y_LIFETIME_BOUND, 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;
+TStringBuf GetOnlyHost(const TStringBuf url Y_LIFETIME_BOUND) noexcept;
Y_PURE_FUNCTION
-TStringBuf GetParentDomain(const TStringBuf host, size_t level) noexcept; // ("www.ya.ru", 2) -> "ya.ru"
+TStringBuf GetParentDomain(const TStringBuf host Y_LIFETIME_BOUND, size_t level) noexcept; // ("www.ya.ru", 2) -> "ya.ru"
Y_PURE_FUNCTION
-TStringBuf GetZone(const TStringBuf host) noexcept;
+TStringBuf GetZone(const TStringBuf host Y_LIFETIME_BOUND) noexcept;
Y_PURE_FUNCTION
-TStringBuf CutWWWPrefix(const TStringBuf url) noexcept;
+TStringBuf CutWWWPrefix(const TStringBuf url Y_LIFETIME_BOUND) noexcept;
Y_PURE_FUNCTION
-TStringBuf CutWWWNumberedPrefix(const TStringBuf url) noexcept;
+TStringBuf CutWWWNumberedPrefix(const TStringBuf url Y_LIFETIME_BOUND) noexcept;
/**
* Cuts 'm.' prefix from url if and only if the url starts with it
@@ -162,16 +162,16 @@ TStringBuf CutWWWNumberedPrefix(const TStringBuf url) noexcept;
* @return url without 'm.' or 'M.' prefix.
*/
Y_PURE_FUNCTION
-TStringBuf CutMPrefix(const TStringBuf url) noexcept;
+TStringBuf CutMPrefix(const TStringBuf url Y_LIFETIME_BOUND) noexcept;
Y_PURE_FUNCTION
-TStringBuf GetDomain(const TStringBuf host) noexcept; // should not be used
+TStringBuf GetDomain(const TStringBuf host Y_LIFETIME_BOUND) 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;
+TStringBuf RemoveFinalSlash(TStringBuf str Y_LIFETIME_BOUND) noexcept;
-TStringBuf CutUrlPrefixes(TStringBuf url) noexcept;
-bool DoesUrlPathStartWithToken(TStringBuf url, const TStringBuf& token) noexcept;
+TStringBuf CutUrlPrefixes(TStringBuf url Y_LIFETIME_BOUND) noexcept;
+bool DoesUrlPathStartWithToken(TStringBuf url, const TStringBuf token) noexcept;