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

Method TParsedLocation

library/cpp/neh/location.cpp:30–65  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28}
29
30TParsedLocation::TParsedLocation(TStringBuf path) {
31 path.Split(':', Scheme, path);
32 path.Skip(2);
33
34 // try to handle both https://cert=./path_to_cert@host:port/... (userinfo is "cert=./path_to_cert")
35 // and http[s]://host:port/@zzz (userinfo is empty, host is host, not zzz
36 // see SEARCH-14238
37 if (!SplitUserInfo(path, UserInfo, IsHttps(Scheme))) {
38 SplitUserInfo(path, UserInfo, false);
39 }
40
41 auto checkRange = [](size_t b, size_t e){
42 return b != TStringBuf::npos && e != TStringBuf::npos && b < e;
43 };
44
45 size_t oBracket = path.find_first_of('[');
46 size_t cBracket = path.find_first_of(']');
47 size_t endEndPointPos = path.find_first_of('/');
48 if (checkRange(oBracket, cBracket)) {
49 endEndPointPos = path.find_first_of('/', cBracket);
50 }
51 EndPoint = path.SubStr(0, endEndPointPos);
52 Host = EndPoint;
53
54 size_t lastColon = EndPoint.find_last_of(':');
55 if (checkRange(cBracket, lastColon)
56 || (cBracket == TStringBuf::npos && lastColon != TStringBuf::npos))
57 {
58 Host = EndPoint.SubStr(0, lastColon);
59 Port = EndPoint.SubStr(lastColon + 1, EndPoint.size() - lastColon + 1);
60 }
61
62 if (endEndPointPos != TStringBuf::npos) {
63 Service = path.SubStr(endEndPointPos + 1, path.size() - endEndPointPos + 1);
64 }
65}
66
67ui16 TParsedLocation::GetPort() const {
68 if (!Port) {

Callers

nothing calls this directly

Calls 8

SplitUserInfoFunction · 0.85
IsHttpsFunction · 0.85
SplitMethod · 0.45
SkipMethod · 0.45
find_first_ofMethod · 0.45
SubStrMethod · 0.45
find_last_ofMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected