]> git.sesse.net Git - vlc/commitdiff
vlc_getaddrinfo: pass AI_IDN explicitly where applicable
authorRémi Denis-Courmont <remi@remlab.net>
Sun, 19 Aug 2012 13:36:03 +0000 (16:36 +0300)
committerRémi Denis-Courmont <remi@remlab.net>
Sun, 19 Aug 2012 13:47:01 +0000 (16:47 +0300)
include/vlc_network.h
modules/stream_out/standard.c
src/network/getaddrinfo.c
src/network/io.c
src/network/tcp.c
src/network/udp.c

index 8cfc27fd824919ad60fd5fbd9b1392d234fceb43..c573f72d0be458ee912068c69971f167a02334bf 100644 (file)
@@ -224,6 +224,9 @@ VLC_API ssize_t net_vaPrintf( vlc_object_t *p_this, int fd, const v_socket_t *,
 #ifndef AI_NUMERICSERV
 # define AI_NUMERICSERV 0
 #endif
+#ifndef AI_IDN
+# define AI_IDN 0 /* GNU/libc extension */
+#endif
 
 #ifdef __OS2__
 # ifndef NI_NUMERICHOST
index 93f072fd378e30d6a6ad60405a83a2d94fb33e96..8b6b929da971cc450c37f252a48312d60baa6fa7 100644 (file)
@@ -157,7 +157,7 @@ static void create_SDP(sout_stream_t *p_stream, sout_access_out_t *p_access)
         .ai_family = AF_UNSPEC,
         .ai_socktype = SOCK_DGRAM,
         .ai_protocol = 0,
-        .ai_flags = AI_NUMERICHOST | AI_NUMERICSERV
+        .ai_flags = AI_NUMERICHOST | AI_NUMERICSERV | AI_IDN,
     };
     char *shost = var_GetNonEmptyString (p_access, "src-addr");
     char *dhost = var_GetNonEmptyString (p_access, "dst-addr");
index b9e4478999f9c90e015cf7c5ba78e3b59a721437..626f4d88784ff06ea337090a79b4002c5f79e79f 100644 (file)
@@ -166,19 +166,10 @@ int vlc_getaddrinfo (const char *node, unsigned port,
             goto out;
         hints.ai_flags &= ~AI_NUMERICHOST;
     }
-#endif
-#ifdef AI_IDN
-    /* Run-time I18n Domain Names support */
-    hints.ai_flags |= AI_IDN;
-    ret = getaddrinfo (node, servname, &hints, res);
-    if (ret != EAI_BADFLAGS)
-        goto out;
-    /* IDN not available: disable and retry without it */
-    hints.ai_flags &= ~AI_IDN;
 #endif
     ret = getaddrinfo (node, servname, &hints, res);
 
-#if defined(AI_IDN) || defined(WIN32)
+#if defined(WIN32)
 out:
 #endif
     return ret;
index d5b854bbf623c7ac3b7af86512619ffb03953393..439c598369bdcaf46e8591c9694dfaff522da3fe 100644 (file)
@@ -130,7 +130,7 @@ int *net_Listen (vlc_object_t *p_this, const char *psz_host,
     struct addrinfo hints = {
         .ai_socktype = type,
         .ai_protocol = protocol,
-        .ai_flags = AI_PASSIVE | AI_NUMERICSERV,
+        .ai_flags = AI_PASSIVE | AI_NUMERICSERV | AI_IDN,
     }, *res;
 
     msg_Dbg (p_this, "net: listening to %s port %d",
index 7ba76efaf10185167d932dbb16f64c78b914b127..a3a8eabd43b0dff156bfb5aceb21e69e63dac31a 100644 (file)
@@ -134,7 +134,7 @@ int net_Connect( vlc_object_t *p_this, const char *psz_host, int i_port,
     struct addrinfo hints = {
         .ai_socktype = type,
         .ai_protocol = proto,
-        .ai_flags = AI_NUMERICSERV,
+        .ai_flags = AI_NUMERICSERV | AI_IDN,
     }, *res;
 
     int val = vlc_getaddrinfo (psz_realhost, i_realport, &hints, &res);
@@ -450,7 +450,7 @@ static int SocksHandshakeTCP( vlc_object_t *p_obj,
             .ai_family = AF_INET,
             .ai_socktype = SOCK_STREAM,
             .ai_protocol = IPPROTO_TCP,
-            .ai_flags = 0,
+            .ai_flags = AI_IDN,
         };
         struct addrinfo *res;
 
index 19a47ba508d0eb9a4c1f1605ec6b1c169bdcc0f7..1db1837039483121d9c9a1ed8c97881d37b4f61f 100644 (file)
@@ -141,7 +141,7 @@ static int net_ListenSingle (vlc_object_t *obj, const char *host, int port,
     struct addrinfo hints = {
         .ai_socktype = SOCK_DGRAM,
         .ai_protocol = protocol,
-        .ai_flags = AI_PASSIVE | AI_NUMERICSERV,
+        .ai_flags = AI_PASSIVE | AI_NUMERICSERV | AI_IDN,
     }, *res;
 
     if (host && !*host)
@@ -506,7 +506,7 @@ int net_ConnectDgram( vlc_object_t *p_this, const char *psz_host, int i_port,
     struct addrinfo hints = {
         .ai_socktype = SOCK_DGRAM,
         .ai_protocol = proto,
-        .ai_flags = AI_NUMERICSERV,
+        .ai_flags = AI_NUMERICSERV | AI_IDN,
     }, *res;
     int       i_handle = -1;
     bool      b_unreach = false;
@@ -604,7 +604,7 @@ int net_OpenDgram( vlc_object_t *obj, const char *psz_bind, int i_bind,
     struct addrinfo hints = {
         .ai_socktype = SOCK_DGRAM,
         .ai_protocol = protocol,
-        .ai_flags = AI_NUMERICSERV,
+        .ai_flags = AI_NUMERICSERV | AI_IDN,
     }, *loc, *rem;
 
     int val = vlc_getaddrinfo (psz_server, i_server, &hints, &rem);