fix: Fixing how the hostname is identified to consider IPv6
This commit is contained in:
committed by
Michael Davidsaver
parent
01c11e16b1
commit
55d1b7292a
+4
-4
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user