Comment #0 by dlang-bugzilla — 2015-08-30T03:01:32Z
////////////////////////// test.d //////////////////////////
import std.socket;
import std.stdio;
void main()
{
auto ai = getAddressInfo(null, "1", AddressFamily.INET);
assert(ai.length == 1);
}
////////////////////////////////////////////////////////////
On 2.068, getAddressInfo(null) is the same as getAddressInfo(""). On Windows, this binds to all external interfaces (but not localhost); on POSIX, this throws.
Introduced in https://github.com/D-Programming-Language/phobos/pull/3415
Underlying problem is almost surely the same as issue 14979, but unlike 14979 this also occurs on x86.
Comment #1 by k.hara.pg — 2015-08-31T12:52:15Z
(In reply to Vladimir Panteleev from comment #0)
> On 2.068, getAddressInfo(null) is the same as getAddressInfo(""). On
> Windows, this binds to all external interfaces (but not localhost); on
> POSIX, this throws.
>
> Introduced in https://github.com/D-Programming-Language/phobos/pull/3415
This is purely Phobos issue. By PR#3415, tempCtring() behavior is silently changed for the null input.
import std.internal.cstring;
void main()
{
const(char[]) str = null;
auto res = tempCString(str);
assert(res is null); // 2.067 is ok, but 2.068 fails
}
And in std.socket, the getaddrinfoPointer operation works differently for the null C string vs zero-length non-null C string at least on Win32. That's the cause of the getAddressInfo behavior change.
Comment #2 by dlang-bugzilla — 2015-08-31T12:54:42Z