26#ifndef YUNI_OS_WINDOWS
31#include <yuni/core/system/windows.hdr.h>
36template<
class AnyStringT>
37void InternalAppendHostname(AnyStringT& out)
39#ifndef YUNI_OS_WINDOWS
41 if (0 != gethostname(hostname,
sizeof(hostname)))
46 hostname[
sizeof(hostname) - 1] =
'\0';
48 struct addrinfo hints, *info, *p;
50 memset(&hints, 0,
sizeof hints);
51 hints.ai_family = AF_UNSPEC;
52 hints.ai_socktype = SOCK_STREAM;
53 hints.ai_flags = AI_CANONNAME;
55 if ((gai_result = getaddrinfo(hostname,
"http", &hints, &info)) != 0)
61 for (p = info; p != NULL; p = p->ai_next)
63 const char*
const name = p->ai_canonname;
64 if (name and
'\0' != *name)
75 const WORD wVersionRequested = MAKEWORD(2, 0);
77 if (WSAStartup(wVersionRequested, &wsaData) == 0)
80 if (gethostname(name,
sizeof(name)) == 0)
82 name[
sizeof(name) - 1] =
'\0';
83 out << (
const char*)name;