Fix IPv6 address 'hostname' generation

This commit is contained in:
Les De Ridder 2020-02-12 13:55:27 +01:00
parent 85d7b02c0d
commit 3b93ecc60e
1 changed files with 3 additions and 1 deletions

View File

@ -1285,11 +1285,13 @@ Lforeach:
string getHost() string getHost()
{ {
auto address = parseAddress(_connection.peerAddress); auto address = parseAddress(_connection.remoteAddress.toAddressString);
auto hostname = address.toHostNameString; auto hostname = address.toHostNameString;
if(hostname is null) if(hostname is null)
{ {
hostname = address.toAddrString; hostname = address.toAddrString;
//TODO: Enclose IPv6 addresses in square brackets?
} }
return hostname; return hostname;
} }