MCPcopy Create free account
hub / github.com/catboost/catboost / GetSchemeHost

Function GetSchemeHost

library/cpp/string_utils/url/url.cpp:195–208  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

193}
194
195TStringBuf GetSchemeHost(const TStringBuf url Y_LIFETIME_BOUND, bool trimHttp) noexcept {
196 const size_t schemeSize = GetSchemePrefixSize(url);
197 const TStringBuf scheme = url.Head(schemeSize);
198
199 const bool isHttp = (schemeSize == 0 || scheme == TStringBuf("http://"));
200
201 const TStringBuf host = GetHost(url.Tail(schemeSize));
202
203 if (isHttp && trimHttp) {
204 return host;
205 } else {
206 return TStringBuf(scheme.begin(), host.end());
207 }
208}
209
210TStringBuf GetSchemeHostAndPort(const TStringBuf url Y_LIFETIME_BOUND, bool trimHttp, bool trimDefaultPort) noexcept {
211 const size_t schemeSize = GetSchemePrefixSize(url);

Callers 1

Y_UNIT_TESTFunction · 0.85

Calls 6

GetSchemePrefixSizeFunction · 0.85
GetHostFunction · 0.85
TailMethod · 0.80
HeadMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected