fix: Fixing how the hostname is identified to consider IPv6

This commit is contained in:
Gabriel Fedel
2025-06-11 15:32:47 -07:00
committed by Michael Davidsaver
parent 01c11e16b1
commit 55d1b7292a
+4 -4
View File
@@ -24,13 +24,13 @@ namespace ioc {
*/
Credentials::Credentials(const server::ClientCredentials& clientCredentials) {
// Extract host name part (or whole thing if no colon present)
auto pos = clientCredentials.peer.find_first_of(':');
host = clientCredentials.peer.substr(0, pos);
SockAddr addr(clientCredentials.peer);
addr.setPort(0);
host = std::string(SB()<<addr.map6to4());
// "ca" style credentials
if (clientCredentials.method == "ca") {
pos = clientCredentials.account.find_last_of('/');
auto pos = clientCredentials.account.find_last_of('/');
if (pos == std::string::npos) {
cred.emplace_back(clientCredentials.account);
} else {