Commit a8497048 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

- Support for glibc IDN

- Run-time check for IDN
parent f9d4021d
......@@ -484,12 +484,6 @@ struct addrinfo
# define AI_NUMERICHOST 4
# endif /* if !HAVE_STRUCT_ADDRINFO */
/*** libidn support ***/
# ifndef AI_IDN
# define AI_IDN 0
# define AI_CANONIDN 0
# endif
VLC_EXPORT( const char *, vlc_gai_strerror, ( int ) );
VLC_EXPORT( int, vlc_getnameinfo, ( const struct sockaddr *, int, char *, int, int *, int ) );
VLC_EXPORT( int, vlc_getaddrinfo, ( vlc_object_t *, const char *, int, const struct addrinfo *, struct addrinfo ** ) );
......
......@@ -659,6 +659,30 @@ int vlc_getaddrinfo( vlc_object_t *p_this, const char *node,
}
#endif
#if defined( HAVE_GETADDRINFO ) || defined( UNDER_CE )
# ifdef AI_IDN
/* Run-time I18n Domain Names support */
{
static int i_idn = AI_IDN; /* beware of thread-safety */
if( i_idn )
{
int i_ret;
hints.ai_flags |= i_idn;
i_ret = getaddrinfo( psz_node, psz_service, &hints, res );
if( i_ret != EAI_BADFLAGS )
return i_ret;
/* libidn not available: disable and retry without it */
/* NOTE: Using i_idn here would not be thread-safe */
hints.ai_flags &= ~AI_IDN;
i_idn = 0;
msg_Dbg( p_this, "I18n Domain Names not supported - disabled" );
}
}
# endif
return getaddrinfo( psz_node, psz_service, &hints, res );
#else
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment