noxxi / p5-io-socket-ssl

IO::Socket::SSL Perl Module
36 stars 59 forks source link

&& 'unknown' ? #131

Closed willt closed 1 year ago

willt commented 1 year ago

What's the purpose of && 'unknown' here? https://github.com/noxxi/p5-io-socket-ssl/blob/0123c44983d3140955ae65947bbd4cfada2e0d13/lib/IO/Socket/SSL.pm#L2404

noxxi commented 1 year ago

If we have some hostname verification callback set, then this callback might already know the hostname it expects. In this case we should not fail if we cannot determine the hostname for verification. That's what the && does: set the name to unknown if a verification callback is set and no other name could be determined, so that the if-statement in the next line will not cause it to complain about not being able to determine the hostname.