This commit is contained in:
2025-02-21 12:33:11 +03:00
parent aca8a6523e
commit b860900682
3 changed files with 82 additions and 34 deletions

View File

@@ -432,8 +432,13 @@ protected:
_endpoint = other._endpoint;
_proto = other._proto;
auto idx = std::distance(other._endpoint.c_str(), other._host.data());
_host = std::string_view(_endpoint.c_str() + idx, other._host.size());
std::iterator_traits<const char*>::difference_type idx;
if (other.isLocal()) { // for 'local' host is one of static class constants
_host = other._host;
} else {
idx = std::distance(other._endpoint.c_str(), other._host.data());
_host = std::string_view(_endpoint.c_str() + idx, other._host.size());
}
idx = std::distance(other._endpoint.c_str(), other._path.data());
_path = std::string_view(_endpoint.c_str() + idx, other._path.size());