aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/string_utils/url/url.cpp
diff options
context:
space:
mode:
authortobo <tobo@yandex-team.ru>2022-02-10 16:47:27 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:47:27 +0300
commit55a7f90e4cd31e9481cace8ee5dfd682c27e810e (patch)
tree9814fbd1c3effac9b8377c5d604b367b14e2db55 /library/cpp/string_utils/url/url.cpp
parent7fe839092527589b38f014d854c51565b3c1adfa (diff)
downloadydb-55a7f90e4cd31e9481cace8ee5dfd682c27e810e.tar.gz
Restoring authorship annotation for <tobo@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.cpp22
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 ae70184c31..85f4ac5d69 100644
--- a/library/cpp/string_utils/url/url.cpp
+++ b/library/cpp/string_utils/url/url.cpp
@@ -17,14 +17,14 @@
namespace {
struct TUncheckedSize {
- static bool Has(size_t) {
+ static bool Has(size_t) {
return true;
}
};
struct TKnownSize {
size_t MySize;
- explicit TKnownSize(size_t sz)
+ explicit TKnownSize(size_t sz)
: MySize(sz)
{
}
@@ -158,17 +158,17 @@ TStringBuf GetSchemeHostAndPort(const TStringBuf url, bool trimHttp, bool trimDe
const size_t schemeSize = GetSchemePrefixSize(url);
const TStringBuf scheme = url.Head(schemeSize);
- const bool isHttp = (schemeSize == 0 || scheme == TStringBuf("http://"));
+ const bool isHttp = (schemeSize == 0 || scheme == TStringBuf("http://"));
TStringBuf hostAndPort = GetHostAndPort(url.Tail(schemeSize));
if (trimDefaultPort) {
const size_t pos = hostAndPort.find(':');
if (pos != TStringBuf::npos) {
- const bool isHttps = (scheme == TStringBuf("https://"));
+ const bool isHttps = (scheme == TStringBuf("https://"));
const TStringBuf port = hostAndPort.Tail(pos + 1);
- if ((isHttp && port == TStringBuf("80")) || (isHttps && port == TStringBuf("443"))) {
+ if ((isHttp && port == TStringBuf("80")) || (isHttps && port == TStringBuf("443"))) {
// trimming default port
hostAndPort = hostAndPort.Head(pos);
}
@@ -221,9 +221,9 @@ bool TryGetSchemeHostAndPort(const TStringBuf url, TStringBuf& scheme, TStringBu
}
} else {
host = hostAndPort;
- if (scheme == TStringBuf("https://")) {
+ if (scheme == TStringBuf("https://")) {
port = 443;
- } else if (scheme == TStringBuf("http://")) {
+ } else if (scheme == TStringBuf("http://")) {
port = 80;
}
}
@@ -254,7 +254,7 @@ TStringBuf GetDomain(const TStringBuf host) noexcept {
for (bool wasPoint = false; c != host.data(); --c) {
if (*c == '.') {
if (wasPoint) {
- ++c;
+ ++c;
break;
}
wasPoint = true;
@@ -316,14 +316,14 @@ static inline bool IsSchemeChar(char c) noexcept {
static bool HasPrefix(const TStringBuf url) noexcept {
TStringBuf scheme, unused;
- if (!url.TrySplit(TStringBuf("://"), scheme, unused))
+ if (!url.TrySplit(TStringBuf("://"), scheme, unused))
return false;
return AllOf(scheme, IsSchemeChar);
}
TString AddSchemePrefix(const TString& url) {
- return AddSchemePrefix(url, TStringBuf("http"));
+ return AddSchemePrefix(url, TStringBuf("http"));
}
TString AddSchemePrefix(const TString& url, TStringBuf scheme) {
@@ -331,7 +331,7 @@ TString AddSchemePrefix(const TString& url, TStringBuf scheme) {
return url;
}
- return TString::Join(scheme, TStringBuf("://"), url);
+ return TString::Join(scheme, TStringBuf("://"), url);
}
#define X(c) (c >= 'A' ? ((c & 0xdf) - 'A') + 10 : (c - '0'))