equal_by_name


Description:

[ Version ( since = "2.26" ) ]
public bool equal_by_name (Address addr2)

Tests if this and addr2 have the same "name".

This method can be used with hash_by_name to create a GenericSet that hashes on address "names".

Comparing by name normally means comparing the addresses by their hostnames. But if the address was originally created using an IP address literal, then it will be compared by that instead.

In particular, if "www.example.com" has the IP address 10.0.0.1, and this was created with the name "www.example.com" and addr2 was created with the name "10.0.0.1", then they will compare as unequal for purposes of equal_by_name.

This would be used to distinguish hosts in situations where different virtual hosts on the same IP address should be considered different. Eg, for purposes of HTTP authentication or cookies, two hosts with the same IP address but different names are considered to be different hosts.

See also equal_by_ip, which compares by IP address rather than by name.

Parameters:

this

a Address with a resolved name

addr2

another Address with a resolved name

Returns:

whether or not this and addr2 have the same name