- httpd_host_t *host = NULL;
- vlc_value_t lockval;
- int fd = -1;
- struct addrinfo *res, *ptr;
-
- /* resolv */
-#ifdef HAVE_GETADDRINFO
- {
- vlc_value_t val;
- char psz_port[6];
- struct addrinfo hints;
- int check;
-
- memset( &hints, 0, sizeof( hints ) );
-
- /* Check if ipv4 or ipv6 were forced */
- var_Create( p_this, "ipv4", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
- var_Get( p_this, "ipv4", &val );
- if( val.b_bool )
- hints.ai_family = PF_INET;
-
- var_Create( p_this, "ipv6", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
- var_Get( p_this, "ipv6", &val );
- if( val.b_bool )
- hints.ai_family = PF_INET6;
-
- hints.ai_socktype = SOCK_STREAM;
- hints.ai_flags = AI_PASSIVE;
-
- if (*psz_host == '\0')
- psz_host = NULL;
-
- snprintf( psz_port, sizeof( psz_port ), "%d", i_port );
- psz_port[sizeof( psz_port ) - 1] = '\0';
-
- check = getaddrinfo( psz_host, psz_port, &hints, &res );
- if( check != 0 )
- {
-#ifdef HAVE_GAI_STRERROR
- msg_Err( p_this, "cannot resolve %s:%d : %s", psz_host, i_port,
- gai_strerror( check ) );
-#else
- msg_Err( p_this, "cannot resolve %s:%d", psz_host, i_port );
-#endif
- return NULL;
- }
- }
-
-#else
- struct sockaddr_in sock;
- struct httpd_addrinfo info;
-
- info.ai_family = PF_INET;
- info.ai_socktype = SOCK_STREAM;
- info.ai_protocol = 0;
- info.ai_addr = (struct sockaddr *)&sock;
- info.ai_addrlen = sizeof( sock );
- info.ai_next = NULL;
-
- res = &info;