aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/string_utils/url
diff options
context:
space:
mode:
authorRuslan Kovalev <ruslan.a.kovalev@gmail.com>2022-02-10 16:46:45 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:45 +0300
commit9123176b341b6f2658cff5132482b8237c1416c8 (patch)
tree49e222ea1c5804306084bb3ae065bb702625360f /library/cpp/string_utils/url
parent59e19371de37995fcb36beb16cd6ec030af960bc (diff)
downloadydb-9123176b341b6f2658cff5132482b8237c1416c8.tar.gz
Restoring authorship annotation for Ruslan Kovalev <ruslan.a.kovalev@gmail.com>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/string_utils/url')
-rw-r--r--library/cpp/string_utils/url/url.cpp8
-rw-r--r--library/cpp/string_utils/url/url.h4
-rw-r--r--library/cpp/string_utils/url/url_ut.cpp8
3 files changed, 10 insertions, 10 deletions
diff --git a/library/cpp/string_utils/url/url.cpp b/library/cpp/string_utils/url/url.cpp
index 5050e2bf3a..85f4ac5d69 100644
--- a/library/cpp/string_utils/url/url.cpp
+++ b/library/cpp/string_utils/url/url.cpp
@@ -48,13 +48,13 @@ namespace {
const TChar httpsPrefix[] = {'h', 't', 't', 'p', 's', ':', '/', '/', 0};
if (urlSize.Has(7) && Compare1Case2(url, httpPrefix, 7) == 0)
return 7;
- if (!ignorehttps && urlSize.Has(8) && Compare1Case2(url, httpsPrefix, 8) == 0)
+ 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) {
+ inline T CutHttpPrefixImpl(const T& url, bool ignorehttps) {
size_t prefixSize = GetHttpPrefixSizeImpl<typename T::char_type>(url.data(), TKnownSize(url.size()), ignorehttps);
if (prefixSize)
return url.substr(prefixSize);
@@ -90,11 +90,11 @@ size_t GetHttpPrefixSize(const TWtringBuf url, bool ignorehttps) noexcept {
}
TStringBuf CutHttpPrefix(const TStringBuf url, bool ignorehttps) noexcept {
- return CutHttpPrefixImpl(url, ignorehttps);
+ return CutHttpPrefixImpl(url, ignorehttps);
}
TWtringBuf CutHttpPrefix(const TWtringBuf url, bool ignorehttps) noexcept {
- return CutHttpPrefixImpl(url, ignorehttps);
+ return CutHttpPrefixImpl(url, ignorehttps);
}
size_t GetSchemePrefixSize(const TStringBuf url) noexcept {
diff --git a/library/cpp/string_utils/url/url.h b/library/cpp/string_utils/url/url.h
index 3c12e514fa..84137ccc57 100644
--- a/library/cpp/string_utils/url/url.h
+++ b/library/cpp/string_utils/url/url.h
@@ -1,4 +1,4 @@
-#pragma once
+#pragma once
#include <util/generic/fwd.h>
#include <util/generic/strbuf.h>
@@ -49,7 +49,7 @@ TStringBuf GetSchemePrefix(const TStringBuf url) noexcept;
//! @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;
diff --git a/library/cpp/string_utils/url/url_ut.cpp b/library/cpp/string_utils/url/url_ut.cpp
index 36fdaa0f6d..1588013893 100644
--- a/library/cpp/string_utils/url/url_ut.cpp
+++ b/library/cpp/string_utils/url/url_ut.cpp
@@ -19,8 +19,8 @@ Y_UNIT_TEST_SUITE(TUtilUrlTest) {
UNIT_ASSERT_VALUES_EQUAL("www.ya.ru", GetHost("www.ya.ru:8080/bebe"));
UNIT_ASSERT_VALUES_EQUAL("www.ya.ru", GetHost("https://www.ya.ru:8080/bebe"));
UNIT_ASSERT_VALUES_EQUAL("ya.ru:8080", GetHostAndPort("ya.ru:8080/bebe"));
- // irl RFC3986 sometimes gets ignored
- UNIT_ASSERT_VALUES_EQUAL("pravda-kmv.ru", GetHost("pravda-kmv.ru?page=news&id=6973"));
+ // irl RFC3986 sometimes gets ignored
+ UNIT_ASSERT_VALUES_EQUAL("pravda-kmv.ru", GetHost("pravda-kmv.ru?page=news&id=6973"));
UNIT_ASSERT_VALUES_EQUAL("pravda-kmv.ru", GetHostAndPort("pravda-kmv.ru?page=news&id=6973"));
// check simple string
UNIT_ASSERT_VALUES_EQUAL("some_blender_url", GetHost("some_blender_url"));
@@ -99,9 +99,9 @@ Y_UNIT_TEST_SUITE(TUtilUrlTest) {
UNIT_ASSERT_VALUES_EQUAL("ya.ru/zzz", CutHttpPrefix("http://ya.ru/zzz"));
UNIT_ASSERT_VALUES_EQUAL("ya.ru/zzz", CutHttpPrefix("http://ya.ru/zzz", true));
UNIT_ASSERT_VALUES_EQUAL("ya.ru/zzz", CutHttpPrefix("https://ya.ru/zzz"));
- UNIT_ASSERT_VALUES_EQUAL("https://ya.ru/zzz", CutHttpPrefix("https://ya.ru/zzz", true));
+ UNIT_ASSERT_VALUES_EQUAL("https://ya.ru/zzz", CutHttpPrefix("https://ya.ru/zzz", true));
UNIT_ASSERT_VALUES_EQUAL("", CutHttpPrefix("https://")); // is that right?
- UNIT_ASSERT_VALUES_EQUAL("https://", CutHttpPrefix("https://", true)); // is that right?
+ UNIT_ASSERT_VALUES_EQUAL("https://", CutHttpPrefix("https://", true)); // is that right?
}
Y_UNIT_TEST(TestMisc) {