[vlc-commits] vlc_getaddrinfo: pass AI_IDN explicitly where applicable
Rémi Denis-Courmont
git at videolan.org
Sun Aug 19 15:44:49 CEST 2012
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Aug 19 16:36:03 2012 +0300| [579911818ad4905a64147ccf0c8f5e17569e39e6] | committer: Rémi Denis-Courmont
vlc_getaddrinfo: pass AI_IDN explicitly where applicable
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=579911818ad4905a64147ccf0c8f5e17569e39e6
---
include/vlc_network.h | 3 +++
modules/stream_out/standard.c | 2 +-
src/network/getaddrinfo.c | 11 +----------
src/network/io.c | 2 +-
src/network/tcp.c | 4 ++--
src/network/udp.c | 6 +++---
6 files changed, 11 insertions(+), 17 deletions(-)
diff --git a/include/vlc_network.h b/include/vlc_network.h
index 8cfc27f..c573f72 100644
--- a/include/vlc_network.h
+++ b/include/vlc_network.h
@@ -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
diff --git a/modules/stream_out/standard.c b/modules/stream_out/standard.c
index 93f072f..8b6b929 100644
--- a/modules/stream_out/standard.c
+++ b/modules/stream_out/standard.c
@@ -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");
diff --git a/src/network/getaddrinfo.c b/src/network/getaddrinfo.c
index ea5bd94..fe9cc59 100644
--- a/src/network/getaddrinfo.c
+++ b/src/network/getaddrinfo.c
@@ -168,18 +168,9 @@ int vlc_getaddrinfo (const char *node, unsigned port,
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;
diff --git a/src/network/io.c b/src/network/io.c
index d5b854b..439c598 100644
--- a/src/network/io.c
+++ b/src/network/io.c
@@ -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",
diff --git a/src/network/tcp.c b/src/network/tcp.c
index 7ba76ef..a3a8eab 100644
--- a/src/network/tcp.c
+++ b/src/network/tcp.c
@@ -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;
diff --git a/src/network/udp.c b/src/network/udp.c
index 19a47ba..1db1837 100644
--- a/src/network/udp.c
+++ b/src/network/udp.c
@@ -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);
More information about the vlc-commits
mailing list