On 9/14/11 4:27 PM, Vladimir Panteleev wrote:
On Mon, 12 Sep 2011 20:55:42 +0300, David Nadlinger <[email protected]>
wrote:

On 9/12/11 4:11 PM, Vladimir Panteleev wrote:
* Currently, reverse hostname lookup functions throw on failure. Such
lookups are not reliable and are expected to sometimes fail, so perhaps
a more appropriate behavior would be to return the requested IP address
unchanged, or a value indicating failure (null or false).

As discussed on IRC, throwing on reverse lookup failure seems very
wrong to me, as it is certainly expected. In my opinion, the best
solution would be to return null (empty string), but I am not certain
if it should still throw if something went wrong during lookup
(besides the IP address not being found).

I'll probably change the current std.socket.toHostAddrString() to
behave like this, as the current behavior is inconsistent (when the
getHostByAddr fallback is used), and I accidentally left it
undocumented anyway.

https://github.com/CyberShadow/phobos/commit/5fac9e2b5d39583235185f36b9e5bd8346be5cf3

What, my unittests for this weren't already in std.socket?! My Git-fu must have been not strong enough back then… ;)

David

Reply via email to