Ok, will simplify it … but we will need two IP sor bindAddress because initialization variable for MHD are different in IPv6 and IPv4 cases.


I use two addr variables for MHD deamon starting, in rest.cpp
static char bindIp[15] = "0.0.0.0";
static char bindIpV6[64] = "::";
static struct sockaddr_in sad;
static struct sockaddr_in6 sad_v6;
The second one must be sockaddr_in6
Parameters are differents ..
int ret = inet_pton(AF_INET, bindIp, &(sad.sin_addr.s_addr));
sad.sin_family = AF_INET;
sad.sin_port = htons(port);
and for IP v6
ret = inet_pton(AF_INET6, bindIpV6, &(sad_v6.sin6_addr.s6_addr));
if (ret != 1) {
LM_RE(1, ("V6 inet_pton fail for %s", bindIpV6));
}
sad_v6.sin6_family = AF_INET6;
sad_v6.sin6_port = htons(port);
I have not probed it, but I think if you try to make 
ret = inet_pton(AF_INET6, bindIpV6, &(sad_v6.sin6_addr.s6_addr));
In which bindIpV6 it is not an IP v6, it will fails
This sockaddr_in and sockaddr_in6 are used in MHD daemons start 
mhdDaemon = MHD_start_daemon(MHD_USE_THREAD_PER_CONNECTION,
….
MHD_OPTION_SOCK_ADDR, (struct sockaddr*) &sad,
mhdDaemon_v6 = MHD_start_daemon(MHD_USE_THREAD_PER_CONNECTION | MHD_USE_IPv6,

…
MHD_OPTION_SOCK_ADDR, (struct sockaddr*) &sad_v6,